mrhenrike/MikrotikAPI-BF

GitHub: mrhenrike/MikrotikAPI-BF

面向 MikroTik RouterOS 的渗透测试框架,整合暴力破解、40 个漏洞利用、二层发现和离线凭证解码功能。

Stars: 70 | Forks: 24

# MikrotikAPI-BF v3.6.0 [![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://www.python.org/downloads/) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Version](https://img.shields.io/badge/version-3.6.0-red.svg)](https://github.com/mrhenrike/MikrotikAPI-BF/releases/tag/v3.6.0) [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](README.md) [![Wiki](https://img.shields.io/badge/Wiki-GitHub-orange)](https://github.com/mrhenrike/MikrotikAPI-BF/wiki) [![PyPI](https://img.shields.io/badge/pip-mikrotikapi--bf-blue)](https://pypi.org/project/mikrotikapi-bf/) [![CodeQL](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/7fb36943a0030224.svg)](https://github.com/mrhenrike/MikrotikAPI-BF/actions/workflows/codeql.yml) **RouterOS 攻击与利用框架** — 凭证暴力破解、**40 个 CVE/EDB PoC 漏洞利用**、MAC-Server 二层发现、离线凭证解码器、NPK 分析器、CVE 扫描器、Nmap NSE 脚本、多目标、隐蔽模式、REST/API/Winbox/FTP/SSH/Telnet/SMB/SNMP/BFD/OSPF 攻击向量。 **Portuguese (pt-BR):** [README.pt-BR.md](README.pt-BR.md) · **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md) · **Code of Conduct:** [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) · **Security:** [SECURITY.md](SECURITY.md) ## ✨ 核心功能 ### 🔐 认证与暴力破解 - **RouterOS API** (TCP 8728/8729) — 完整的二进制协议实现 (6.x MD5 challenge + 7.x 明文) - **REST API** over HTTP/HTTPS (TCP 80/443) — Basic Auth 暴力破解 - **MAC-Telnet** (TCP 20561) — 二层专有协议 (无需 IP) - **多目标** (`--target-list / -T`) — 从文件扫描,每个目标独立顺序引擎 - **线程** — 最多 15 个工作线程 (`--threads N`) ### 🔍 CVE 扫描器与漏洞利用引擎 - **40 个漏洞利用类** — 22 个 CVE + 2 个设计发现 + 13 个 Exploit-DB PoC + 5 个新 CVE - **认证前漏洞利用** — Winbox (CVE-2018-14847, CVE-2018-10066), HTTP 遍历, SNMP, SMB, BFD, OSPF, DNS - **认证后漏洞利用** — Scheduler RCE, Container 提权, FOISted, WireGuard 密钥提取, 抓包窃听 - **版本感知** — CVE 数据库映射到检测到的 RouterOS 版本适用性 - **`--scan-cve`** — 独立 CVE 扫描 (无需暴力破解) ### 🌐 Winbox CVE 覆盖 (TCP 8291) - **CVE-2018-14847** — 凭证泄露 (Chimay-Red / EternalWink) — 认证前文件读取 - **CVE-2018-10066** — 认证绕过 / 目录遍历 - **CVE-2021-27263** — 认证绕过 (RouterOS 7.0.x) - **CVE-2018-14847-MAC** — 通过 MNDP 二层发现投递相同漏洞 - **NSE 脚本** — `nse/mikrotik-winbox-cve-2018-14847.nse` (Nmap 集成) ### 🛰️ MAC-Server / 二层发现 (v3.3.0+) - **MNDP broadcast** (UDP 20561) — 即使没有 IP 也能发现设备 - **MAC-Telnet 暴力破解** (TCP 20561) — 专有 MAC-Telnet 认证 - **CVE-2018-14847-MAC** — 通过 MNDP 发现的设备进行 Winbox 凭证泄露 - **二层限制** — 需要在同一广播域 ### 🔓 离线凭证解码器 (v3.5.0+) 基于 Kirils Solovjovs 的 [mikrotik-tools](https://github.com/0ki/mikrotik-tools),移植到 Python 3: - **`--decode-userdat`** — CVE-2018-14847 提取后解码 `user.dat` (使用 MD5 密钥 XOR) - **`--decode-backup`** — 解压 `.backup` 归档 + 自动解码凭证 - **`--decode-supout`** — 列出 `supout.rif` 诊断文件中的 sections - **`--analyze-npk`** — NPK 包分析器 (CVE-2019-3977 向量) ### 🗺️ Nmap NSE 脚本 (v3.6.0+) `nse/` 中的五个 Lua 脚本用于 Nmap 集成: - `mikrotik-routeros-version.nse` — 从 HTTP/API/Winbox 指纹识别 RouterOS - `mikrotik-api-brute.nse` — 完整 API 暴力破解 (6.x MD5 + 7.x 明文认证) - `mikrotik-default-creds.nse` — 在所有接口上测试默认/空凭证 - `mikrotik-api-info.nse` — 认证后信息转储 (用户, 服务, 防火墙) - `mikrotik-winbox-cve-2018-14847.nse` — Winbox 凭证泄露检查 ### 🎯 字典 - 兼容 [mrhenrike/WordListsForHacking](https://github.com/mrhenrike/WordListsForHacking) - 包含 `labs_mikrotik_pass.lst` (MikroTik 专用), `labs_passwords.lst`, `labs_users.lst` - 智能字典引擎,支持基于目标的组合 ### 🔄 会话、隐蔽性与导出 - **持久会话** — 恢复中断的攻击 (`--resume`) - **隐蔽模式** — 斐波那契延迟,User-Agent 轮换 (`--stealth`) - **进度条** — ETA 和速度显示 (`--progress`) - **导出** — JSON, CSV, XML, TXT (`--export-all`) - **代理** — SOCKS5/HTTP 代理支持 (`--proxy socks5://...`) ## 🚀 快速开始 ### 通过 pip 安装 ``` pip install git+https://github.com/mrhenrike/MikrotikAPI-BF.git # 或 (当位于 PyPI 时): pip install mikrotikapi-bf mikrotikapi-bf --help mikrotikapi-bf --nse-path # prints NSE scripts directory for Nmap ``` ### 从源码安装 ``` git clone https://github.com/mrhenrike/MikrotikAPI-BF.git cd MikrotikAPI-BF pip install -r requirements.txt python mikrotikapi-bf.py --help ``` ### 单行命令 ``` # Basic brute-force python mikrotikapi-bf.py -t 192.168.1.1 -U admin -d wordlists/passwords.lst # Username + password lists python mikrotikapi-bf.py -t 192.168.1.1 -u users.lst -p passwords.lst # Multi-target from file python mikrotikapi-bf.py -T targets.lst -d passwords.lst --threads 5 # Full CVE scan (authenticated) python mikrotikapi-bf.py -t 192.168.1.1 --scan-cve --all-cves -U admin -P pass # Full pentest run python mikrotikapi-bf.py \ -t 192.168.1.1 \ -u wordlists/users.lst -p wordlists/passwords.lst \ --validate ftp,ssh,telnet \ --stealth --fingerprint --progress --export-all \ --threads 5 -vv # Decode user.dat after CVE-2018-14847 extraction python mikrotikapi-bf.py --decode-userdat user.dat --decode-useridx user.idx # Layer-2 MAC-Server attack python mikrotikapi-bf.py --mac-discover --mac-brute -d passwords.lst ``` ### Nmap NSE 用法 ``` # Install NSE scripts cp nse/*.nse /usr/share/nmap/scripts/ && nmap --script-updatedb # Full discovery nmap -p 80,8291,8728 --script "mikrotik-*" 192.168.1.0/24 # Check CVE-2018-14847 nmap -p 8291 --script mikrotik-winbox-cve-2018-14847 192.168.1.1 # Brute-force API nmap -p 8728 --script mikrotik-api-brute \ --script-args userdb=users.lst,passdb=passwords.lst 192.168.1.1 ``` ## 🗺️ 攻击面映射 ### 完整攻击面 — 覆盖状态 (v3.6.0) ![MikrotikAPI-BF Full Attack Surface Map](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/a088c7b93a030226.png) *完整的 RouterOS 攻击面及 MikrotikAPI-BF 覆盖指示器 (✓ 已覆盖 / ✗ 尚未覆盖)* ### 🟠 访问向量 — 覆盖详情 ![Access Vectors Coverage](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/2fb35fe44f030230.png) *橙色 = 访问向量。绿色 ✓ = 已覆盖。红色 ✗ = 尚未覆盖。* | Access Vector | Port(s) | Tool Coverage | How | |--------------|---------|--------------|-----| | **telnet** | TCP/23 | ✅ 已覆盖 | 登录后验证 (`--validate telnet`) | | **ssh** | TCP/22 | ✅ 已覆盖 | 登录后验证 + EDB-28056 (ROSSSH heap) | | **web** (WebFig/REST) | TCP/80, 443 | ✅ 已覆盖 | REST API 暴力破解 + 10+ CVE/EDB 漏洞利用 | | **winbox** | TCP/8291 | ✅ 已覆盖 | CVE-2018-14847, CVE-2018-10066, CVE-2021-27263 + NSE 脚本 | | **ftp** | TCP/21 | ✅ 已覆盖 | 登录后验证 + CVE-2019-3976/3977 + EDB-44450 | | **samba** (SMB) | TCP/445 | ✅ 已覆盖 | CVE-2018-7445, CVE-2022-45315 | | **mactel** (MAC-Telnet) | TCP/20561 | ✅ 已覆盖 | `modules/mac_server.py` — MNDP + 暴力破解 (v3.3.0+) | | **dude** | TCP/2210 | ❌ 未覆盖 | The Dude 监控客户端 — 无 PoC | | **setup** (Netinstall) | UDP/5000 | ❌ 未覆盖 | 物理/LAN 启动向量 | | **netboot** | TFTP/69 | ❌ 未覆盖 | 仅物理 LAN | | **btest** | TCP/2000 | ❌ 未覆盖 | Bandwidth Test — 协议未实现 | | **dhcp** | UDP/67-68 | ❌ 未覆盖 | 超出范围 | | **console** | RS-232 | ❌ 未覆盖 | 仅物理串口访问 | | **Woobm-USB** | USB | ❌ 未覆盖 | 仅物理访问 | **覆盖率:7 / 14 个访问向量 (50%) — 所有网络可访问向量已覆盖** ### 🔵 访问目标 — 覆盖详情 ![Access Targets Coverage](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/6f7c3bafae030234.png) *蓝色 = 访问目标。绿色 ✓ = 已覆盖。红色 ✗ = 尚未覆盖。* | Access Target | Component | Coverage | CVEs / Notes | |--------------|-----------|---------|--------------| | **filesystem** | `/flash/rw/store/` | ⚠️ 部分 | CVE-2018-14847 读取 `user.dat`;CVE-2019-3943 路径遍历 | | **supout.rif** | 诊断文件 | ✅ 已覆盖 | CVE-2023-30799 (FOISted) — 通过 supout 上传提权 | | **.npk** | 包文件 | ✅ 已覆盖 | CVE-2019-3977/3976 — 通过 NPK 任意执行/读取 | | **.backup** | 配置备份 | ❌ 未覆盖 | 没有用于备份文件提取/滥用的漏洞利用 | | **FLASH** | 内部 flash | ❌ 未覆盖 | 需要文件系统或物理访问 | | **NAND** | NAND 存储 | ❌ 未覆盖 | 底层,物理访问 | | **HDD** | 硬盘 (CHR) | ❌ 未覆盖 | CHR 专用 — 无直接漏洞利用路径 | | **kvm** | 虚拟机 | ❌ 未覆盖 | KVM hypervisor — 超出范围 | ## 📄 CLI 参考 (所有参数) | Flag | Short | Description | Default | |------|-------|-------------|---------| | `--target` | `-t` | 目标 IP/主机名 | — | | `--target-list` | `-T` | 目标文件 (每行一个) | — | | `--user` | `-U` | 单个用户名 | admin | | `--passw` | `-P` | 单个密码 | — | | `--userlist` | `-u` | 用户名字典文件 | — | | `--passlist` | `-p` | 密码字典文件 | — | | `--dictionary` | `-d` | 组合文件 (`user:pass`) | — | | `--seconds` | `-s` | 尝试间隔延迟 (秒) | 5 | | `--threads` | — | 线程数 (最大 15) | 2 | | `--api-port` | — | RouterOS API 端口 | 8728 | | `--rest-port` | — | RouterOS REST 端口 | 8729 | | `--http-port` | — | HTTP 端口 | 80 | | `--ssl` | — | 使用 HTTPS/API-SSL | false | | `--ssl-port` | — | HTTPS 端口 | 443 | | `--validate` | — | 登录后验证 (`ftp,ssh,telnet`) | — | | `--verbose` | `-v` | 显示失败尝试 | false | | `--verbose-all` | `-vv` | 完整调试 | false | | `--progress` | — | 进度条 + ETA | false | | `--stealth` | — | 隐蔽延迟 + UA 轮换 | false | | `--fingerprint` | — | 高级设备指纹识别 | false | | `--exploit` | — | 暴力破解后运行漏洞扫描器 | false | | `--scan-cve` | — | 独立 CVE 扫描 (无 BF) | false | | `--all-cves` | — | 显示所有 CVE (忽略版本) | false | | `--proxy` | — 代理 URL (`socks5://...`) | — | | `--interactive` | — | 启动交互式 REPL | false | | `--max-retries` | — | 连接重试次数 | 1 | | `--export` | — | 格式: `json,csv,xml,txt` | — | | `--export-all` | — | 导出为所有格式 | false | | `--export-dir` | — | 输出目录 | results | | `--resume` | — | 恢复之前的会话 | false | | `--force` | — | 强制新会话 | false | | `--list-sessions` | — | 列出已保存的会话 | — | | `--mac-discover` | — | MNDP 广播发现 | false | | `--mac-brute` | — | 通过 MAC-Telnet 暴力破解 | false | | `--mac-scan-cve` | — | CVE-2018-14847-MAC | false | | `--mac-iface-ip` | — | 用于 MNDP 的本地 IP | 0.0.0.0 | | `--decode-userdat` | — | 离线解码 `user.dat` | — | | `--decode-useridx` | — | 伴随的 `user.idx` | — | | `--decode-backup` | — | 解码 `.backup` 归档 | — | | `--analyze-npk` | — | 分析 NPK 包 | — | | `--decode-supout` | — | 列出 `supout.rif` sections | — | ## 🧭 按服务划分的攻击面覆盖 | Service | Port | Brute-Force | CVE/Exploits | NSE Script | |---------|------|------------|-------------|-----------| | RouterOS API | TCP/8728 | ✅ 主要目标 | 暴力破解/速率限制暴露验证 | `mikrotik-api-brute.nse` | | REST API | TCP/80,443 | ✅ HTTP Basic Auth | CVE-2019-3924, 2019-3943, 2023-30799, 2023-30800, 2024-35274 | `mikrotik-default-creds.nse` | | Winbox | TCP/8291 | ⚠️ 否 (无认证库) | CVE-2018-14847, 2018-10066, 2021-27263 | `mikrotik-winbox-cve-2018-14847.nse` | | FTP | TCP/21 | ✅ 登录后 | CVE-2019-3976, 2019-3977, EDB-44450 | — | | SSH | TCP/22 | ✅ 登录后 | EDB-28056 (ROSSSH) | — | | Telnet | TCP/23 | ✅ 登录后 | — | — | | SMB | TCP/445 | — | CVE-2018-7445, CVE-2022-45315 | — | | SNMP | UDP/161 | — | EDB-31102, EDB-6366 | — | | MAC-Telnet | TCP/20561 | ✅ 仅二层 | CVE-2018-14847-MAC | — | ## 🔎 完整漏洞利用覆盖 (40 项) | ID | Title | CVSS | Auth | PoC | Fixed in | |----|-------|------|------|-----|---------| | CVE-2018-7445 | SMB Stack Buffer Overflow | 9.8 | No | [EDB-44290](https://www.exploit-db.com/exploits/44290) | 6.41.4 | | CVE-2018-10066 | Winbox Auth Bypass | 8.1 | No | [EDB-44813](https://www.exploit-db.com/exploits/44813) | 6.42 | | CVE-2018-14847 | Winbox Credential Disclosure (Chimay-Red) | 9.1 | No | [EDB-45220](https://www.exploit-db.com/exploits/45220) | 6.42.1 | | CVE-2018-14847-MAC | Winbox via MNDP (Layer-2) | 9.1 | No | — | 6.42.1 | | CVE-2019-3924 | WWW Firewall/NAT Bypass | 9.8 | No | [EDB-46444](https://www.exploit-db.com/exploits/46444) ✓ | 6.43.12 | | CVE-2019-3943 | HTTP Path Traversal | 8.8 | No | [EDB-46731](https://www.exploit-db.com/exploits/46731) | 6.43.8 | | CVE-2019-3976 | NPK Arbitrary File Read | 6.5 | Yes | — | 6.45.7 | | CVE-2019-3977 | NPK Arbitrary Code Execution | 7.5 | Yes | — | 6.45.7 | | CVE-2019-3978 | DNS Cache Poisoning | 7.5 | No | [EDB-47566](https://www.exploit-db.com/exploits/47566) | 6.45.7 | | CVE-2019-3981 | DNS Forwarder MitM | 7.5 | No | — | 6.45.7 | | CVE-2020-20215 | MPLS Out-of-Bounds Write (DoS) | 7.5 | Yes | — | 6.47 | | CVE-2020-5720 | UDP Fragment Crash | 7.5 | Yes | — | 6.46.5 | | CVE-2021-27263 | Winbox Auth Bypass (7.0.x) | 7.5 | No | — | 7.1 | | CVE-2021-36522 | www Authenticated RCE via Scheduler | 8.8 | Yes | — | 6.49.3 | | CVE-2021-41987 | RADIUS Client Buffer Overflow | 8.1 | No | — | 6.49.1/7.1 | | CVE-2022-34960 | Container Privilege Escalation | 8.8 | Yes | — | 7.6 | | CVE-2022-45313 | SMB Heap Use-After-Free | 8.8 | No | — | 6.49.7/7.6 | | CVE-2022-45315 | SMB Authenticated Stack Overflow | 8.8 | Yes | [EDB-51451](https://www.exploit-db.com/exploits/51451) | 6.49.7 | | CVE-2023-30799 | FOISted — supout.rif Privilege Escalation | 9.1 | Yes | — | 6.49.9 | | CVE-2023-30800 | WWW Stack-Based Buffer Overflow | 8.2 | No | — | 6.49.9 | | CVE-2024-27887 | OSPF Route Injection | 7.5 | No | — | — | | CVE-2024-2169 | BFD Reflection/Amplification Loop | 7.5 | No | — | Mitigate | | CVE-2024-35274 | Authenticated RCE via Scheduler Injection | 8.8 | Yes | — | Pending | | CVE-2025-6563 | RouterOS 7.x WebFig XSS/Open Redirect | 6.1 | No | — | Pending | | CVE-2017-20149 | www Password Exposure | 7.5 | No | — | 6.38.5 | | MIKROTIK-CONFIG-001 | WireGuard Private Key Exposure | — | Yes | — | Design | | MIKROTIK-CONFIG-002 | Packet Sniffer Remote Streaming | — | Yes | — | Design | | EDB-31102 | RouterOS 3.x SNMP SET DoS | — | No | [EDB ✓](https://www.exploit-db.com/exploits/31102) | ≤ 3.2 | | EDB-6366 | RouterOS 3.x SNMP Unauthorized Write | — | No | [EDB ✓](https://www.exploit-db.com/exploits/6366) | ≤ 3.13 | | EDB-44283/44284 | Chimay-Red Stack Clash RCE (MIPSBE+x86) | 9.8 | No | [EDB](https://www.exploit-db.com/exploits/44283) | < 6.38.4 | | EDB-44450 | FTP Daemon DoS | — | No | [EDB](https://www.exploit-db.com/exploits/44450) | 6.41.4 | | EDB-43317 | ICMP DoS (6.40.5) | — | Yes | [EDB](https://www.exploit-db.com/exploits/43317) | 6.40.5 | | EDB-41752 | RouterBoard DoS (6.38.5) | — | Yes | [EDB](https://www.exploit-db.com/exploits/41752) | 6.38.5 | | EDB-41601 | ARP Table Overflow DoS | — | No | [EDB](https://www.exploit-db.com/exploits/41601) | All | | EDB-28056 | ROSSSH sshd Remote Heap Corruption | — | No | [EDB](https://www.exploit-db.com/exploits/28056) | Multiple | | EDB-24968 | Syslog Server Windows 1.15 BoF DoS | — | No | [EDB ✓](https://www.exploit-db.com/exploits/24968) | Win app | | EDB-18817 | Generic Router DoS | — | No | [EDB](https://www.exploit-db.com/exploits/18817) | Multiple | | EDB-52366 | RouterOS 7.19.1 WebFig Reflected XSS | — | No | [EDB](https://www.exploit-db.com/exploits/52366) | 7.19.1 | | EDB-48474 | Router Monitoring System 1.2.3 SQLi | — | No | [EDB](https://www.exploit-db.com/exploits/48474) | Web app | | EDB-39817 | DNSmasq/Mikrotik Web Interface SQLi | — | No | [EDB](https://www.exploit-db.com/exploits/39817) | Web app | ## 📦 项目结构 ``` MikrotikAPI-BF/ ├── version.py # Canonical version source (edit to bump) ├── mikrotikapi-bf.py # Main entry point (v3.6.0) ├── pyproject.toml # pip package definition ├── requirements.txt ├── .env.example # Environment variable template (safe to commit) ├── SECURITY.md # Vulnerability reporting policy ├── mikrotikapi_bf/ # pip installable package │ ├── __init__.py │ └── cli.py # Entry point for `mikrotikapi-bf` command ├── nse/ # Nmap NSE scripts (v3.6.0+) │ ├── README.md │ ├── mikrotik-api-brute.nse │ ├── mikrotik-api-info.nse │ ├── mikrotik-default-creds.nse │ ├── mikrotik-routeros-version.nse │ └── mikrotik-winbox-cve-2018-14847.nse ├── core/ # Core engine │ ├── api.py # RouterOS binary API protocol │ ├── cli.py # CLI argument parsing │ ├── export.py # JSON/CSV/XML/TXT export │ ├── log.py # Logging subsystem │ ├── progress.py # Progress bar + ETA │ ├── retry.py # Retry + backoff │ └── session.py # Persistent session management ├── modules/ # Feature modules │ ├── decoder.py # RouterOS file decoder: user.dat/.backup/supout.rif (v3.6.0) │ ├── discovery.py # Network discovery │ ├── fingerprint.py # Device fingerprinting (Shodan + REST) │ ├── mac_server.py # Layer-2 MNDP discovery + MAC-Telnet (v3.3.0) │ ├── proxy.py # Proxy/SOCKS5 support │ ├── reports.py # Report generation │ ├── stealth.py # Fibonacci delays + UA rotation │ └── wordlists.py # Smart wordlist engine ├── xpl/ # Exploit/CVE engine │ ├── cve_db.py # CVE database (40 exploits) │ ├── exploits.py # 40 exploit classes │ ├── npk_decoder.py # NPK package analyzer (v3.6.0) │ ├── nvd_shodan.py # NVD API + Shodan integration │ └── scanner.py # Vulnerability scanner ├── img/ # Attack surface diagrams │ ├── mikrotik_full_attack_surface.png │ ├── mikrotik_access_vectors.png │ └── mikrotik_access_targets.png └── examples/ ├── example_basic.sh example_discovery.sh example_stealth.sh └── usernames.txt passwords.txt combos.txt ``` ## 🧱 您将遇到的 RouterOS 防御机制 - 针对认证流程的会话控制和服务器端反欺诈 - 针对每个源的请求限制和速率限制 (如果已配置) - 临时账户锁定和退避窗口 - 详尽的日志记录 (认证失败、速率限制、HTTP 4xx/5xx) - 位于 HTTP 端点前的 IDS/IPS/NAC 和类 WAF 设备 ## 🛡️ RouterOS 管理员的防御缓解措施 ``` # Disable unused services /ip service disable telnet,ftp,api # Restrict API access by source IP /ip service set api address=10.0.0.0/8 # Disable MAC-Server (L2 exposure) /tool mac-server set allowed-interface-list=none /ip neighbor discovery-settings set discover-interface-list=none # Add firewall to protect management ports /ip firewall filter add chain=input connection-state=established,related action=accept add chain=input src-address=/24 action=accept add chain=input action=drop ``` ## 📖 文档 | Resource | Link | |----------|------| | **GitHub Wiki (en-US)** | [Complete Usage Guide](https://github.com/mrhenrike/MikrotikAPI-BF/wiki/Complete-Usage-Guide) | | **GitHub Wiki (pt-BR)** | [Guia Completo](https://github.com/mrhenrike/MikrotikAPI-BF/wiki/Complete-Usage-Guide-pt-BR) | | **EDB Exploit Coverage** | [Wiki — EDB-Exploit-Coverage](https://github.com/mrhenrike/MikrotikAPI-BF/wiki/EDB-Exploit-Coverage) | | **NSE Scripts Guide** | [nse/README.md](nse/README.md) | | **Security Policy** | [SECURITY.md](SECURITY.md) | | **Changelog** | [Releases](https://github.com/mrhenrike/MikrotikAPI-BF/releases) | | **API Reference** | [docs/API_REFERENCE.md](docs/API_REFERENCE.md) | ## 📋 更新日志 ### v3.6.0 (current) - **NSE 自动安装器** — `mikrotikapi_bf/nse_installer.py` 在 `pip install` 或 `pip install --upgrade` 期间自动将 NSE 脚本复制到 Windows/Linux/macOS 上的 Nmap 目录 - **`--install-nse`** 参数和 `mikrotikapi-install-nse` 入口点,用于手动 NSE 安装 - **捆绑了 3 个官方 Nmap MikroTik 脚本**:`mikrotik-routeros-brute.nse`, `mikrotik-routeros-username-brute.nse`, `broadcast-mndp-discover.nse` - **300 线程支持** — `--threads N` (最大 300),对于大于 15 的值需强制使用 `--high-threads` 免责声明 - **`setup.py` 安装后钩子** — pip install 时自动安装 NSE 脚本 - **修复 `pyproject.toml`** — 正确的 `setuptools.build_meta` 后端;包构建并通过 `twine check` - **GitHub Actions** — `.github/workflows/publish-pypi.yml` + `publish-testpypi.yml`,支持 OIDC 可信发布 - **PyPI 就绪** — `dist/mikrotikapi_bf-3.6.0-py3-none-any.whl` 已构建并验证 - **打印机 NSE 脚本** — 收集于 `dev/Printers/` (12 个脚本: HP, Xerox, Lexmark, CUPS, PJL, SNMP) - **清理披露引用** — 版本化文档现侧重于技术行为、漏洞覆盖和可复现的实验室证据 ### v3.5.3 - **5 个 N NSE 脚本** 位于 `nse/`:`mikrotik-routeros-version`, `mikrotik-api-brute`, `mikrotik-default-creds`, `mikrotik-api-info`, `mikrotik-winbox-cve-2018-14847` - **支持 pip install** — `pyproject.toml` + `mikrotikapi_bf/` 入口点包 - **`mikrotikapi-bf --nse-path`** — 打印 Nmap 已安装的 NSE 脚本目录 ### v3.5.2 - **`version.py`** — 版本的单一事实来源 (所有模块从此导入) - **`.env.example`** — 已提交的安全模板;`.env` 保留在 `.gitignore` 中 - **`python-dotenv`** — 启动时自动加载 `.env` ### v3.5.1 - 修复:CVE-2025-6563 XSS payload 中的语法错误 - 致谢与确认部分 (13 位贡献者) - 全面的 wiki 指南 en-US + pt-BR (记录了 40+ CLI 参数) ### v3.5.0 - `modules/decoder.py` — [mikrotik-tools](https://github.com/0ki/mikrotik-tools) 的 Python 3 移植:`UserDatDecoder`, `BackupDecoder`, `SupoutDecoder`, `MTDatDecoder` - `xpl/npk_decoder.py` — NPK 包分析器 (18 种部分类型) - `--target-list / -T` — 从文件进行多目标扫描 - `--decode-userdat`, `--decode-backup`, `--analyze-npk`, `--decode-supout` - 5 个新 CVE:CVE-2019-3981, CVE-2020-5720, CVE-2022-45313, CVE-2017-20149, CVE-2025-6563 - **总计:40 个漏洞利用类** | 在 RouterOS 7.20.7 上进行实验室验证 — 确认 8 个漏洞 ### v3.4.0 - 13 个 Exploit-DB 公开 PoC 漏洞利用 (完整 EDB Mikrotik 列表覆盖) - README 中完整的 CVE/EDB 覆盖表 ### v3.3.0 - MAC-Server / 二层:MNDP 发现,MAC-Telnet 暴力破解,CVE-2018-14847-MAC - 5 个新 CVE 漏洞利用类 - 攻击面图表 (3 张图片) ## 🙏 致谢与确认 | Contributor | Contribution | Link | |-------------|-------------|------| | **Federico Massa & Ramiro Caire** | MKBRUTUS — 最初的 RouterOS API 暴力破解概念 | [mkbrutusproject/MKBRUTUS](https://github.com/mkbrutusproject/MKBRUTUS) | | **Kirils Solovjovs** (@KirilsSolovjovs) | mikrotik-tools: user.dat 解码器,backup 解码器,NPK 格式研究 — 移植到 Python 3 | [0ki/mikrotik-tools](https://github.com/0ki/mikrotik-tools) | | **Dmitriusan** | 空 `read_sentence()` 修复 + socket 超时重试 (issue #3) | [Dmitriusan/MikrotikAPI-BF](https://github.com/Dmitriusan/MikrotikAPI-BF) | | **alina0x** | 通过 `ips.txt` 进行多目标扫描 → `--target-list / -T` | [alina0x/mikrotik-multithread-bf](https://github.com/alina0x/mikrotik-multithread-bf) | | **rafathasan** | 自动保存 + 会话恢复改进 | [rafathasan/MikrotikAPI-BF-Improved](https://github.com/rafathasan/MikrotikAPI-BF-Improved) | | **sajadmirave** | 暴力破解前连接检查 (PR #4) | [sajadmirave/MikrotikAPI-BF](https://github.com/sajadmirave/MikrotikAPI-BF) | | **BasuCert** | WinboxPoC / MACServerExploit.py — MAC-server 攻击参考 | [BasuCert/WinboxPoC](https://github.com/BasuCert/WinboxPoC) | | **Jacob Baines** (Tenable) | CVE-2019-3924, CVE-2019-3943, CVE-2019-3976/3977/3978 | [tenable/routeros](https://github.com/tenable/routeros) | | **BigNerd95 / Lorenzo Santina** | Chimay-Red Stack Clash PoC (EDB-44283/44284) | [BigNerd95/Chimay-Red](https://github.com/BigNerd95/Chimay-Red) | | **ShadOS** | SNMP DoS + SNMP write PoC (EDB-31102, EDB-6366) | Exploit-DB | | **FarazPajohan** | FTP/ICMP/ARP/RouterBoard DoS PoCs | Exploit-DB | | **kingcope** | ROSSSH sshd heap corruption (EDB-28056) | Exploit-DB | | **xis_one** | Syslog Server BoF DoS Metasploit module (EDB-24968) | Exploit-DB | | **hyp3rlinx** | DNSmasq/Mikrotik SQL Injection (EDB-39817) | Exploit-DB | | **Prak Sokchea** | RouterOS 7.19.1 WebFig XSS (EDB-52366) | Exploit-DB | | **0xjpuff** | CVE-2023-30799 (FOISted) PoC 参考 | [0xjpuff/CVE-2023-30799](https://github.com/0xjpuff/CVE-2023-30799) | *RouterOS 生态系统图改编自 Kirils Sol
标签:CISA项目, CVE PoC, IoT安全, MAC-Telnet, MikroTik, Nmap NSE, NPK分析, PE 加载器, PoC, Python, REST API安全, rizin, RouterOS, StruQ, Winbox协议, 二进制协议, 凭证解密, 域名收集, 多层攻击, 密码管理, 插件系统, 数据统计, 无后门, 暴力破解, 渗透测试框架, 端口扫描, 系统遥测, 网络安全, 网络设备安全, 脚本工具, 路由器安全, 防御, 隐私保护, 黑盒测试