linux RCE本地/公网测试

Summary

  • CVE-2024-47176 | cups-browsed <= 2.0.1 binds on UDP INADDR_ANY:631 trusting any packet from any source to trigger a IPP request to an attacker controlled URL.Get-Printer-Attributes
  • CVE-2024-47076 | libcupsfilters <= 2.1b1 does not validate or sanitize the IPP attributes returned from an IPP server, providing attacker controlled data to the rest of the CUPS system.cfGetPrinterAttributes5
  • CVE-2024-47175 | libppd <= 2.1b1 does not validate or sanitize the IPP attributes when writing them to a temporary PPD file, allowing the injection of attacker controlled data in the resulting PPD.ppdCreatePPDFromIPP2
  • CVE-2024-47177 | cups-filters <= 2.0.1 allows arbitrary command execution via the PPD parameter.foomatic-rip``FoomaticRIPCommandLine

(can you already see where this is going? :D)

Plus a couple of other bugs that will be mentioned and that are arguably security issues but have been pretty much ignored during the conversation with the developers and the CERT. They are still there, along with several other bugs that are more or less exploitable.

Impact

A remote unauthenticated attacker can silently replace existing printers' (or install new ones) IPP urls with a malicious one, resulting in arbitrary command execution (on the computer) when a print job is started (from that computer).

Entry Points

  • WAN / public internet : a remote attacker sends an UDP packet to port 631. No authentication whatsoever.
  • LAN: a local attacker can spoof zeroconf / mDNS / DNS-SD advertisements (we will talk more about this in the next writeup ) and achieve the same code path leading to RCE.

总结

  • CVE-2024-47176 漏洞 |cups-browsed <= 2.0.1 在 UDP INADDR_ANY:631 上绑定,信任来自任何来源的任何数据包,以触发对攻击者控制的 URL 的 IPP 请求。Get-Printer-Attributes
  • CVE-2024-47076 漏洞 |libcups过滤器 <= 2.1b1 不会验证或清理从 IPP 服务器返回的 IPP 属性,从而向 CUPS 系统的其余部分提供攻击者控制的数据。cfGetPrinterAttributes5
  • CVE-2024-47175 漏洞 |libppd <= 2.1b1 在将 IPP 属性写入临时 PPD 文件时不验证或清理 IPP 属性,从而允许在生成的 PPD 中注入攻击者控制的数据。ppdCreatePPDFromIPP2
  • CVE-2024-47177 漏洞 |cups-filters <= 2.0.1 允许通过 PPD 参数执行任意命令。foomatic-rip``FoomaticRIPCommandLine

此外,还有一些其他错误,这些错误可以说是安全问题,但在与开发人员和 CERT 的对话中几乎被忽略了。它们仍然存在,还有其他几个或多或少可利用的 bug。

冲击

未经身份验证的远程攻击者可以静默地将现有打印机(或安装新打印机)的 IPP URL 替换为恶意 IPP URL,从而导致在启动打印作业(从该计算机)时(在计算机上)执行任意命令。

入场点

  • WAN/公共互联网 :远程攻击者向端口 631 发送 UDP 数据包。无需任何身份验证。
  • LAN:本地攻击者可以欺骗 zeroconf / mDNS / DNS-SD 广告(我们将在下一篇文章  中详细讨论这一点)并实现导致 RCE 的相同代码路径。

本地复现

打开自己的ubuntu虚拟机,看到是有cups(通用Unix打印系统)的

配置cups的配置文件/etc/cups/cupsd.conf使其可以访问

关闭防火墙

复制代码
systemctl stop ufw
systemctl status ufw

此时的打印机服务是可以使用网页访问的

查看侦听的tcp和udp端口,可以看到确实有631的udp端口在侦听

该udp监听端口是此进程以 root 身份运行的

复制代码
ps aux | grep "cups-brow"

cups-browsed ,它的作用主要是发现新打印机并自动将它们添加到系统中

使用poc.py文件向运行了cups的服务器

然后转头在服务器的631端口查看一下,可以看到它将我们当成了新打印机并添加到系统中了

但是没有打印任务

公网复现

直接使用公网地址去执行,会报错

查看ip addr发现没有公网的网卡

猜测是使用公网地址的话没有公网网卡,导致无法绑定ip,所以使用私网地址

但是公网cups服务器没有侦听udp631端口

相关推荐
楚韵天工1 天前
宠物服务平台(程序+文档)
java·网络·数据库·spring cloud·编辑器·intellij-idea·宠物
疯狂吧小飞牛1 天前
ip rule 策略路由
linux·网络·tcp/ip·运维开发
stark张宇1 天前
网络排错全流程:从DNS解析到防火墙,逐层拆解常见问题
linux·网络协议·dns
hour_go1 天前
TCP/IP协议相关知识点
网络·笔记·网络协议·tcp/ip
Arva .1 天前
WebSocket实现网站点赞通知
网络·websocket·网络协议
雪兽软件1 天前
SaaS 安全是什么以及如何管理风险
网络·安全
纸带1 天前
USB -- SET_ADDRESS or --SET_ADDRESS or --SET_CONFIGURATION or --SET_INTERFACE
网络
white-persist1 天前
CSRF 漏洞全解析:从原理到实战
网络·python·安全·web安全·网络安全·系统安全·csrf
嫄码1 天前
TCP/IP 四层模型
网络·网络协议·tcp/ip
游戏开发爱好者81 天前
FTP 抓包分析实战,命令、被动主动模式要点、FTPS 与 SFTP 区别及真机取证流程
运维·服务器·网络·ios·小程序·uni-app·iphone