UnixͨÓôòӡϵͳcups-browsedÔ¶³Ì´úÂëÖ´ÐÐÎó²îÆÊÎö
Ðû²¼Ê±¼ä 2024-12-13Ò»¡¢Îó²îÐÎò
2024Äê9Ô£¬Çå¾²Ñо¿Ô±Simone MargaritelliÅû¶ÁËUnixͨÓôòӡϵͳCUPS(Common UNIX Printing System)±£´æһϵÁÐÇå¾²Îó²î£¬Ê¹Óöà¸öÎó²î×éºÏ¿ÉÔÚÊÜÓ°ÏìµÄϵͳÉÏÖ´ÐÐÔ¶³ÌÏÂÁî¡£ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÑо¿Ö°Ô±¶Ô¸ÃÎó²îµÄÔÀí¾ÙÐÐÉîÈëÆÊÎö£¬Í¬Ê±Ìá³öÐÞ¸´½¨Ò黺ºÍ½â²½·¥¡£
CUPSÊÇÒ»¸ö¿ªÔ´µÄ´òӡϵͳ£¬ÓÃÓÚLinuxºÍÆäËûÀàUNIX²Ù×÷ϵͳ¡£CUPS Ìṩ Web½çÃæºÍBerkeleyÏÂÁîÐнçÃæµÈ¶àÖÖ·½·¨À´ÖÎÀí´òÓ¡»úºÍ´òӡʹÃü¡£ÀýÈç»á¼ûhttp://localhost:631¿ÉÖÎÀí´òÓ¡»ú¡£
CUPSÖ÷ҪʹÓÃInternet Printing Protocol(IPP)À´ÊµÏÖÍâµØºÍÍøÂç´òÓ¡»úµÄ´òÓ¡¹¦Ð§¡£IPPÊÇÒ»¸öÔÚ»¥ÁªÍøÉÏ´òÓ¡µÄ±ê×¼ÍøÂçÐÒ飬ËüÔÊÐíÓû§¿ÉÒÔͨ¹ý»¥ÁªÍø×÷Ô¶¾àÀë´òÓ¡¼°ÖÎÀí´òÓ¡ÊÂÇéµÈ¡£IPP½ÓÄɵij¬Îı¾´«ÊäÐÒéHTTPµÄPOSTÒªÁìÔÚ¿Í»§¶ËºÍ´òÓ¡·þÎñÆ÷Ö®¼ä¾ÙÐлỰ¡£
cups-browsedÊÇÒ»¸ö¿ªÔ´µÄ´òÓ¡·þÎñ×é¼þ£¬ËüÊÇCommon UNIX Printing System(CUPS)µÄÒ»²¿·Ö¡£cups-browsedÈÏÕæÔÚÍâµØÍøÂçÉÏ×Ô¶¯·¢Ã÷ºÍÌí¼Ó´òÓ¡»ú£¬Ê¹ÓÃmDNS£¨¶à²¥DNS£©»òDNS-SD£¨DNS·þÎñ·¢Ã÷£©ÐÒéÀ´Õì²âÍøÂçÉϵĴòÓ¡×°±¸¡£ËüʹµÃÓû§Äܹ»ÎÞÐèÊÖ¶¯ÉèÖü´¿ÉʹÓÃÍøÂç´òÓ¡»ú¡£
¸ÃÎó²îÔ´ÓÚcups-browsed·þÎñ£¬¸Ã·þÎñ°ó¶¨ÔÚUDP INADDR_ANY:631¶Ë¿ÚÉÏ£¬½ÓÊÜÈκÎip·¢Ë͹ýÀ´Êý¾Ý¡£Í¬Ê±¸Ã·þÎñÊÊÅä´ó´ó¶¼UNIXϵͳ£¬ÇÒ´ó´ó¶¼×°±¸Ä¬ÈÏ¿ªÆô¸Ã·þÎñ¡£
¸Ã·þÎñµÄ¹¦Ð§ÊÇ·¢Ã÷»¥ÁªÍøÉϵĴòÓ¡»ú£¬È»ºó½«´òÓ¡»úÌí¼Óµ½ÏµÍ³·þÎñÉÏ£¬Ïà¹Ø¹¦Ð§µÄʵÏÖ´úÂëÔÚcups-browsed.cÎļþÖС£´úÂëÖн¨ÉèÒ»¸öÃûΪBrowseSocketµÄÌ×½Ó×Ö£¬È»ºó°ó¶¨ÔÚ631¶Ë¿Ú¡£

µ±¼ì²éµ½ÏµÍ³Ö§³ÖBrowseRemoteProtocolsʱ£¬½¨ÉèÒ»¸ö UNIX Ì×½Ó×ÖͨµÀ£¬²¢ÉèÖüàÊÓ¸ÃͨµÀÉϵÄÊäÈëÊÂÎñ¡£Ò»µ©ÓÐÊý¾Ý¿É¶Á£¬½«Å²ÓÃprocess_browse_dataº¯ÊýÀ´´¦Öóͷ£ÕâЩÊý¾Ý¡£

BrowseRemoteProtocols²ÎÊý¿Éͨ¹ý/etc/cups/cups-browsed.confÎļþ¾ÙÐÐÉèÖ㬴˴¦Ò»Ñùƽ³£Ä¬ÈÏ¿ªÆô¡£

process_browse_dataÊÇÒªº¦µÄÊý¾Ý´¦Öóͷ£º¯Êý£¬¸Ãº¯ÊýŲÓÃrecvfrom´ÓBrowseSocketÌ×½Ó×Ö¶ÁÈ¡Êý¾Ý°üpacket¡£Êý¾Ý°üÃûÌÃ×ñ´ÓHEX_NUMBER HEX_NUMBER TEXT_DATA£¬Ê¹ÓøÃÃûÌõÄÊý¾ÝµÄÔµ¹ÊÔÓÉʱÊdzÌÐòÔÚ´¦Öóͷ£packetʱʹÓÃÁËÏÂÃæµÄº¯Êý¶ÔÊý¾Ý¾ÙÐд¦Öóͷ£¡£
ÎüÊÕµ½Êý¾Ý°üºó»áŲÓÃallowedº¯Êý¶Ôip¾ÙÐкÏÀíÐÔ¼ì²é£¬¸Ã¼ì²é¹æÔò¿Éͨ¹ý/etc/cups/cups-browsed.confÎļþ¾ÙÐÐÉèÖá£
allowed¼ì²éͨʺó»á½«Êý¾Ý°ü´«Èëfound_cups_printerº¯Êý¾ÙÐнøÒ»²½´¦Öóͷ£¡£
found_cups_printerº¯ÊýÖÐŲÓÃhttpSeparateURIº¯ÊýÆÊÎö´«ÈëµÄuri²ÎÊý²¢½«Æä²ð·ÖΪÐÒé¡¢Óû§Ãû¡¢Ö÷»úÃû¡¢¶Ë¿Ú¡¢×ÊԴ·¾¶µÈ²¿·Ö¡£È»ºóƾ֤ÆÊÎö»ñµÃµÄ¸÷²¿·ÖÐÅÏ¢£¬¶ÔuriÊÇ·ñ¼´ÊÇ¡±/printers/¡±ºÍ¡±/calsses/¡±×Ö·û´®¾ÙÐмì²é¡£¼ì²éͨʺóŲÓÃexamine_discovered_printer_recordº¯ÊýÀ´´¦Öóͷ£·¢Ã÷µÄ´òÓ¡»ú¼Í¼¡£

´¦Öóͷ£ÍêÊý¾ÝºóŲÓÃcfGetPrinterAttributesº¯Êý¾ÙÐлØÁ¬£¬ÆäÖÐÏÈʹÓÃhttpConnectº¯ÊýÏȽ¨ÉèhttpÅþÁ¬£¬È»ºóŲÓÃippNewRequest½¨ÉèIPPÅþÁ¬£¬×îºóÏòIPP Server·¢ËÍ»ñÈ¡´òÓ¡»úÊôÐÔµÄÇëÇó¡£

·¢ËÍÍêÇëÇóºócups-browsed³ÌÐò»áŲÓÃppdCreatePPDFromIPP2º¯Êý½¨ÉèPPDÎļþÈ»ºó½«ÎüÊյĴòÓ¡»úÊôÐÔÒÀ´ÎÉúÑĵ½ÎļþÄÚÀï¡£

ÖÁ´Ë£¬ÒѾ¿ÉÒÔÀÖ³ÉÉèÖÃPPDµÄÊôÐÔ£¬½ÓÏÂÀ´¾ÍÊÇÏë²½·¥Ö´ÐÐдÈëµÄÊý¾Ý¡£ÕâÐèҪʹÓÃCUPSµÄÒ»¸ö¹ýÂËÆ÷Ö¸ÁîcupsFilter2£¬¸ÃÖ¸ÁîÓÃÓÚ´¦Öóͷ£´òÓ¡×÷ÒµÖеÄɸѡºÍת»»²Ù×÷¡£
ÀýÈçÏÂÃæµÄÖ¸ÁîÒªÇócups½«ÇкϴòÓ¡»úÊôÐÔµÄpostscriptÃûÌõÄÊý¾Ýת´ï¸øprogram¹ýÂËÆ÷¾ÙÐд¦Öóͷ££¬ÓÅÏȼ¶Îª0¡£
CUPS»®¶¨Ö»ÄÜʹÓÃ/usr/lib/cups/filter·¾¶ÏÂÃæµÄ¿ÉÖ´ÐÐÎļþ£¬×îÖÕÒÔfoomatic-rip¹ýÂËÆ÷×÷ΪʹÓõÄÄ¿µÄ¡£¸Ã¹ýÂËÆ÷½ÓÊÜPPDÎļþÖеÄFoomaticRIPCommandLineÖ¸Áͨ¹ýËü¿ÉÒÔÖ´ÐÐí§ÒâÏÂÁî¡£
×èÖ¹ÏÖÔÚ£¬Ubuntu£¬Debian£¬FedoraµÈ¶à¸öϵͳÖÐÉæ¼°Îó²îµÄ¶à¸ö°æ±¾ÒÑ»ù±¾ÐÞ¸´¡£

ÔÚUbuntu×îаæµÄÐÞ¸´¼Æ»®ÖÐÍêȫɾ³ý¶Ô¾É°æ CUPS ÐæÅºÍ LDAP µÄÖ§³Ö¡£

Îó²îÐÞ¸´°æ±¾ÒѾÉÏ´«£¬UbuntuϵͳÖÐÔËÐÐÏÂÃæÁ½ÌõÏÂÁî¼´¿É¾ÙÐÐÉý¼¶¡£
sudo apt update
sudo apt upgrade
ÈôÊÇÉÏÃæµÄÉý¼¶²»Àֳɣ¬Ê¹ÓÃÏÂÃæÁ½ÖÖ²½·¥»º½â¸ÃÎó²î£º
£¨1£©Ö±½Ó½ûÓÃcups-browsed·þÎñ
sudo systemctl stop cups-browsed
sudo systemctl disable cups-browsed
£¨2£©ÈôÊǸù¦Ð§ÐèҪʹÓ㬽¨Ò齫/etc/cups/cups-browsed.confÖÐBrowseRemoteProtocolsÖ¸ÁîÖµ´ÓĬÈϵġ°dnssd cups¡±¸ü¸ÄΪ¡°none¡±¡£
²Î¿¼Á´½Ó£º
[1]https://www.evilsocket.net/2024/09/26/Attacking-UNIX-systems-via-CUPS-Part-I/
[2]https://gist.github.com/stong/c8847ef27910ae344a7b5408d9840ee1
[3]https://censys.com/common-unix-printing-service-vulnerabilities/
[4]https://blog.ostorlab.co/cups-vulnerabilities.html
[5]https://github.com/OpenPrinting/cups-browsed/security/advisories/GHSA-rj88-6mr5-rcw8
[6]https://ubuntu.com/security/notices/USN-7043-4
[7]https://ubuntu.com/security/notices/USN-7042-3
[8]https://launchpad.net/ubuntu/+source/cups-browsed/2.0.1-0ubuntu2.1
[9]https://www.upwind.io/feed/analyzing-the-latest-cups-rce-vulnerability-threats-and-mitigations
ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøÆð¾¢·ÀÓùʵÑéÊÒ£¨ADLab£©
ADLab½¨ÉèÓÚ1999Ä꣬ÊÇÖйúÇå¾²ÐÐÒµ×îÔ罨ÉèµÄ¹¥·ÀÊÖÒÕÑо¿ÊµÑéÊÒÖ®Ò»£¬Î¢ÈíMAPPÍýÏë½¹µã³ÉÔ±£¬¡°ºÚȸ¹¥»÷¡±¿´·¨Ê×ÍÆÕß¡£×èÖ¹ÏÖÔÚ£¬ADLabÒÑͨ¹ý CNVD/CNNVD/NVDB/CVEÀÛ¼ÆÐû²¼Çå¾²Îó²î5000Óà¸ö£¬Ò»Á¬¼á³Ö¹ú¼ÊÍøÂçÇå¾²ÁìÓòÒ»Á÷Ë®×¼¡£ÊµÑéÊÒÑо¿Æ«Ïòº¸Ç»ù´¡Çå¾²Ñо¿¡¢Êý¾ÝÇå¾²Ñо¿¡¢5GÇå¾²Ñо¿¡¢È˹¤ÖÇÄÜÇå¾²Ñо¿¡¢Òƶ¯Çå¾²Ñо¿¡¢ÎïÁªÍøÇå¾²Ñо¿¡¢³µÁªÍøÇå¾²Ñо¿¡¢¹¤¿ØÇå¾²Ñо¿¡¢ÐÅ´´Çå¾²Ñо¿¡¢ÔÆÇå¾²Ñо¿¡¢ÎÞÏßÇå¾²Ñо¿¡¢¸ß¼¶ÍþвÑо¿¡¢¹¥·Àϵͳ½¨Éè¡£Ñо¿Ð§¹ûÓ¦ÓÃÓÚ²úÆ·½¹µãÊÖÒÕÑо¿¡¢¹ú¼ÒÖصã¿Æ¼¼ÏîÄ¿¹¥¹Ø¡¢×¨ÒµÇå¾²·þÎñµÈ¡£