# HSEC-2026-0007: Denial of Service and Memory Exhaustion in aeson

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-05-22T07:02:58.000Z
- Modified: 2026-09-16T23:00:03.475Z

## Description

# Denial of Service and Memory Exhaustion in aeson

A 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.

The 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 > 1024`) but fails to reject arbitrarily large negative exponents.

When 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.

Affected `FromJSON` instances:

* `Fixed a` (including `Centi`, `Pico`, `Nano`, etc.)
* `NominalDiffTime`
* `DiffTime`

## Resolution

The issue was resolved by introducing proper bounds checks:

- `aeson` now applies an absolute bounds check to both positive and negative exponents (`abs exp10 > 1024`).

The fix first shipped in `aeson-2.3.0.0`, and have been backported to the previous release series as `aeson-2.2.5.1`.

Users are strongly advised to update to the patched versions:

* `aeson-2.2.5.1` or later

## Acknowledgements

The vulnerabilities were reported Nathan Walsh, and patched by Li-yao Xia.

(As written by Haskell Security Advisories.)

## Affected

- aeson (Hackage): from 0.12.0.0 before 2.2.5.1
- text-iso8601 (Hackage): from 0.1 before 0.1.1.2

## References

- <https://github.com/haskell/aeson/commit/42775f45ff8dad934d44617f6f38ee874e1c9df1> (fix)
- <https://github.com/haskell/aeson/commit/b6fb54b11ebf3e499685c4eeb2714ead522252cc> (fix)

## Sources

- Haskell Security Advisories: [HSEC-2026-0007](https://osv.dev/vulnerability/HSEC-2026-0007), CC0-1.0, modified 2026-09-16

---

Page: https://cve.day/HSEC-2026-0007 · Whole record: https://cve.day/HSEC-2026-0007.json · Rebuilt by cve.day 2026-11-25T22:56:25.653Z
