Expr has Denial of Service via Unbounded Recursion in Builtin FunctionsGHSA-cfpf-hrx2-8rv6
HIGHFix: expr-lang/expr#870GHSA-cfpf-hrx2-8rv6 is a high-severity (CVSS 7.5) CWE-770 vulnerability in github.com/expr-lang/expr. A fix is available for github.com/expr-lang/expr — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-cfpf-hrx2-8rv6.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
github.com/expr-lang/exprReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Expr is an expression language and expression evaluation for Go. Prior to version 1.17.7, several builtin functions in Expr, including flatten, min, max, mean, and median, perform recursive traversal over user-provided data structures without enforcing a maximum recursion depth. If the evaluation environment contains deeply nested or cyclic data structures, these functions may recurse indefinitely until exceed the Go runtime stack limit. This results in a stack overflow panic, causing the host application to crash. While exploitability depends on whether an attacker can influence or inject cyclic or pathologically deep data into the
evaluation environment, this behavior represents a denial-of-service (DoS) risk and affects overall library robustness. Instead of returning a recoverable evaluation error, the process may terminate unexpectedly. In affected versions, evaluation of expressions that invoke certain builtin functions on untrusted or insufficiently validated data structures can lead to a process-level crash due to stack exhaustion. This issue is most relevant in scenarios where Expr is used to evaluate expressions against externally supplied or dynamically constructed environments; cyclic references (directly or indirectly) can be introduced into arrays, maps, or structs; and there are no application-level safeguards preventing deeply nested input data. In typical use cases with controlled, acyclic data, the issue may not manifest. However, when present, the resulting panic can be used to reliably crash the application, constituting a denial of service. The issue has been fixed in the v1.17.7 versions of Expr. The patch introduces a maximum recursion depth limit for affected builtin functions. When this limit is exceeded, evaluation aborts gracefully and returns a descriptive error instead of panicking. Additionally, the maximum depth can be customized by users via builtin.MaxDepth, allowing applications with legitimate deep structures to raise the limit in a controlled manner. Users are strongly encouraged to upgrade to the patched release, which includes both the recursion guard and comprehensive test coverage to prevent regressions. For users who cannot immediately upgrade, some mitigations are recommended. Ensure that evaluation environments cannot contain cyclic references, validate or sanitize externally supplied data structures before passing them to Expr, and/or wrap expression evaluation with panic recovery to prevent a full process crash (as a last-resort defensive measure). These workarounds reduce risk but do not fully eliminate the issue without the patch.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/expr-lang/expr | all versions | 1.17.7go get github.com/expr-lang/expr@v1.17.7 |
Affected Products
exprexpr-langDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/expr-lang/expr, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/expr-lang/expr to 1.17.7 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-cfpf-hrx2-8rv6 is resolved across your whole dependency graph.
Workarounds
Constrain what reaches the vulnerable code: limit the size and shape of untrusted input, isolate the affected component in a sandboxed or least-privileged process, and enable the platform's memory-safety mitigations (ASLR, stack protector, hardened allocator) so an out-of-bounds access is more likely to fail closed than to be exploitable.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is rated Important for Red Hat products utilizing the `Expr` Go library because it can lead to a denial-of-service. Exploitation requires an application to evaluate expressions against untrusted or insufficiently validated data structures containing deeply nested or cyclic references, which can…
To mitigate this issue, applications using the `Expr` library should ensure that evaluation environments do not contain cyclic references. Additionally, externally supplied data structures must be validated or sanitized before being passed to `Expr` for evaluation. As a last-resort defensive measure, expression evaluation can be wrapped with panic recovery to prevent a full process crash.Source: Red Hat security advisory for GHSA-cfpf-hrx2-8rv6 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 10 | opentelemetry-collector-0:0.135.0-2.el10_1 | RHSA-2025:23664 |
| Red Hat Enterprise Linux 10.0 Extended Update Support | opentelemetry-collector-0:0.135.0-2.el10_0 | RHSA-2026:0514 |
| Red Hat Enterprise Linux 9 | opentelemetry-collector-0:0.135.0-2.el9_7 | RHSA-2025:23729 |
| Red Hat Enterprise Linux 9.4 Extended Update Support | opentelemetry-collector-0:0.135.0-2.el9_4 | RHSA-2026:0512 |
| Red Hat Enterprise Linux 9.6 Extended Update Support | opentelemetry-collector-0:0.135.0-2.el9_6 | RHSA-2026:0513 |
| Custom Metric Autoscaler operator for Red Hat Openshift 2.18 | custom-metrics-autoscaler/custom-metrics-autoscaler-adapter-rhel9:1770072436 | RHSA-2026:2368 |
| Red Hat Advanced Cluster Management for Kubernetes 2.14 | rhacm2/acm-grafana-rhel9:1770632254 | RHSA-2026:2572 |
| Red Hat Ceph Storage 8.1 | rhceph/grafana-rhel9:1777566546 | RHSA-2026:15979 |
Frequently Asked Questions
Is GHSA-cfpf-hrx2-8rv6 in your dependencies?
Find it across Go, including transitive dependencies.