Bug 2270115 (CVE-2024-2494) - CVE-2024-2494 libvirt: negative g_new0 length can lead to unbounded memory allocation
Summary: CVE-2024-2494 libvirt: negative g_new0 length can lead to unbounded memory al...
Keywords:
Status: ASSIGNED
Alias: CVE-2024-2494
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: 2270649
Blocks: 2270120
TreeView+ depends on / blocked
 
Reported: 2024-03-18 13:44 UTC by Mauro Matteo Cascella
Modified: 2024-10-10 13:53 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the RPC library APIs of libvirt. The RPC server deserialization code allocates memory for arrays before the non-negative length check is performed by the C API entry points. Passing a negative length to the g_new0 function results in a crash due to the negative length being treated as a huge positive number. This flaw allows a local, unprivileged user to perform a denial of service attack by causing the libvirt daemon to crash.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2024:2560 0 None None None 2024-04-30 14:39:23 UTC
Red Hat Product Errata RHSA-2024:3253 0 None None None 2024-05-22 11:38:46 UTC

Description Mauro Matteo Cascella 2024-03-18 13:44:17 UTC
A flaw was found in the RPC library APIs of libvirt. The RPC server de-serialization code allocates memory for arrays before the non-negative length check is performed by the C API entry points. Passing a negative length to the g_new0 function results in a crash due to the negative length being treated as a huge positive number. A local unprivileged user could use this flaw to perform a denial of service attack by causing the libvirt daemon to crash.

Comment 2 Mauro Matteo Cascella 2024-03-21 08:59:32 UTC
Created libvirt tracking bugs for this issue:

Affects: fedora-all [bug 2270649]

Comment 4 Daniel Berrangé 2024-03-21 09:22:29 UTC
Upstream merged fix is

commit 8a3f8d957507c1f8223fdcf25a3ff885b15557f2
Author: Daniel P. Berrangé <berrange>
Date:   Fri Mar 15 10:47:50 2024 +0000

    remote: check for negative array lengths before allocation
    
    While the C API entry points will validate non-negative lengths
    for various parameters, the RPC server de-serialization code
    will need to allocate memory for arrays before entering the C
    API. These allocations will thus happen before the non-negative
    length check is performed.
    
    Passing a negative length to the g_new0 function will usually
    result in a crash due to the negative length being treated as
    a huge positive number.
    
    This was found and diagnosed by ALT Linux Team with AFLplusplus.
    
    CVE-2024-2494
    Reviewed-by: Michal Privoznik <mprivozn>
    Found-by: Alexandr Shashkin <dutyrok>
    Co-developed-by: Alexander Kuznetsov <kuznetsovam>
    Signed-off-by: Daniel P. Berrangé <berrange>

Comment 7 langosha 2024-04-16 01:45:42 UTC
(In reply to Mauro Matteo Cascella from comment #3)
> Upstream patch:
> https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/ https://monopolygo.io/
> BKRQXPLPC6B7FLHJXSBQYW7HNDEBW6RJ/

What was the nature and impact of the fix implemented in commit 8a3f8d957507c1f8223fdcf25a3ff885b15557f2, authored by Daniel P. Berrangé, regarding remote allocation and negative array lengths in the codebase?

Comment 8 errata-xmlrpc 2024-04-30 14:39:22 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:2560 https://access.redhat.com/errata/RHSA-2024:2560

Comment 9 errata-xmlrpc 2024-05-22 11:38:44 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:3253 https://access.redhat.com/errata/RHSA-2024:3253


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