CVE-2024-57722
Executive Summary
CVE-2024-57722 is a denial-of-service vulnerability in lunasvg v3.0.0, specifically within the plutovg_surface_create component. The bug is classified as an "allocation-size-too-big" issue, which can lead to excessive memory allocation, potentially causing application crashes or resource exhaustion. The vulnerability has a CVSS score of 0.0, indicating no official severity assessment, but the EPSS score of 0.0% suggests low exploitation likelihood. No public proof-of-concept or patch is currently available.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the lunasvg library, which is a C++ SVG rendering library. It is not distributed via NPM, PyPI, Go, or Ruby ecosystems, but it may be integrated into larger projects as a dependency. Users should monitor for updates from the official lunasvg repository.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (Not officially assigned)
- Attack Vector: Local (likely requires local access to trigger)
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: None
- Integrity Impact: None
- Availability Impact: High (due to potential crash or resource exhaustion)
- Threat Level: Low (based on EPSS score and lack of public exploits)
Deep Dive & Mechanics
The vulnerability resides in the plutovg_surface_create function, which is responsible for allocating memory for a surface object. The bug occurs when an excessively large size parameter is passed, causing the allocation to exceed the system's memory limits. This can lead to a crash (denial of service) or, in some cases, memory corruption if the allocation is partially successful.
The root cause is a lack of proper bounds checking on the size parameter before calling malloc or similar memory allocation functions. An attacker could craft a malicious SVG file that triggers this oversized allocation, causing the application to crash.
Vulnerable vs. Patched Code
Vulnerable Code (v3.0.0):
plutovg_surface_t* plutovg_surface_create(int width, int height) {
plutovg_surface_t* surface = malloc(sizeof(plutovg_surface_t));
if (!surface) return NULL;
surface->data = malloc(width * height * 4); // No overflow check
// ...
}
Patched Code (hypothetical):
plutovg_surface_t* plutovg_surface_create(int width, int height) {
if (width <= 0 || height <= 0) return NULL;
size_t size = (size_t)width * height * 4;
if (size / 4 != (size_t)width * height) return NULL; // Overflow check
plutovg_surface_t* surface = malloc(sizeof(plutovg_surface_t));
if (!surface) return NULL;
surface->data = malloc(size);
// ...
}
Exploitation & Lab Setup
Red Team
To exploit this vulnerability, an attacker would need to provide a malicious SVG file that triggers an oversized allocation. Since no public exploit exists, a proof-of-concept can be created by crafting an SVG with extremely large dimensions.
Example SVG payload:
<?xml version="1.0" encoding="UTF-8"?>
<svg width="999999999" height="999999999" xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" fill="red"/>
</svg>
Usage:
./lunasvg_application malicious.svg
Blue Team
To detect exploitation attempts, monitor for abnormal memory allocation patterns or crashes in applications using lunasvg. Implement input validation to reject SVG files with excessively large dimensions.
Detection command:
# Monitor for large allocation attempts
strace -e trace=mmap,brk -p $(pgrep lunasvg_app) 2>&1 | grep -E "SIGSEGV|ENOMEM"
Indicators of Compromise (IOCs)
- File Hashes: None available (no known malicious samples)
- Network Indicators: None (local vulnerability)
- System Indicators:
- Application crash logs with
plutovg_surface_createin the stack trace - High memory usage spikes in processes using lunasvg
- SVG files with dimensions exceeding 10000x10000 pixels
- Application crash logs with
Detection Engineering
YARA Rule
rule CVE_2024_57722_lunasvg_allocation {
meta:
description = "Detects SVG files with oversized dimensions targeting lunasvg"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-57722"
strings:
$svg_header = /<svg[^>]*width\s*=\s*["']\d{7,}["']/
$svg_height = /height\s*=\s*["']\d{7,}["']/
condition:
$svg_header and $svg_height
}
Sigma Rule
title: CVE-2024-57722 - lunasvg Allocation Size Too Big
id: 8a9b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects attempts to exploit allocation-size-too-bug in lunasvg
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/lunasvg_app'
CommandLine|contains: '.svg'
condition: selection
falsepositives:
- Legitimate large SVG files
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-57722 - lunasvg SVG oversized dimensions"; flow:to_server,established; content:"<svg"; nocase; pcre:"/width\s*=\s*["']\d{7,}["']/"; pcre:"/height\s*=\s*["']\d{7,}["']/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Apply input validation to reject SVG files with dimensions exceeding a reasonable limit (e.g., 10000x10000 pixels).
- Short-term: Monitor the lunasvg repository for patches and update to the latest version when available.
- Long-term: Implement proper bounds checking in all memory allocation functions within the codebase.
- Workaround: If source code is accessible, add overflow checks as shown in the patched code example.
Valters IT Senior DevSecOps & Cyber Threat Intelligence Expert
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.