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

> Attackers can crash servers via memory exhaustion by sending crafted JSON with large negative exponents to applications using the aeson library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 22 May 2026

## What is HSEC-2026-0007?

HSEC-2026-0007 is a denial of service vulnerability in aeson, published on 22 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

## Which versions are affected by HSEC-2026-0007?

2 open source packages ship an affected version, including aeson and text-iso8601.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `aeson` | Hackage | From 0.12.0.0 | 2.2.5.1 |
| `text-iso8601` | Hackage | From 0.1 | 0.1.1.2 |

## How do I fix HSEC-2026-0007?

Upgrade aeson to 2.2.5.1 or later.

## Is HSEC-2026-0007 being exploited?

There is no known exploitation of HSEC-2026-0007 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for HSEC-2026-0007 and fix it if it is affected.

What it is: HSEC-2026-0007 is a denial of service vulnerability in aeson, published on 22 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of HSEC-2026-0007 in the wild and no public exploit code.

Affected packages and fixed versions:
- aeson (Hackage): affected from 0.12.0.0; fixed in 2.2.5.1
- text-iso8601 (Hackage): affected from 0.1; fixed in 0.1.1.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/HSEC-2026-0007/ (Markdown: https://insights.sbomify.com/HSEC-2026-0007/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/HSEC-2026-0007

---
From sbomify Insights: https://insights.sbomify.com/HSEC-2026-0007/
Summaries are generated and may contain mistakes; the official description above is the record.
