---
id: CVE-2024-2494
title: 'Libvirt: negative g_new0 length can lead to unbounded memory allocation'
summary: >-
  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 fun…
severity: medium
cvss: 6.2
cvssVector: 'CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'
cvssSource: cna
cwe:
  - CWE-789
vendor: Red Hat
product: libvirt
affected:
  - libvirt >= 9.0.0 < 9.7.0
  - 'virt-devel:rhel (all versions)'
  - 'virt:rhel (all versions)'
  - libvirt (all versions)
  - libvirt
  - libvirt
  - 'virt:av/libvirt (all versions)'
ssvc:
  exploitation: none
  automatable: 'no'
  technicalImpact: partial
  timestamp: '2024-05-01T15:14:30.397427Z'
published: '2024-03-21'
updated: '2026-11-05'
sourceUpdated: '2026-11-05T12:01:51.705Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2024-2494'
references:
  - url: 'https://access.redhat.com/errata/RHSA-2024:2560'
    label: 'RHSA-2024:2560'
  - url: 'https://access.redhat.com/errata/RHSA-2024:3253'
    label: 'RHSA-2024:3253'
  - url: 'https://access.redhat.com/security/cve/CVE-2024-2494'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2270115'
    label: RHBZ#2270115
  - url: >-
      https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/BKRQXPLPC6B7FLHJXSBQYW7HNDEBW6RJ/
tags:
  - cve.org
epss: 0.00367
epssPercentile: 0.30723
ingestedAt: '2026-11-05T21:36:00.834Z'
---

## Overview

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.

## Affected

- `libvirt >= 9.0.0 < 9.7.0`
- `virt-devel:rhel (all versions)`
- `virt:rhel (all versions)`
- `libvirt (all versions)`
- `libvirt`
- `libvirt`
- `virt:av/libvirt (all versions)`

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.

### Workarounds

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
