Memory Exhaustion Vulnerability in Numeric.readFloat

base Updated 02 Oct 2025

Summary

22/07/2023
N/A
No i
Unrated
Not published

HSEC-2023-0007: readFloat: memory exhaustion with large exponent. Affects base versions >= 3.0.3.1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The Numeric.readFloat function is a part of the base package in the Haskell ecosystem. It is used to convert a string representation of a number into a floating-point value. The function is defined for all types that are instances of the RealFrac type class. The RealFrac type class does not impose any bounds on the size of representable values, making it susceptible to memory exhaustion with large exponents. This vulnerability affects the base package starting from version 3.0.3.1. The toml-reader package, specifically version 0.1.0.0, also includes this vulnerable function.

Vulnerability Detail

The readFloat function in Numeric module can cause memory exhaustion when processing a number expressed in scientific notation with a very large exponent. This can lead to a denial of service (DoS) attack, as the function's time and memory consumption are linear in the size of the number. The vulnerability has been observed to cause significant slowdowns, with processing times increasing exponentially with the exponent size. The issue was detected in the toml-reader package version 0.1.0.0 and has been mitigated in version 0.2.0.0 by immediately returning Infinity when the exponent is too large to process.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If updating the code or package is not immediately feasible, a workaround for this vulnerability is to manually perform bounds checks on the exponent before calling the readFloat function. This can be done by parsing the exponent as an integer and comparing it to a predefined threshold. If the exponent exceeds the threshold, the function can return a default value or handle the case separately to avoid memory exhaustion.

Conclusion

The memory exhaustion vulnerability in Numeric.readFloat can lead to denial of service attacks by consuming excessive memory when processing large numbers with large exponents. It is important to update the code to use the read function or upgrade to a fixed version of the toml-reader package. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for base →

Share this vulnerability

FAQ

The vulnerability can be exploited to cause a denial of service (DoS) attack by consuming excessive memory and slowing down the processing of large numbers with large exponents.

The base package in the Haskell ecosystem is affected starting from version 3.0.3.1. The toml-reader package version 0.1.0.0 is also affected, but the vulnerability has been fixed in version 0.2.0.0.

To mitigate this vulnerability, it is recommended to use the read function instead of readFloat. The read function performs bounds checks on the exponent, preventing memory exhaustion. Alternatively, developers can upgrade to a version of the toml-reader package that includes the fix.

There are no known exploits for this vulnerability at the moment. However, the memory exhaustion caused by processing large numbers with large exponents can be leveraged for denial of service attacks.

Yes, the vulnerability has been fixed in version 0.2.0.0 of the toml-reader package. It is recommended to upgrade to this version or a later one to ensure the vulnerability is addressed.

Related vulnerabilities

Recent vulnerabilities recorded for base.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback