
Self-contained Python PoC exploiting the MikroTrick SSH chain (CVE-2026-86060, CVE-2026-67279) to gain unauthenticated full admin access on MikroTik RouterOS devices.
poc_mikrotrick.py is a self-contained exploit for the SSH attack chain that
CERT Polska disclosed as "MikroTrick" on 2026-09-05, exploited in the wild
since at least 2026-09-02 against internet-facing MikroTik RouterOS devices.
A single run turns an unauthenticated SSH connection into a full
administrator console. No credentials, no user interaction.
| CVE | Role in the chain | Defect |
|---|---|---|
| CVE-2026-86060 (CVSS 9.2) | Privilege escalation | The SSH login helper treats a dash-led username as a file descriptor and reads a replacement identity and policy mask from it |
| CVE-2026-67279 (CVSS 6.9) | Authentication bypass | A client-requested rekey before authentication drops the server's "must be authenticated" gate |
| CVE-2026-67277 (CVSS 8.8) | Not used by this PoC | The bandwidth-test (btest) service allows pre-auth memory disclosure and restart; relevant for fingerprinting and exposure assessment |
An additional, unnamed state bug is required: a rejected login leaves the username pending in the server's session state. The exploit relies on it in step 1 below. MikroTik's patches (2026-09-03) close the entire chain.
-2. The server rejects it but leaves it pending in the session
state. This is the campaign's first IoC: login failure for user -2.-2.ssh:-2@<ip>, the campaign
fingerprint.The exploit plants a full-privilege test account (hacker / hacker),
prints the login command, and exits. (The exploited console itself is
unstable — a later rekey re-arms the authentication gate and the channel
dies — so a normal SSH login is the durable path.)
python3 poc_mikrotrick.py <host> # plant hacker account, print ssh login
python3 poc_mikrotrick.py <host> "<ros command>" # run one command, exit
Requirement: python3-paramiko. The script is a lab client and refuses
non-private IP targets.
[7.24, 7.24.2), [7.0.0, 7.23.4), [6.0.0, 6.49.21)login failure for user -2 via sshuser <name> added by ssh:-2@<ip>ops/system/device-mode/print showing the "Flagged" marker (its absence
proves nothing)If any of these appear on a device, treat it as compromised: isolate, patch, and review all users, scripts, scheduler tasks, and tunnels.
Run this only against RouterOS instances you own or are explicitly authorized to test. Attacking devices you do not own is a crime.