# CVE-2026-55254: NCalc: Denial of Service via Unbounded and Non-Terminating Factorial Evaluation

> Attackers can cause denial of service in applications using NCalc by submitting crafted expressions that trigger excessive CPU consumption or infinite loops.

- **Severity:** Medium 4.8 (`CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Jul 2026
- **Updated:** 20 Jul 2026
- **Also known as:** GHSA-3w5p-95mh-gq75

## What is CVE-2026-55254?

CVE-2026-55254 is a medium-severity denial of service vulnerability in ncalc, published on 17 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

NCalc is a fast, lightweight expression evaluator for .NET. Prior to 6.1.1, the factorial operator implementation in src/NCalc.Core/Helpers/MathHelper.cs permits specially crafted expressions with extremely large factorial operands, causing excessive CPU consumption or a non-terminating loop due to integer overflow in the factorial calculation logic when applications evaluate untrusted expressions. This issue is fixed in version 6.1.1.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling), CWE-190 (Integer Overflow or Wraparound)

## Which versions are affected by CVE-2026-55254?

4 open source packages ship an affected version, including NCalc.Core and NCalcSync. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `NCalc.Core` | NuGet | All versions | 6.1.1 |
| `NCalc.Core` | NuGet | All versions | 6.1.1 |
| `NCalcSync` | NuGet | All versions | 6.1.1 |
| `NCalcSync` | NuGet | All versions | 6.1.1 |

Products: Ncalc Ncalc.

## How do I fix CVE-2026-55254?

Upgrade NCalc.Core to 6.1.1 or later.

## Is CVE-2026-55254 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-55254 and fix it if it is affected.

What it is: CVE-2026-55254 is a medium-severity denial of service vulnerability in ncalc, published on 17 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-55254 in the wild and no public exploit code.

Affected packages and fixed versions:
- NCalc.Core (NuGet): affected all versions; fixed in 6.1.1
- NCalc.Core (NuGet): affected all versions; fixed in 6.1.1
- NCalcSync (NuGet): affected all versions; fixed in 6.1.1
- NCalcSync (NuGet): affected all versions; fixed in 6.1.1

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/CVE-2026-55254/ (Markdown: https://insights.sbomify.com/CVE-2026-55254/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-55254
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-55254
- OSV: https://osv.dev/vulnerability/CVE-2026-55254

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