Bug 1968040 (CVE-2021-3624)

Summary: CVE-2021-3624 dcraw: Buffer overflow caused by integer-overflow in foveon_load_camf()
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: dchen, debarshir, gwync, hobbes1069, jridky, manisandro, mattdm, mattia.verga, nphilipp, rdieter, sebastian, siddharth.kde, sipoyare, than, thibault, tuxmealux+redhatbz
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
There is a flaw in dcraw. An attacker who is able to convince a victim to open a crafted file with dcraw could trigger an unsigned integer wraparound, leading to out-of-bounds write. The greatest impact from this flaw is to system availability, data integrity, and data confidentiality.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-02 23:36:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1974999, 1975000, 1975001, 1975002, 2019611, 2019612, 2019613, 2019614, 2019615    
Bug Blocks: 1968042, 1977024    

Description Pedro Sampaio 2021-06-04 18:45:44 UTC
There is an integer overflow vulnerability in dcraw. When the victim runs dcraw with a maliciously crafted X3F input image, arbitrary code may be executed in the victim's system.

References:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984761

Comment 1 Todd Cullum 2021-06-22 21:30:05 UTC
Flaw summary:

In the foveon_load_camf() function of dcraw.c, `wide` and `high` variables are assigned by getting data from the file (via the get4() function, which reads 4 bytes from the input file). Therefore, a crafted file could control the values of these variables. They are used in the calculation of a size like so:

    meta_length = wide*high*3/2;
    meta_data = (char *) malloc (meta_length);

Therefore, it's possible for a maliciously crafted file to control the amount of bytes allocated by this malloc() call and for example, make the allocation too small. meta_data is subsequently filled with content from the input file as well. If an attacker is able to leverage this out-of-bounds write flaw to write to a key area in memory, it could potentially lead to code execution.

Comment 8 Debarshi Ray 2021-08-24 15:55:41 UTC
I am curious why there's no tracking bug for Fedora, because it has the exact same version of LibRaw as RHEL 9 and for that we do have a bug.

Comment 9 Todd Cullum 2021-11-02 23:34:10 UTC
Created LibRaw tracking bugs for this issue:

Affects: fedora-all [bug 2019614]


Created dcraw tracking bugs for this issue:

Affects: fedora-all [bug 2019611]


Created kf5-libkdcraw tracking bugs for this issue:

Affects: fedora-all [bug 2019612]


Created mingw-LibRaw tracking bugs for this issue:

Affects: fedora-all [bug 2019615]


Created rawtherapee tracking bugs for this issue:

Affects: fedora-all [bug 2019613]

Comment 10 Todd Cullum 2021-11-02 23:35:27 UTC
In reply to comment #8:
> I am curious why there's no tracking bug for Fedora, because it has the
> exact same version of LibRaw as RHEL 9 and for that we do have a bug.

Thanks for pointing this out. I was going through older flaws and noticed this too, then saw your comment. I have no idea why Fedora didn't have trackers filed, especially since it was already marked affected/fix which usually means that trackers get auto-filed... Anyway, I filed them now.