{"id":"HSEC-2026-0007","aliases":[],"status":"published","title":"Denial of Service and Memory Exhaustion in aeson","description":"# Denial of Service and Memory Exhaustion in aeson\n\nA Denial of Service (DoS) and memory exhaustion vulnerability was identified in the `aeson` package. The vulnerability allows an attacker to exhaust server memory and crash the host process by supplying maliciously crafted JSON payloads.\n\nThe vulnerability exists in `aeson`'s `withBoundedScientific_` function (located in `src/Data/Aeson/Types/FromJSON.hs`). The exponent bounds check only rejects large positive exponents (`exp10 \u003e 1024`) but fails to reject arbitrarily large negative exponents.\n\nWhen an attacker sends a JSON number with a massive negative exponent (e.g., `1e-999999999`), the value bypasses the check and flows into `realToFrac`, which computes `fromRational . toRational`. For such a large negative exponent, `toRational` produces a GMP Integer with approximately 1 billion decimal digits, causing immediate and severe memory exhaustion.\n\nAffected `FromJSON` instances:\n\n* `Fixed a` (including `Centi`, `Pico`, `Nano`, etc.)\n* `NominalDiffTime`\n* `DiffTime`\n\n## Resolution\n\nThe issue was resolved by introducing proper bounds checks:\n\n- `aeson` now applies an absolute bounds check to both positive and negative exponents (`abs exp10 \u003e 1024`).\n\nThe fix first shipped in `aeson-2.3.0.0`, and have been backported to the previous release series as `aeson-2.2.5.1`.\n\nUsers are strongly advised to update to the patched versions:\n\n* `aeson-2.2.5.1` or later\n\n## Acknowledgements\n\nThe vulnerabilities were reported Nathan Walsh, and patched by Li-yao Xia.","facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"published":"2026-05-22T07:02:58Z","modified":"2026-09-16T23:00:03Z","fixes":[{"ecosystem":"Hackage","package":"aeson","fixed_in":["2.2.5.1"],"sources":["osv"]},{"ecosystem":"Hackage","package":"text-iso8601","fixed_in":["0.1.1.2"],"sources":["osv"]}],"affected":[{"source":"osv","ecosystem":"Hackage","package":"aeson","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.12.0.0"},{"fixed":"2.2.5.1"}]}],"versions":["1.0.0.0","1.0.1.0","1.0.2.0","1.0.2.1","1.1.0.0","1.1.1.0","1.1.2.0","1.2.0.0","1.2.1.0","1.2.2.0","1.2.3.0","1.2.4.0","1.3.0.0","1.3.1.0","1.3.1.1","1.4.0.0","1.4.1.0","1.4.2.0","1.4.3.0","1.4.4.0","1.4.5.0","1.4.6.0","1.4.7.0","1.4.7.1","1.5.0.0","1.5.1.0","1.5.2.0","1.5.3.0","1.5.4.0","1.5.4.1","1.5.5.0","1.5.5.1","1.5.6.0","2.0.0.0","2.0.1.0","2.0.2.0","2.0.3.0","2.1.0.0","2.1.1.0","2.1.2.0","2.1.2.1","2.2.0.0","2.2.1.0","2.2.2.0","2.2.3.0","2.2.4.0","2.2.4.1","2.2.5.0"]},{"source":"osv","ecosystem":"Hackage","package":"text-iso8601","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.1"},{"fixed":"0.1.1.2"}]}],"versions":["0.1","0.1.1","0.1.1.1"]}],"references":[{"url":"https://github.com/haskell/aeson/commit/42775f45ff8dad934d44617f6f38ee874e1c9df1","tags":["fix"]},{"url":"https://github.com/haskell/aeson/commit/b6fb54b11ebf3e499685c4eeb2714ead522252cc","tags":["fix"]}],"sources":{"osv":[{"id":"HSEC-2026-0007","title":"Denial of Service and Memory Exhaustion in aeson","description":"# Denial of Service and Memory Exhaustion in aeson\n\nA Denial of Service (DoS) and memory exhaustion vulnerability was identified in the `aeson` package. The vulnerability allows an attacker to exhaust server memory and crash the host process by supplying maliciously crafted JSON payloads.\n\nThe vulnerability exists in `aeson`'s `withBoundedScientific_` function (located in `src/Data/Aeson/Types/FromJSON.hs`). The exponent bounds check only rejects large positive exponents (`exp10 \u003e 1024`) but fails to reject arbitrarily large negative exponents.\n\nWhen an attacker sends a JSON number with a massive negative exponent (e.g., `1e-999999999`), the value bypasses the check and flows into `realToFrac`, which computes `fromRational . toRational`. For such a large negative exponent, `toRational` produces a GMP Integer with approximately 1 billion decimal digits, causing immediate and severe memory exhaustion.\n\nAffected `FromJSON` instances:\n\n* `Fixed a` (including `Centi`, `Pico`, `Nano`, etc.)\n* `NominalDiffTime`\n* `DiffTime`\n\n## Resolution\n\nThe issue was resolved by introducing proper bounds checks:\n\n- `aeson` now applies an absolute bounds check to both positive and negative exponents (`abs exp10 \u003e 1024`).\n\nThe fix first shipped in `aeson-2.3.0.0`, and have been backported to the previous release series as `aeson-2.2.5.1`.\n\nUsers are strongly advised to update to the patched versions:\n\n* `aeson-2.2.5.1` or later\n\n## Acknowledgements\n\nThe vulnerabilities were reported Nathan Walsh, and patched by Li-yao Xia.\n","status":"published","published":"2026-05-22T07:02:58Z","modified":"2026-09-16T23:00:03.475634854Z","updated_at":"2026-11-02T15:47:17.805107Z"}]}}
