json is vulnerable to Use After Free
45
CVE Score
Medium
Use After Free
JSON::ResumableParser#parse clears the consumed input buffer at end-of-stream but leaves state.start, state.cursor, and state.end pointing into the released storage. When an application later calls partial_value on an incomplete object that contains duplicate keys, the duplicate-key warning path invokes cursor_position, which walks those stale pointers and reads freed memory. An attacker who can feed a crafted truncated JSON stream to a resumable parser and trigger partial_value can crash the Ruby process via this heap use-after-free. The fix resets the parser-state pointers when the buffer is cleared and skips cursor-based line/column computation on the resumable warning path.
Upgrade the json library to the patch version.
You are affected if you are using a version that falls within the vulnerable range and your application uses JSON::ResumableParser with partial_value on untrusted streaming JSON input.
2.20.0 - 2.21.1
Fixed in 2.21.2json is vulnerable to Use After Free in versions 2.20.0 - 2.21.1.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.