Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify application accepting NCalc expressions
-
DeliveryCraft expression with oversized factorial operand (e.g., 9223372036854775807!)
-
ExploitSubmit via exposed API or input field
-
ExecutionNCalc evaluator dispatches to unbounded CalculateFactorial loop
-
PersistInteger overflow causes non-termination
-
ImpactCPU exhaustion degrades or halts service
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer overflow checks
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The application must pass attacker-controlled or untrusted string input directly to NCalc's expression evaluator (e.g., Expression.Evaluate()) without pre-validating or sanitizing factorial operands. No authentication, session, or special privilege is required at the NCalc library level; exploitation is limited only by whatever access controls the consuming application imposes before calling the library. The factorial operator must be reachable - applications that restrict allowed operators or expression syntax through NCalc's built-in extension points are not exposed. Non-default configurations that sandbox or restrict the expression grammar would limit exploitability. The CVSS UI:R metric in the vendor vector implies some user interaction is required, though the advisory description does not identify a specific interaction step - this metric choice is unconfirmed and may reflect the need for an application user to trigger evaluation. |
| Impact | The vendor-assigned CVSS 4.8 (AV:A/AC:H/PR:N/UI:R) reflects a conservative scope: adjacent-network attack vector and user-interaction required imply constrained exploitation conditions, keeping the score in the medium range despite A:H. However, this assessment may understate real-world risk for applications that expose NCalc expression evaluation over the network to untrusted users - a common use case for formula engines, reporting tools, and configuration DSLs - where AV:N/AC:L/PR:N/UI:N would apply, potentially raising severity to High (7.5). The AC:H and UI:R metrics in the vendor vector are not clearly justified by the description or advisory; the triggering expressions are trivially simple (a single integer followed by '!'). No EPSS score was provided in the input data. No KEV listing exists, and no standalone POC repository is referenced; however, the GHSA advisory itself documents three working proof-of-concept expressions, making exploitation knowledge effectively public. Real-world impact is bounded by deployment context: applications that never pass untrusted input to NCalc are not exposed, while those that do - especially without request timeouts - face genuine service disruption risk. |
| Exploit ScenarioDerived | An attacker submits the expression '9223372036854775807!' through any application endpoint that passes user-controlled strings to NCalc for evaluation - for example, a reporting engine, spreadsheet formula API, or configuration DSL. NCalc's MathHelper.Factorial() dispatches the Int64.MaxValue operand to the unbounded calculation loop, which overflows and enters a non-terminating state, consuming 100% of a CPU core. If the application processes requests synchronously or with a large thread pool, repeated submissions can saturate all available threads and render the service unresponsive. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jun 18, 2026
Denial-of-service via unbounded factorial evaluation affects NCalc (NCalc.Core and NCalcSync NuGet packages) prior to v6.1.1, allowing remote attackers to exhaust CPU resources or trigger non-terminating computation loops by submitting expressions with extremely large factorial operands such as 9223372036854775807! (Int64.MaxValue). The root cause is CWE-190 integer overflow in MathHelper.cs's factorial calculation logic, which previously lacked bounds validation, allowing operands well beyond any representable result to be passed directly to the computation loop. No public exploit or CISA KEV listing has been identified at time of analysis, though the triggering expressions are trivially constructable and documented in the advisory itself.
RemediationAI
Upgrade NCalc.Core and NCalcSync to v6.1.1 or later, which contains the bounds-validation fix from PR #575 (https://github.com/ncalc/ncalc/pull/575). The fix introduces a hard cap of 170 on factorial operands, rejecting larger values with ArgumentOutOfRangeException before any computation occurs. If immediate upgrade is not feasible, three compensating controls are documented in the advisory: first, restrict expression evaluation exclusively to trusted, internal sources - this fully eliminates the attack surface but requires application-level input provenance controls. Second, add an expression pre-validation layer that detects and rejects factorial tokens (e.g., regex matching on large numeric literals followed by '!') before passing expressions to NCalc; this adds latency and maintenance burden and may reject legitimate large-but-safe operands if thresholds are set conservatively. Third, wrap all NCalc evaluation calls in execution time limits or CancellationToken-based timeouts (e.g., Task.Run with a 1-5 second timeout); this bounds the DoS window but does not prevent resource consumption from concurrent attacks, and introduces complexity around partial-evaluation cleanup. None of the workarounds fully address the root cause - patching to v6.1.1 is the only complete fix.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 3 packages in nuget, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
NCalc is a .NET mathematical expression evaluation library distributed as NuGet packages (pkg:nuget/ncalc.core and pkg:nuget/ncalcsync). The vulnerability resides in NCalc.Core/Helpers/MathHelper.cs within the Factorial() dispatch method, which prior to v6.1.1 passed all numeric types (int, long, float, double, decimal, BigInteger) directly to CalculateFactorial<T>() without bounds checking. CWE-190 (Integer Overflow or Wraparound) applies because computing 9223372036854775807! (Int64.MaxValue) overflows the loop counter or intermediate accumulator, causing the evaluation to enter a non-terminating or runaway computation state rather than returning a bounded error. The fix in PR #575 introduces a MaxFactorialInput constant capped at 170 (the largest integer whose factorial fits in a double) and a ValidateFactorialInput<T>() gate that rejects negative values, NaN, infinity, and any operand exceeding 170 before the computation begins. Tests were added to assert ArgumentOutOfRangeException for all formerly dangerous inputs.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Network vector and no-privilege access apply when NCalc evaluates untrusted input via an API; only availability is impacted - no confidentiality or integrity effect.
Primary rating from NVD.
CVSS VectorNVD
Lifecycle Timeline
1DescriptionNVD
Impact
A denial-of-service (DoS) vulnerability exists in the factorial operator implementation of NCalc. Specially crafted expressions containing extremely large factorial operands can trigger excessive CPU consumption or cause evaluation to enter a non-terminating loop due to integer overflow in the factorial calculation logic.
Applications that evaluate untrusted expressions using affected versions of NCalc may be vulnerable to resource exhaustion, potentially resulting in service disruption or application unresponsiveness.
This issue can be triggered with expressions such as:
99999999999999!
9223372036854775807!
1.5e16!Patches
The vulnerability has been fixed by adding bounds validation for factorial operands and rejecting unsupported values before evaluation.
Users should upgrade to the first release containing the fix from pull request #575. (v6.1.1+)
Workarounds
If upgrading is not immediately possible:
- Do not evaluate expressions originating from untrusted users.
- Validate or sanitize expressions before evaluation and reject factorial operations on large values.
- Implement execution time limits, request timeouts, or cancellation mechanisms around expression evaluation.
These mitigations may reduce exposure but do not fully address the underlying vulnerability.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
EUVD-2026-45304
GHSA-3w5p-95mh-gq75
NVD
CVE.org
EPSS
VulDB
Exploit-DB