CVE-2018-18319

9.8 CRITICAL

📋 TL;DR

CVE-2018-18319 is a critical remote code execution vulnerability in Merlin.PHP component 0.6.6 for Asuswrt-Merlin devices. Attackers can execute arbitrary commands via the api.php endpoint using specially crafted URIs. This affects systems running the vulnerable Merlin.PHP component, typically on Asuswrt-Merlin router firmware.

💻 Affected Systems

Products:
  • Merlin.PHP component for Asuswrt-Merlin
Versions: Version 0.6.6
Operating Systems: Asuswrt-Merlin firmware
Default Config Vulnerable: ⚠️ Yes
Notes: Vendor indicates Merlin.PHP is designed only for trusted intranet use and intentionally allows remote code execution, but this is still a vulnerability when exposed.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise allowing attacker to execute arbitrary commands with root privileges, install malware, pivot to internal networks, or brick the device.

🟠

Likely Case

Unauthenticated remote code execution leading to device takeover, credential theft, or network monitoring.

🟢

If Mitigated

Limited impact if component is disabled or network segmentation prevents external access.

🌐 Internet-Facing: HIGH - Directly exploitable via HTTP requests without authentication.
🏢 Internal Only: HIGH - Even internal attackers can exploit this vulnerability easily.

🎯 Exploit Status

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

Exploit is trivial - demonstrated by simple HTTP request to api.php with command injection parameters.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A

Vendor Advisory: N/A

Restart Required: No

Instructions:

No official patch available. Vendor considers this intended functionality for trusted networks only.

🔧 Temporary Workarounds

Disable Merlin.PHP component

linux

Remove or disable the vulnerable Merlin.PHP component entirely

rm -rf /path/to/Merlin.PHP/
Disable via web interface if available

Network isolation

linux

Ensure Merlin.PHP is only accessible from trusted internal networks

iptables -A INPUT -p tcp --dport 80 -s ! 192.168.1.0/24 -j DROP

🧯 If You Can't Patch

  • Remove Merlin.PHP component completely from production systems
  • Implement strict network segmentation and firewall rules to isolate affected devices

🔍 How to Verify

Check if Vulnerable:

Check if Merlin.PHP 0.6.6 is installed: ls -la /path/to/Merlin.PHP/ and check version files

Check Version:

cat /path/to/Merlin.PHP/version.txt or check web interface

Verify Fix Applied:

Verify Merlin.PHP component is removed or inaccessible: curl -v http://device-ip/6/api.php should fail

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests to /6/api.php with 'function=command&class=remote' parameters
  • Unusual command execution in system logs

Network Indicators:

  • HTTP POST/GET requests to api.php endpoint with command injection parameters

SIEM Query:

source="web_logs" AND uri_path="/6/api.php" AND (query_string="*function=command*" OR query_string="*class=remote*")

🔗 References

📤 Share & Export