HSEC-2026-0011: Superlinear encoding of numbers with large coefficients
Published 2026-11-03 · Updated 2026-11-03
Summary
The scientific package suffers from a superlinear time complexity flaw when encoding numbers with very large coefficients due to inefficient repeated division. Applications that decode untrusted numbers and re-encode them, such as API gateways and JSON proxies using aeson, are at risk of denial of service.
Who is affected
Applications using affected versions of the scientific package can experience severe performance degradation or denial of service when processing numbers with large coefficients. For example, a number with one million digits previously took about a minute to encode. The conditions required are processing untrusted input containing numbers with massive coefficients that trigger the quadratic digit-extraction code path.
Exploitability
The CVSS vector, base score, and EPSS are not provided in the vulnerability record. CISA Known Exploited Vulnerabilities status is no, meaning active exploitation in the wild is not documented.
Remediation
- Upgrade the scientific package directly to version 0.3.10.0 or later to fix the issue and avoid a subsequent regression introduced in version 0.3.9.0.
How to check your project
- Check project dependency files (such as cabal files or stack.yaml) for usage of the scientific package prior to version 0.3.9.0.
Automated analysis of the published advisory data, generated 2026-11-20. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| Hackage | scientific |
>= 0, < 0.3.9.0 | 0.3.9.0 | - |
FAQ
What causes the superlinear encoding vulnerability?
The flaw is caused by decimal digits being extracted through repeated division of the entire coefficient by 10 once per digit, resulting in quadratic time complexity relative to the number of digits.
Which libraries and tools are indirectly affected?
The Show instance, Data.Text.Lazy.Builder.Scientific, Data.ByteString.Builder.Scientific, and applications like aeson that rely on this code path are affected.
Should I upgrade to version 0.3.9.0?
No, you should upgrade directly to version 0.3.10.0 or later because version 0.3.9.0 introduced its own regression.
Original advisory description
References
- REPORT https://github.com/basvandijk/scientific/pull/109
- FIX https://github.com/basvandijk/scientific/pull/116
- FIX https://github.com/basvandijk/scientific/pull/117
- DISCUSSION https://www.reddit.com/r/haskell/comments/1xbj59g/dont_use_scientific_for_calculations_it_can/
Source records: HSEC-2026-0011 (OSV.dev).