CVE-2021-45840

9.8 CRITICAL

📋 TL;DR

This vulnerability allows unauthenticated attackers to execute arbitrary commands with root privileges on Terramaster NAS devices by sending specially crafted input to a specific PHP endpoint. It affects Terramaster F4-210 and F2-210 models running TOS 4.2.X versions. Successful exploitation gives complete control over the affected device.

💻 Affected Systems

Products:
  • Terramaster F4-210
  • Terramaster F2-210
Versions: TOS 4.2.X up to 4.2.15-2107141517
Operating Systems: Terramaster TOS (Linux-based)
Default Config Vulnerable: ⚠️ Yes
Notes: Affects the web management interface of Terramaster NAS devices. No special configuration required for exploitation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of the NAS device with root access, allowing data theft, ransomware deployment, lateral movement to other systems, and persistent backdoor installation.

🟠

Likely Case

Remote code execution leading to data exfiltration, cryptomining, or joining botnets, given the high CVSS score and unauthenticated nature.

🟢

If Mitigated

Limited impact if device is isolated behind strict network controls with no internet exposure, though still vulnerable to internal threats.

🌐 Internet-Facing: HIGH - The vulnerability is remotely exploitable without authentication, making internet-facing devices immediate targets.
🏢 Internal Only: HIGH - Even internally, the unauthenticated RCE allows any network user to gain root access.

🎯 Exploit Status

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

Detailed exploit analysis is publicly available in the referenced blog posts, showing straightforward exploitation via HTTP requests.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: TOS versions after 4.2.15-2107141517

Vendor Advisory: Not specified in provided references

Restart Required: Yes

Instructions:

1. Log into Terramaster TOS web interface. 2. Navigate to Control Panel > General Settings > Update & Restore. 3. Check for and apply the latest TOS update. 4. Reboot the device after update completes.

🔧 Temporary Workarounds

Block access to vulnerable endpoint

linux

Use firewall rules to block access to /tos/index.php?app/app_start_stop endpoint

iptables -A INPUT -p tcp --dport 80 -m string --string "/tos/index.php?app/app_start_stop" --algo bm -j DROP
iptables -A INPUT -p tcp --dport 443 -m string --string "/tos/index.php?app/app_start_stop" --algo bm -j DROP

Disable web interface if not needed

linux

Turn off the TOS web management interface to prevent exploitation

/etc/init.d/lighttpd stop
systemctl disable lighttpd

🧯 If You Can't Patch

  • Isolate device on separate VLAN with strict network access controls
  • Implement WAF rules to block requests containing command injection patterns

🔍 How to Verify

Check if Vulnerable:

Check TOS version in web interface: Control Panel > General Settings > About. If version is 4.2.X and build number is 2107141517 or earlier, device is vulnerable.

Check Version:

cat /etc/version or check via TOS web interface

Verify Fix Applied:

Verify TOS version is updated beyond 4.2.15-2107141517. Test by attempting to access the vulnerable endpoint with safe payloads.

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests to /tos/index.php?app/app_start_stop with unusual parameters
  • System logs showing unexpected root command execution
  • Web server logs with command injection patterns

Network Indicators:

  • HTTP POST/GET requests to vulnerable endpoint with shell metacharacters
  • Outbound connections from NAS to unknown IPs post-exploitation

SIEM Query:

source="web_access.log" AND uri="/tos/index.php?app/app_start_stop" AND (param="cmd" OR param="command" OR param="exec")

🔗 References

📤 Share & Export