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!
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+)
If upgrading is not immediately possible:
These mitigations may reduce exposure but do not fully address the underlying vulnerability.
{
"github_reviewed": true,
"github_reviewed_at": "2026-06-18T13:05:37Z",
"nvd_published_at": null,
"severity": "MODERATE",
"cwe_ids": [
"CWE-190",
"CWE-770"
]
}