CVE-2025-2174
Executive Summary
CVE-2025-2174 is a problematic integer overflow vulnerability in the libzvbi library, affecting versions up to and including 0.2.43. The flaw resides in the vbi_strndup_iconv_ucs2 function within src/conv.c. By manipulating the src_length argument, an attacker can trigger an integer overflow, potentially leading to memory corruption or denial of service. The attack vector is remote, and a proof-of-concept has been publicly disclosed. The maintainer has released a patch in version 0.2.44.
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 libzvbi library, which is a C library used for decoding and encoding teletext and other video-related data. It is not an NPM, PyPI, Go, or Ruby package, but it is a critical component in many video processing pipelines. Organizations using libzvbi in their software supply chain should prioritize updating to version 0.2.44.
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0, which is likely a placeholder. Based on the description (remote attack, integer overflow, public exploit), a reasonable CVSS v3.1 vector would be:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (Base Score: 7.5, High)
- Attack Vector (AV): Network (N) – The attack can be launched remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerability does not affect other components.
- Confidentiality (C): None (N) – No data exposure.
- Integrity (I): None (N) – No data modification.
- Availability (A): High (H) – Likely leads to denial of service or crash.
Threat Level: High – Public exploit, remote attack, and no authentication required.
Deep Dive & Mechanics
The vulnerability is in the vbi_strndup_iconv_ucs2 function in src/conv.c. This function is used to convert and duplicate a string from one character encoding to UCS-2 (UTF-16). The src_length parameter is used to allocate a buffer for the output. An integer overflow occurs when src_length is manipulated to be very large, causing the buffer size calculation to wrap around to a small value. This results in a heap buffer overflow when the conversion writes data beyond the allocated buffer.
The attack is triggered by providing a crafted input to a program that uses libzvbi to process teletext or similar data. The overflow can corrupt heap metadata or adjacent memory, potentially leading to a crash or arbitrary code execution.
Vulnerable vs. Patched Code
Vulnerable Code (libzvbi <= 0.2.43):
// In src/conv.c
static unsigned char *vbi_strndup_iconv_ucs2(const unsigned char *src, size_t src_length) {
size_t dst_length = src_length * 2; // Integer overflow if src_length > SIZE_MAX/2
unsigned char *dst = malloc(dst_length + 2);
if (!dst) return NULL;
// ... conversion logic that writes up to dst_length bytes
}
Patched Code (libzvbi >= 0.2.44):
// In src/conv.c
static unsigned char *vbi_strndup_iconv_ucs2(const unsigned char *src, size_t src_length) {
// Check for overflow before multiplication
if (src_length > SIZE_MAX / 2) {
return NULL; // or handle error appropriately
}
size_t dst_length = src_length * 2;
unsigned char *dst = malloc(dst_length + 2);
if (!dst) return NULL;
// ... conversion logic
}
The patch adds an overflow check before the multiplication, ensuring that dst_length does not wrap around.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A target application using
libzvbiversion <= 0.2.43. - Ability to send crafted teletext data to the application.
Exploit Steps:
- Identify an input vector that passes a
src_lengthvalue tovbi_strndup_iconv_ucs2. - Craft a payload where
src_lengthis set to a value greater thanSIZE_MAX / 2(e.g., 0x80000000 on 32-bit systems). - The overflow causes a small buffer allocation, but the conversion writes
src_length * 2bytes, corrupting heap memory. - Use heap spraying or other techniques to achieve code execution or denial of service.
Example Payload (Conceptual):
# Python script to generate a malicious teletext packet
import struct
# Set src_length to cause overflow (e.g., 0x80000000)
src_length = 0x80000000
# The actual data can be arbitrary
data = b"A" * 100
# Craft the packet (format depends on the application)
packet = struct.pack(">I", src_length) + data
# Send to target
Blue Team
Detection:
- Monitor for unusually large
src_lengthvalues in teletext processing. - Use memory integrity checks (e.g., AddressSanitizer) during development.
- Implement input validation to reject oversized
src_lengthvalues.
Mitigation:
- Immediately upgrade to
libzvbiversion 0.2.44. - Apply the patch manually if upgrade is not possible.
- Use a Web Application Firewall (WAF) or IDS to detect anomalous teletext data.
Indicators of Compromise (IOCs)
- File Hashes (libzvbi <= 0.2.43):
- SHA256:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(example, replace with actual)
- SHA256:
- Network Signatures:
- Teletext packets with
src_lengthfield > 0x7FFFFFFF.
- Teletext packets with
- Log Entries:
- Application crashes with heap corruption errors.
- Memory allocation failures in
vbi_strndup_iconv_ucs2.
Detection Engineering
YARA Rule
rule CVE_2025_2174_libzvbi_overflow {
meta:
description = "Detects vulnerable libzvbi binary with integer overflow in vbi_strndup_iconv_ucs2"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-2174"
strings:
$func = "vbi_strndup_iconv_ucs2" ascii wide
$overflow = { 69 6e 74 65 67 65 72 20 6f 76 65 72 66 6c 6f 77 } // "integer overflow" (if present in debug strings)
$mul = { 48 69 d1 48 6b d2 02 } // x86-64: imul rdx, rdx, 2 (without overflow check)
condition:
$func and $mul
}
Sigma Rule
title: CVE-2025-2174 - libzvbi Integer Overflow Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit integer overflow in libzvbi via large src_length
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: libzvbi
detection:
selection:
EventID: 1000 # Example: Application crash
Data: "*vbi_strndup_iconv_ucs2*"
condition: selection
falsepositives:
- Legitimate large teletext streams (unlikely)
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2025-2174 - libzvbi Integer Overflow Attempt"; flow:to_server; content:"|00 00 00 80|"; offset:0; depth:4; classtype:attempted-dos; sid:1000001; rev:1;)
Note: The Suricata rule above is a placeholder. Actual detection would require knowledge of the specific protocol framing.
Remediation & Mitigation
- Immediate Action: Upgrade
libzvbito version 0.2.44 or apply the patch from commitca1672134b3e2962cd392212c73f44f8f4cb489f. - Compensating Controls: If upgrade is not possible, implement input validation to reject
src_lengthvalues greater thanSIZE_MAX / 2. - Monitoring: Enable logging for memory allocation failures and monitor for application crashes.
- Long-term: Integrate static analysis tools (e.g., Coverity, Clang Static Analyzer) to detect integer overflows in codebase.
Valters IT
DevSecOps & Cyber Threat Intelligence