CVE-2021-41987

8.1 HIGH

📋 TL;DR

This vulnerability allows remote attackers to execute arbitrary code on affected Mikrotik RouterOS devices by exploiting a heap-based buffer overflow in the SCEP Server component. Attackers need to know the scep_server_name value to trigger the overflow. This affects organizations using vulnerable Mikrotik RouterOS versions with SCEP Server enabled.

💻 Affected Systems

Products:
  • Mikrotik RouterOS
Versions: 6.46.8, 6.47.9, 6.47.10
Operating Systems: RouterOS
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when SCEP Server is enabled and configured. Requires attacker knowledge of scep_server_name value.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with attacker gaining root privileges, persistent backdoor installation, network traffic interception, and lateral movement to other systems.

🟠

Likely Case

Remote code execution leading to device takeover, credential theft, network disruption, and potential data exfiltration.

🟢

If Mitigated

Limited impact due to network segmentation, proper access controls, and monitoring, potentially only affecting isolated network segments.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploit requires knowledge of scep_server_name value but no authentication. Public technical details available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: RouterOS versions after 6.47.10

Vendor Advisory: https://mikrotik.com/download/archive

Restart Required: Yes

Instructions:

1. Download latest RouterOS version from Mikrotik archive. 2. Backup current configuration. 3. Upload and install new firmware. 4. Reboot device. 5. Verify version update.

🔧 Temporary Workarounds

Disable SCEP Server

all

Disable the vulnerable SCEP Server component if not required

/ip service disable scep

Network Segmentation

all

Restrict access to SCEP Server port (default TCP 80/443) using firewall rules

/ip firewall filter add chain=input protocol=tcp dst-port=80,443 action=drop comment="Block SCEP access"

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate affected devices
  • Deploy intrusion detection systems to monitor for exploitation attempts

🔍 How to Verify

Check if Vulnerable:

Check RouterOS version and SCEP Server status: /system resource print and /ip service print

Check Version:

/system resource print

Verify Fix Applied:

Verify RouterOS version is newer than 6.47.10 and SCEP Server is either disabled or patched

📡 Detection & Monitoring

Log Indicators:

  • Unusual SCEP Server activity
  • Buffer overflow error messages in system logs
  • Unexpected process creation

Network Indicators:

  • Traffic to SCEP Server port with malformed requests
  • Unusual outbound connections from RouterOS device

SIEM Query:

source="routeros" AND ("SCEP" OR "buffer overflow")

🔗 References

📤 Share & Export