Bug 1226946 (CVE-2024-33869)

Summary: VUL-0: CVE-2024-33869: ghostscript: path traversal and command execution due to path reduction
Product: [Novell Products] SUSE Security Incidents Reporter: SMASH SMASH <smash_bz>
Component: IncidentsAssignee: Johannes Meixner <jsmeix>
Status: IN_PROGRESS --- QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P3 - Medium CC: rfrohl
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/411968/
Whiteboard: CVSSv3.1:SUSE:CVE-2024-33869:5.3:(AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L)
Found By: Security Response Team Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description SMASH SMASH 2024-06-25 09:42:18 UTC
The function "gp_validate_path_len" first tests if the path has a cwd prefix and then reduces the path.

In the case of a path like "./../tmp/aa" it will first see that it has a cwd prefix and then reduce it to "../tmp/aa". When validation fails, it tries the variant without the cwd prefix by skipping the first two characters. But this will skip the ".." and validate "/tmp/aa", which is an allowed path (on Linux).

References:
https://ghostscript.readthedocs.io/en/gs10.03.1/News.html
https://bugs.ghostscript.com/show_bug.cgi?id=707691

Upstream commits:
https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=5ae2e320d69a7d0973011796bd388cd5befa1a43
https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=f5336e5b4154f515ac83bc5b9eba94302e6618d4

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2024-33869
https://bugzilla.redhat.com/show_bug.cgi?id=2293958
Comment 7 Johannes Meixner 2024-07-01 13:00:31 UTC
Fixed for OBS Printing and forwared to openSUSE Factory
-----------------------------------------------------------
# osc request accept -m "Security fixes for \
 CVE-2024-33869 bsc#1226946 and \
 CVE-2023-52722 bsc#1223852 and \
 CVE-2024-33870 bsc#1226944 and \
 CVE-2024-33871 bsc#1225491 and \
 CVE-2024-29510 bsc#1226945 \
 for ghostscript and ghostscript-mini" 1184312

...
Forward this submit to it? ([y]/n)y
...
New request # 1184313
-----------------------------------------------------------
Comment 8 OBSbugzilla Bot 2024-07-01 13:35:06 UTC
This is an autogenerated message for OBS integration:
This bug (1226946) was mentioned in
https://build.opensuse.org/request/show/1184313 Factory / ghostscript
Comment 9 Maintenance Automation 2024-07-02 16:30:10 UTC
SUSE-SU-2024:2276-1: An update that solves three vulnerabilities can now be installed.

Category: security (important)
Bug References: 1226944, 1226945, 1226946
CVE References: CVE-2024-29510, CVE-2024-33869, CVE-2024-33870
Maintenance Incident: [SUSE:Maintenance:34522](https://smelt.suse.de/incident/34522/)
Sources used:
SUSE Linux Enterprise Software Development Kit 12 SP5 (src):
 ghostscript-9.52-23.80.1
SUSE Linux Enterprise High Performance Computing 12 SP5 (src):
 ghostscript-9.52-23.80.1
SUSE Linux Enterprise Server 12 SP5 (src):
 ghostscript-9.52-23.80.1
SUSE Linux Enterprise Server for SAP Applications 12 SP5 (src):
 ghostscript-9.52-23.80.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 10 Maintenance Automation 2024-07-03 12:30:42 UTC
SUSE-SU-2024:2292-1: An update that solves three vulnerabilities can now be installed.

Category: security (important)
Bug References: 1226944, 1226945, 1226946
CVE References: CVE-2024-29510, CVE-2024-33869, CVE-2024-33870
Maintenance Incident: [SUSE:Maintenance:34519](https://smelt.suse.de/incident/34519/)
Sources used:
openSUSE Leap 15.5 (src):
 ghostscript-9.52-150000.194.1
openSUSE Leap 15.6 (src):
 ghostscript-9.52-150000.194.1
Basesystem Module 15-SP5 (src):
 ghostscript-9.52-150000.194.1
Basesystem Module 15-SP6 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise High Performance Computing 15 SP2 LTSS 15-SP2 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP3 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise High Performance Computing ESPOS 15 SP4 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP4 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Desktop 15 SP4 LTSS 15-SP4 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server 15 SP2 LTSS 15-SP2 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server 15 SP3 LTSS 15-SP3 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server 15 SP4 LTSS 15-SP4 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server for SAP Applications 15 SP2 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server for SAP Applications 15 SP3 (src):
 ghostscript-9.52-150000.194.1
SUSE Linux Enterprise Server for SAP Applications 15 SP4 (src):
 ghostscript-9.52-150000.194.1
SUSE Manager Proxy 4.3 (src):
 ghostscript-9.52-150000.194.1
SUSE Manager Retail Branch Server 4.3 (src):
 ghostscript-9.52-150000.194.1
SUSE Manager Server 4.3 (src):
 ghostscript-9.52-150000.194.1
SUSE Enterprise Storage 7.1 (src):
 ghostscript-9.52-150000.194.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.