Bug 2238464 (CVE-2023-39070) - CVE-2023-39070 cppcheck: a local code execution via the removeContradiction parameter in token.cpp:1934 due to use-after-free
Summary: CVE-2023-39070 cppcheck: a local code execution via the removeContradiction p...
Keywords:
Status: NEW
Alias: CVE-2023-39070
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2238465 2238466
Blocks: 2238467
TreeView+ depends on / blocked
 
Reported: 2023-09-12 04:29 UTC by Sandipan Roy
Modified: 2023-09-19 13:26 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the cppcheck package. A local code execution might be possible via the removeContradiction parameter in token.cpp:1934 due to a heap use-after-free.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Sandipan Roy 2023-09-12 04:29:26 UTC
An issue in Cppcheck 2.12 dev allows a local attacker to execute arbitrary code via the removeContradiction parameter in token.cpp:1934.

https://sourceforge.net/p/cppcheck/discussion/general/thread/fa43fb8ab1/

Comment 1 Sandipan Roy 2023-09-12 04:29:52 UTC
Created cppcheck tracking bugs for this issue:

Affects: epel-all [bug 2238466]
Affects: fedora-all [bug 2238465]

Comment 3 Siddhesh Poyarekar 2023-09-13 11:23:21 UTC
From the upstream bug:

"That is clearly invalid code. Cppcheck generally assumes that its input is compileable."

This is a bug, but clearly not a security vulnerability.  If a "local code execution" needs shell, it is possible for an attacker to do much more than pass arbitrary strings to cppcheck.

Comment 4 Dodji Seketeli 2023-09-19 13:26:59 UTC
(In reply to Siddhesh Poyarekar from comment #3)
> From the upstream bug:
> 
> "That is clearly invalid code. Cppcheck generally assumes that its input is
> compileable."
> 
> This is a bug, but clearly not a security vulnerability.  If a "local code
> execution" needs shell, it is possible for an attacker to do much more than
> pass arbitrary strings to cppcheck.

Indeed.

Also, how is this related to RHEL-8?

Unless I am mistaken, the version of cppcheck in RHEL-8 is 2.4 whereas this use-after-free error is on cppcheck 2.12.  Looking at the code, 2.4 is quite different from 2.12. I have tried to reproduce the error by compiling cppcheck 2.4 (from the RHEL 8.8 branch) with asan as described in https://sourceforge.net/p/cppcheck/discussion/general/thread/fa43fb8ab1, I ran bin/cppcheck on the "poc" input program and ... there was no error.

What am I missing?


Note You need to log in before you can comment on or make changes to this bug.