oss-sec mailing list archives

CVE-2023-34241: CUPS: use-after-free in cupsdAcceptClient()


From: Zdenek Dohnal <zdohnal () redhat com>
Date: Thu, 22 Jun 2023 12:02:39 +0200

Hi all,

there is currently the embargoed CVE-2023-34241 in CUPS project:


     Summary

Cups logs data of free memory to the logging service AFTER the connection has been closed, when it should have logged the data right before.


     Details

The exact cause of this issue is the function httpClose(con->http) being called in scheduler/client.c before

|httpClose(con->http); cupsdLogClient(con, CUPSDLOGWARN, "IP lookup failed - connection from %s closed!", httpGetHostname(con->http, NULL, 0));|

The problem is that httpClose always, provided its argument is not null, frees the pointer at the end of the call, only for cupsdLogClient to pass the pointer to httpGetHostname.

This issue happens in function cupsdAcceptClient if LogLevel is |warn| or higher and in two scenarios:

 * there is a double-lookup for the IP Address (|HostNameLookups
   Double| is set in |cupsd.conf|) which fails to resolve,
 * or if CUPS is compiled with TCP wrappers and the connection is
   refused by rules from |/etc/hosts.allow| and |/etc/hosts.deny|.


     Reproducer

None provided


     Impact

This is a use-after-free bug, that impacts the entire cupsd process.

If you need an exploit scenario, consider: local (unprivileged) attacker who happens to be able to read the log using it to exfiltrate private keys and info from a privileged cups daemon
or simply denial-of-service by making it crash.


     Patch

Committed as https://github.com/OpenPrinting/cups/commit/9809947a959e18409dcf562a3466ef246cb90cb2


For OpenPrinting CUPS community,

Zdenek Dohnal (CUPS 2.4.x release manager)

--
Zdenek Dohnal
Senior Software Engineer
Red Hat, BRQ-TPBC

Current thread: