CVE-2024-57724
Executive Summary
CVE-2024-57724 is a denial-of-service vulnerability in lunasvg v3.0.0, a lightweight SVG rendering library. The flaw resides in the gray_record_cell component, causing a segmentation violation (crash) when processing a specially crafted SVG file. This can be exploited remotely by an attacker to crash applications that use lunasvg to render untrusted SVG content, leading to service disruption. No public exploit code 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
lunasvg is a C++ library used in various software projects for SVG rendering. The vulnerability affects the library itself, not a specific package manager ecosystem. However, any application that statically or dynamically links to lunasvg v3.0.0 is at risk. Users should monitor for updates from the vendor and consider input validation or sandboxing as mitigations.
CVSS Breakdown & Threat Level
The CVSS score is 0.0 (UNKNOWN) due to insufficient data. Based on the nature of the vulnerability (segmentation violation leading to denial of service), a reasonable estimated CVSS v3.1 vector would be:
- Attack Vector (AV): Network (AV:N) – SVG can be loaded from remote sources.
- Attack Complexity (AC): Low (AC:L) – No special conditions required.
- Privileges Required (PR): None (PR:N) – No authentication needed.
- User Interaction (UI): Required (UI:R) – User must open or process the SVG.
- Scope (S): Unchanged (S:U) – Affects only the vulnerable component.
- Confidentiality (C): None (C:N) – No data exposure.
- Integrity (I): None (I:N) – No data modification.
- Availability (A): High (A:H) – Service crash.
Estimated CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
Estimated Base Score: 6.5 (Medium)
Threat Level: Medium. Exploitation requires user interaction but can cause significant availability impact.
Deep Dive & Mechanics
The vulnerability is a NULL pointer dereference or similar memory corruption in the gray_record_cell function within lunasvg's rendering pipeline. This function is responsible for recording cells during the grayscale rendering process. When processing a malformed SVG, the function attempts to access memory through an invalid pointer, leading to a segmentation fault.
Root Cause: Insufficient validation of SVG element attributes or internal state before use in gray_record_cell. The exact trigger is unknown without a proof-of-concept, but it likely involves specific SVG elements (e.g., <path>, <polygon>) with malformed coordinates or attributes that cause the rendering engine to enter an unexpected state.
Attack Vector: An attacker crafts an SVG file that triggers the crash. The victim must open this SVG with an application using lunasvg v3.0.0 (e.g., a web browser, image viewer, or document processor).
Vulnerable vs. Patched Code
No patched version exists. The vulnerable code is in lunasvg v3.0.0. A hypothetical fix would involve adding null checks and bounds validation in gray_record_cell before dereferencing pointers.
Vulnerable Code (hypothetical):
void gray_record_cell(GrayCell* cell) {
// No null check
cell->x = cell->x + 1; // Potential crash if cell is NULL
}
Patched Code (hypothetical):
void gray_record_cell(GrayCell* cell) {
if (cell == NULL) {
return; // Or handle error
}
cell->x = cell->x + 1;
}
Exploitation & Lab Setup
Red Team
No public exploit code exists. To reproduce the crash, an attacker would need to fuzz lunasvg with malformed SVG files to identify the specific input that triggers the segmentation violation. A simple test can be performed using a crafted SVG:
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<path d="M0 0 L10 10" />
</svg>
If the crash is triggered, the application will terminate unexpectedly.
Blue Team
To test for the vulnerability in a controlled environment:
- Setup: Install lunasvg v3.0.0 and a test application (e.g.,
lunasvgCLI tool). - Craft SVG: Create a malformed SVG file (e.g., with invalid path data or missing attributes).
- Execute: Run the application with the crafted SVG.
- Monitor: Observe if the application crashes with a segmentation fault.
Detection: Monitor application logs for crash reports or segmentation faults. Use process monitoring tools to detect abnormal terminations.
Indicators of Compromise (IOCs)
- File Hashes: No specific hashes available.
- Network Indicators: No specific network indicators.
- Behavioral Indicators:
- Application crash logs containing "segmentation violation" or "SIGSEGV".
- Unexpected termination of processes using lunasvg.
- High rate of SVG file processing failures.
Detection Engineering
YARA Rule
rule CVE_2024_57724_lunasvg_crash {
meta:
description = "Detects SVG files that may trigger CVE-2024-57724 in lunasvg v3.0.0"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-57724"
strings:
$svg_header = "<svg"
$path_elem = "<path"
$polygon_elem = "<polygon"
$crash_trigger = /d="[^"]*[^a-zA-Z0-9 ]/ // Malformed path data
condition:
$svg_header and ($path_elem or $polygon_elem) and #crash_trigger > 0
}
Sigma Rule
title: CVE-2024-57724 - lunasvg Segmentation Violation
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects crashes in applications using lunasvg v3.0.0 due to CVE-2024-57724
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: windows
detection:
selection:
EventID: 4688
CommandLine|contains: 'lunasvg'
condition: selection
falsepositives:
- Legitimate SVG processing
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-57724 - Potential lunasvg SVG Crash"; flow:to_client,established; file_data; content:"<svg"; within:100; content:"<path"; within:200; pcre:"/d=\"[^\" ]*[^a-zA-Z0-9 ]/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Avoid processing untrusted SVG files with lunasvg v3.0.0. Use input validation to reject malformed SVGs.
- Short-term: Monitor the lunasvg repository for patches. Consider using a different SVG rendering library as a temporary workaround.
- Long-term: Apply vendor patch when available. Implement sandboxing for SVG processing to contain crashes.
Valters IT
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.