Skip to content

use-after-free in cupsdAcceptClient()

Moderate
zdohnal published GHSA-qjgh-5hcq-5f25 Jun 22, 2023

Package

No package listed

Affected versions

≥2.2.0

Patched versions

2.4.6

Description

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.

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.

Fixed by commit

9809947

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

CVE ID

CVE-2023-34241

Weaknesses

Credits