CVE-2024-30247

10.0 CRITICAL

📋 TL;DR

CVE-2024-30247 is a critical command injection vulnerability in NextCloudPi that allows unauthenticated attackers to execute arbitrary commands as root via the web panel. This affects all NextCloudPi installations with the vulnerable web panel accessible. Anyone with network access to the NextCloudPi interface can exploit this without credentials.

💻 Affected Systems

Products:
  • NextCloudPi
Versions: All versions before 1.53.1
Operating Systems: Linux (all distributions running NextCloudPi)
Default Config Vulnerable: ⚠️ Yes
Notes: All default installations with web panel enabled are vulnerable. The web panel typically runs on port 4443 by default.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise: attacker gains root shell, installs persistent backdoors, steals all data, pivots to other systems, or deploys ransomware.

🟠

Likely Case

Attacker executes commands to steal Nextcloud data, install cryptocurrency miners, or create backdoor access for future attacks.

🟢

If Mitigated

No impact if system is patched or web panel is not accessible from untrusted networks.

🌐 Internet-Facing: HIGH - Internet-facing NextCloudPi instances can be exploited by any remote attacker without authentication.
🏢 Internal Only: HIGH - Even internal-only instances are vulnerable to any internal user or compromised device with network access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

The vulnerability is trivial to exploit - attackers can send crafted HTTP requests to execute commands. Public proof-of-concept code is available in the advisory.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.53.1

Vendor Advisory: https://github.com/nextcloud/nextcloudpi/security/advisories/GHSA-m597-72v7-j982

Restart Required: Yes

Instructions:

1. Backup your Nextcloud data. 2. Update NextCloudPi using: sudo ncp-update. 3. Verify update with: sudo ncp-version. 4. Restart the system or NextCloudPi services.

🔧 Temporary Workarounds

Disable web panel access

linux

Block external access to NextCloudPi web panel while waiting to patch

sudo ufw deny 4443/tcp
sudo iptables -A INPUT -p tcp --dport 4443 -j DROP

Restrict web panel to localhost

linux

Configure web panel to only listen on localhost interface

Edit /etc/apache2/sites-available/ncp-webpanel.conf and change bind address to 127.0.0.1
sudo systemctl restart apache2

🧯 If You Can't Patch

  • Immediately disable the NextCloudPi web panel service entirely
  • Place NextCloudPi behind a firewall that only allows trusted IP addresses to access port 4443

🔍 How to Verify

Check if Vulnerable:

Check if NextCloudPi version is below 1.53.1: sudo ncp-version

Check Version:

sudo ncp-version

Verify Fix Applied:

Verify version is 1.53.1 or higher: sudo ncp-version

📡 Detection & Monitoring

Log Indicators:

  • Unusual commands in /var/log/apache2/access.log or error.log
  • Suspicious POST requests to web panel endpoints
  • Root command execution from web panel process

Network Indicators:

  • Unusual outbound connections from NextCloudPi system
  • Command and control traffic patterns
  • Unexpected port scans or brute force attempts

SIEM Query:

source="apache" AND (url="*ncp*" OR url="*webpanel*") AND (method="POST" OR status="200") AND size>1000

🔗 References

📤 Share & Export