← posts / infrastructure

MikroTrick: check and patch your MikroTik in 15 minutes

Two chained RouterOS bugs give anyone who can reach SSH full admin, no password needed, and attacks started before the patch. Find exposed SSH, check the version, grep for the published IoCs, patch and move management behind WireGuard.

if.codesOct 1, 2026 · 8 min read#security#mikrotik#routeros#ssh#self-hostingAI-assisted

On September 2, 2026, MikroTik owners started posting odd lines from their router logs on the MikroTik forum and Reddit: a failed SSH login for a user called -2, immediately followed by a new user being added. A day later MikroTik shipped fixed RouterOS builds without much fanfare. On September 5 CERT Polska published the story: two chained bugs, now called MikroTrick, give an attacker full admin on any RouterOS device whose SSH service they can reach. No password, no key.

On September 10 CISA added two of the disclosed bugs, CVE-2026-86060 and CVE-2026-67277, to its Known Exploited Vulnerabilities catalog with a three-day remediation deadline. On September 25 it added the rekey bug, CVE-2026-67279, as well, so both halves of the chain are now on the list. If you run a MikroTik anywhere (home lab, office, a VPS edge on CHR), this is a 15-minute job: find out whether SSH is exposed, check the version, look for the known indicators, patch, and move management behind a VPN. Every command below is copy-pasteable into a RouterOS terminal or your own shell.

You need: admin access to the router (Winbox, WebFig or a local SSH session), a machine outside your network for the exposure check (a VPS or a phone hotspot) with nmap and nc, and a WireGuard client on your laptop for step 5. Steps 1 to 4 fit in 15 minutes; the WireGuard setup takes a few more if you have never done it.

What the chain does

CERT Polska's technical analysis describes two bugs that only matter together:

A conceptual representation of a vulnerability chain in a network service.
A conceptual representation of a vulnerability chain in a network service.
  • CVE-2026-67279: the SSH server mishandled key re-exchange (rekeying) during user authentication. If the client started a rekey mid-auth, the server moved on to channel handling without ever sending SSH_MSG_USERAUTH_SUCCESS. In other words, authentication could be skipped.
  • CVE-2026-86060: the login helper did not handle usernames that start with a disallowed character. A username of -2 gets parsed as a command-line argument, so the helper reads its identity from file descriptor 2 and the attacker controls the policy mask, which means full admin rights.

Two other CVEs from the same disclosure get mixed up with MikroTrick. CVE-2026-67276 (CVSS 9.2) is a separate SSH bug: RouterOS did not properly verify public keys, so someone who knows an account name and its RSA public key could log in as that user. CERT notes that some publications wrongly tied it to the chain. CVE-2026-67277 (CVSS 8.8) is in the bandwidth-test service, which let an unauthenticated connection reach a state that should need a login; combined with two smaller flaws it leaks kernel memory or crashes the device. It is not part of the chain, but it is on CISA's KEV list too. The KEV entries from this disclosure are CVE-2026-86060, CVE-2026-67277 (both added September 10) and CVE-2026-67279 (added September 25); CVE-2026-67276 is not listed.

Vulnerable: neither MikroTik nor CERT publishes an exact affected range (CERT's lab covered releases from 6.43.11 onward), so treat every build older than the fixed ones as vulnerable. Fixed builds, released September 3:

  • 6.49.21 (v6 long-term)
  • 7.23.4 (v7 long-term)
  • 7.24.2 (v7 stable)
  • 7.25beta3 (testing)

CERT has not published the full exploitation procedure, but the bug classes are now public, and exploitation in the wild started a day before the patch existed. Assume anyone can do this now.

Step 1: is SSH reachable from the internet? (2 minutes)

Check from a machine outside your network (a VPS or a phone hotspot) against your public IP. RouterOS identifies itself in the SSH banner:

# replace with your router's public IP
ROUTER=203.0.113.10

# SSH, Winbox, bandwidth-test ports
nmap -Pn -p 22,8291,2000 --open "$ROUTER"

# grab the SSH banner; RouterOS answers with SSH-2.0-ROSSSH
# (use the port SSH actually listens on if it is not 22)
nc -w 3 "$ROUTER" 22

If SSH answers with ROSSSH, you are in scope for MikroTrick. MikroTik's default configuration blocks management ports from the WAN side, so an exposed port usually means someone opened it by hand, or moved SSH to another port. If you did that, scan every port and let nmap read the banners, so SSH shows up as ROSSSH wherever it listens: nmap -Pn -sV -p- "$ROUTER".

Step 2: which version are you running? (1 minute)

/system resource print
/system package update print

Compare version with the fixed list above. Anything older than 6.49.21 on v6, older than 7.23.4 on long-term, older than 7.24.2 on stable, or older than 7.25beta3 on testing is vulnerable.

Hardware devices running RouterOS may be affected by these vulnerabilities.
Hardware devices running RouterOS may be affected by these vulnerabilities.

Step 3: look for the published indicators before you patch (5 minutes)

CERT Polska published this log pattern for a successful attack:

login failure for user -2 from <ip> via ssh
user <name> added by ssh:-2@<ip>

In the cases they saw, the new account was named ops and placed in the full group. Shortly afterwards the attacker created RouterOS diagnostic (.rif) files and pulled them out with fetch. The observed source IPs were 82.192.72.4 (successful attacks, since at least September 2) and 103.102.31.18 (exploitation attempts). Check all of it:

/log print where message~"user -2"
/log print where message~"82.192.72.4"
/log print where message~"103.102.31.18"
/user print detail
/user print where name="ops"
/user ssh-keys print
/system script print
/system scheduler print
/file print where name~"rif"

One caveat: RouterOS keeps logs in memory by default, so a reboot erases them. If you forward logs to syslog, search there too:

grep -E 'user -2|82\.192\.72\.4|103\.102\.31\.18' /var/log/mikrotik*.log

If you find a hit, do not just patch and move on. CERT's advice is to isolate the device, save the logs and configuration first (they are evidence), then factory-reset and rebuild from a trusted backup with new credentials. To save what is there right now:

/log print file=incident-log
/export file=incident-config

Then copy both files off the router (Winbox Files, or scp from a trusted host).

Need the backend underneath done properly?I build and harden Go and Python backends. The estimate is free.

Step 4: patch (5 minutes plus a reboot)

Pick the channel that matches what you run now. stable gets you 7.24.2; long-term gets you 7.23.4 on v7, or 6.49.21 on v6.

/system package update set channel=stable
/system package update check-for-updates
/system package update install

The router reboots straight after the install, so run it from a session you can afford to lose and don't change management access in the same window. When it is back, confirm the version with /system resource print.

The patched builds also check for compromise themselves. According to CERT, if they find a suspicious ops account, RouterOS disables it, writes a critical warning to the log and sets the device to Flagged status. The flag shows up as the flagged field in the device-mode output (the command CERT's advisory points to; device-mode exists on RouterOS v7), and the warning lands in the log:

/system device-mode print
/log print where topics~"critical"

If the device is flagged, follow MikroTik's Flagged status documentation. After any upgrade, MikroTik's own advice is to look through the configuration for scripts, users or other entries you don't recognise.

Step 5: take management off the internet (5 minutes)

Patching fixes this bug. Not exposing SSH protects you from the next one. MikroTik's bulletin says the same: SSH should not be open to untrusted networks, and a VPN like WireGuard beats an open management port. Build the VPN path first, so you don't lock yourself out when you restrict the services. Here 10.99.0.0/24 is a management subnet you will reach over WireGuard:

Moving management access behind a VPN reduces the attack surface.
Moving management access behind a VPN reduces the attack surface.
/interface wireguard add name=wg-mgmt listen-port=13231
/interface wireguard print
/ip address add address=10.99.0.1/24 interface=wg-mgmt
/interface wireguard peers add interface=wg-mgmt public-key="<your-laptop-public-key>" allowed-address=10.99.0.2/32
/ip firewall filter add chain=input protocol=udp dst-port=13231 action=accept comment="wg-mgmt"
/ip firewall filter move [find comment="wg-mgmt"] destination=0
/ip firewall filter print

Use the router's public key from /interface wireguard print in your laptop's WireGuard config, with Address = 10.99.0.2/32 and AllowedIPs = 10.99.0.1/32. The add puts the accept rule at the end of the input chain, behind any drop rule; the move line puts it at the top (it also works when it is the only rule). If your default config drops input from outside the LAN, also make sure wg-mgmt traffic is accepted, for example by adding the interface to the LAN interface list: /interface list member add list=LAN interface=wg-mgmt.

Once you can log in over WireGuard (at 10.99.0.1), restrict the services themselves. Keep your current session open until that works:

/ip service print
/ip service set ssh address=10.99.0.0/24
/ip service set winbox address=10.99.0.0/24
/ip service set telnet disabled=yes
/ip service set ftp disabled=yes
/ip service set www disabled=yes
/tool bandwidth-server set enabled=no

The last line turns off the bandwidth-test server, the component behind CVE-2026-67277.

Already on Tailscale? You don't have to run Tailscale on the router itself. Advertise the router's LAN from a subnet router you already have. By default Tailscale source-NATs that traffic, so the router sees your SSH sessions coming from the subnet router's LAN address. Put that single address in /ip service set ssh address=... instead of the WireGuard subnet.

Finally, test from outside again with the nmap line from step 1. Port 22 should no longer answer.

How CERT Polska found it: LLM agents on a VM farm

The research method is worth a look for anyone who ships network software. According to its write-up, CERT Polska's team ran OpenAI models it names as GPT-5.5-cyber and GPT-5.6-sol, with reduced refusal thresholds, together with locally hosted GLM, DeepSeek, Qwen and PLLuM. The agent controlled 40 Cloud Hosted Router VMs, 39 snapshots and 24 RouterOS releases through libvirt. It ran static analysis of the binaries with radare2 and Ghidra, and walked the SSH state machine by repeating, skipping and reordering protocol stages. That is exactly how the rekey-during-auth bug shows up.

The timeline matters more than the tooling. A public AI-assisted analysis of MikroTik's patch was out at 03:22 UTC on September 4, the day after the fixed builds shipped. CERT says that combining that information with its own patch diffing let it pin down CVE-2026-86060 within an hour. Once you publish a fix, the time before someone reverses it into an exploit is now measured in hours. Plan patch windows for edge devices around that.

The 15-minute checklist

  1. From outside, check whether anything answers SSH-2.0-ROSSSH on your public IPs.
  2. Compare the version against 6.49.21 / 7.23.4 / 7.24.2 / 7.25beta3.
  3. Search the logs for user -2, the two IPs, an ops user and .rif files. Save the evidence if you find anything.
  4. Upgrade, then check the Flagged status.
  5. Limit SSH and Winbox to a WireGuard or tailnet address, turn off services you don't use, and scan again.

Sources

if.codesI build RAG, AI integrations and agent pipelines on Go and Python backends — and write about it here.
// keep reading

More posts on AI and backends.

// free quote

Read something you need? I’ll quote it for free.

RAG, AI integrations, agents or the backend underneath — tell me what you have and what should change. I read every request myself.

Free · no commitment

Tell me what you have. I’ll tell you what it takes.

1Describe the projectA few sentences is enough — about two minutes.
2I review itI read it myself and may ask a follow-up question.
3You get a free quoteScope, approach and estimate — yours to keep, no strings.
What kind of project is it?
Free and without obligation. Your details are used only to reply — see the privacy policy.