CVE-2024-51304

8.8 HIGH

📋 TL;DR

This vulnerability allows remote attackers to execute arbitrary commands on Draytek Vigor3900 routers by injecting malicious commands into the mainfunction.cgi component. Attackers can exploit improper input validation in the ldap_search_dn function to achieve remote code execution. Organizations using affected Draytek Vigor3900 routers are at risk.

💻 Affected Systems

Products:
  • Draytek Vigor3900
Versions: 1.5.1.3
Operating Systems: Embedded firmware
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the web interface component that handles LDAP search functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of the router allowing attackers to pivot to internal networks, intercept traffic, install persistent backdoors, or use the device as part of a botnet.

🟠

Likely Case

Attackers gain shell access to the router, enabling them to modify configurations, steal credentials, or use the device for further attacks.

🟢

If Mitigated

Limited impact if network segmentation isolates the router and proper monitoring detects exploitation attempts.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

The GitHub reference contains technical details that could facilitate exploitation. The vulnerability requires no authentication.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: Unknown

Restart Required: No

Instructions:

Check Draytek's official website for firmware updates. If available, download the latest firmware and apply through the router's web interface under System Maintenance > Firmware Upgrade.

🔧 Temporary Workarounds

Disable LDAP functionality

all

If LDAP authentication is not required, disable it in the router's configuration to remove the attack surface.

Restrict web interface access

all

Configure firewall rules to restrict access to the router's web management interface to trusted IP addresses only.

🧯 If You Can't Patch

  • Isolate the router in a dedicated network segment with strict firewall rules limiting inbound and outbound connections.
  • Implement network monitoring and intrusion detection specifically for the router's management interface traffic.

🔍 How to Verify

Check if Vulnerable:

Check the firmware version in the router's web interface under System Maintenance > Firmware Information. If version is 1.5.1.3, the device is vulnerable.

Check Version:

No CLI command available. Must check through web interface at System Maintenance > Firmware Information.

Verify Fix Applied:

After applying any firmware update, verify the version has changed from 1.5.1.3 to a newer version.

📡 Detection & Monitoring

Log Indicators:

  • Unusual LDAP search requests in router logs
  • Multiple failed authentication attempts followed by successful LDAP queries
  • Unexpected command execution patterns in system logs

Network Indicators:

  • HTTP POST requests to /cgi-bin/mainfunction.cgi with suspicious parameters
  • Unusual outbound connections from the router to external IPs

SIEM Query:

source="vigor3900" AND (url="/cgi-bin/mainfunction.cgi" OR message="ldap_search_dn")

🔗 References

📤 Share & Export