GHSA-6gcq-wc29-5xf2: Coraza WAF: stack overflow DoS via JSON body

GHSA-6gcq-wc29-5xf2HIGH
Published October 8, 2026
CISO Take

Coraza, a widely used Go web application firewall, can be crashed by a single unauthenticated HTTP request. A JSON body with about 1,000 shallow values followed by millions of nested brackets slips past the recursion guard and triggers an unrecoverable stack overflow in the gjson validator. The process terminates and every in-flight transaction is lost. Severity is high (CVSS 7.5, availability only). No public exploit tooling, Nuclei template or KEV listing exists yet, and EPSS is not available, but the advisory includes a working PoC and the attack needs no authentication, so weaponization is trivial. With 6,147 downstream dependents and 56 other CVEs in the same package, the blast radius is wide for any AI gateway or LLM API fronted by Coraza. Upgrade to github.com/corazawaf/coraza/v3 3.8.1 (any version from 3.0.0 up to 3.8.0 is affected), and until then limit JSON request body size or run the WAF behind an auto-restarting supervisor with redundancy.

Sources:GitHub AdvisoryNVD

What is the risk?

High. Exploitation is network-reachable, unauthenticated and low complexity, and the PoC is public in the advisory. The impact is availability only (process crash, no confidentiality or integrity effect). Because it is a fatal stack overflow rather than a panic, no recover() can contain it. Risk is highest for internet-facing AI inference gateways and LLM API front doors that use Coraza as an embedded WAF with the default JSON body processor, which is enabled for application/json. Exposure is also high for the response-body path, since ProcessResponse shares readJSON. No in-the-wild exploitation is known: it is not in KEV, and EPSS and SSVC data are unavailable.

How does the attack unfold?

Initial Access
Attacker sends an unauthenticated JSON request to an AI API endpoint protected by Coraza.
AML.T0049
Guard Bypass
About 1,000 shallow values hit the argument limit so readItems stops early and skips the recursion-depth error.
Exploitation
gjson.Valid recurses over millions of nested brackets without a depth bound and triggers a fatal stack overflow.
Impact
The WAF process terminates, dropping in-flight transactions and taking the protected AI service offline until restart.
AML.T0029

What systems are affected?

PackageEcosystemVulnerable RangePatched
Anthropic Pythongo>= 3.0.0, < 3.8.13.8.1
4.0K5.4K dependentsPushed 8d ago93% patched~9d to patchFull package profile →

Do you use Anthropic Python? You're affected.

How severe is it?

CVSS 3.1
7.5 / 10
EPSS
N/A
Exploitation Status
No known exploitation
Sophistication
Trivial

What is the attack surface?

AVACPRUISCIA
AVNetwork
ACLow
PRNone
UINone
SUnchanged
CNone
INone
AHigh

What should I do?

1 step
  1. 1) Upgrade github.com/corazawaf/coraza/v3 to 3.8.1 or later and rebuild and redeploy every binary that embeds it (Go dependencies are statically linked, so check Caddy/Traefik plugin builds and container images). 2) Until patched, reject or cap JSON bodies at the edge, for example with a reverse proxy or load balancer limit well below SecRequestBodyLimit, and consider reducing SecRequestBodyLimit. 3) Add an upstream check that rejects JSON with extreme bracket nesting before it reaches Coraza. 4) Run the WAF process under a supervisor with fast automatic restart and multiple replicas so a single request cannot cause a full outage. 5) Detect: alert on repeated process exits with 'fatal error: stack overflow' and gjson.validarray in logs, and on unusually large JSON POST bodies from single sources. 6) Use SBOM or go version -m scanning to find affected builds.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Art. 15-Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.6-AI system operation and monitoring
NIST AI RMF
MANAGE 2.3-Procedures to respond to and recover from unknown risks
OWASP LLM Top 10
LLM10-Unbounded Consumption

Frequently Asked Questions

What is GHSA-6gcq-wc29-5xf2?

Coraza, a widely used Go web application firewall, can be crashed by a single unauthenticated HTTP request. A JSON body with about 1,000 shallow values followed by millions of nested brackets slips past the recursion guard and triggers an unrecoverable stack overflow in the gjson validator. The process terminates and every in-flight transaction is lost. Severity is high (CVSS 7.5, availability only). No public exploit tooling, Nuclei template or KEV listing exists yet, and EPSS is not available, but the advisory includes a working PoC and the attack needs no authentication, so weaponization is trivial. With 6,147 downstream dependents and 56 other CVEs in the same package, the blast radius is wide for any AI gateway or LLM API fronted by Coraza. Upgrade to github.com/corazawaf/coraza/v3 3.8.1 (any version from 3.0.0 up to 3.8.0 is affected), and until then limit JSON request body size or run the WAF behind an auto-restarting supervisor with redundancy.

Is GHSA-6gcq-wc29-5xf2 actively exploited?

No confirmed active exploitation of GHSA-6gcq-wc29-5xf2 has been reported, but organizations should still patch proactively.

How to fix GHSA-6gcq-wc29-5xf2?

1) Upgrade github.com/corazawaf/coraza/v3 to 3.8.1 or later and rebuild and redeploy every binary that embeds it (Go dependencies are statically linked, so check Caddy/Traefik plugin builds and container images). 2) Until patched, reject or cap JSON bodies at the edge, for example with a reverse proxy or load balancer limit well below SecRequestBodyLimit, and consider reducing SecRequestBodyLimit. 3) Add an upstream check that rejects JSON with extreme bracket nesting before it reaches Coraza. 4) Run the WAF process under a supervisor with fast automatic restart and multiple replicas so a single request cannot cause a full outage. 5) Detect: alert on repeated process exits with 'fatal error: stack overflow' and gjson.validarray in logs, and on unusually large JSON POST bodies from single sources. 6) Use SBOM or go version -m scanning to find affected builds.

What systems are affected by GHSA-6gcq-wc29-5xf2?

This vulnerability affects the following AI/ML architecture patterns: LLM API gateways, Model serving endpoints, Agent tool backends, RAG service front ends, WAF-protected inference APIs.

What is the CVSS score for GHSA-6gcq-wc29-5xf2?

GHSA-6gcq-wc29-5xf2 has a CVSS v3.1 base score of 7.5 (HIGH).

What is the AI security impact?

Affected AI Architectures

LLM API gatewaysModel serving endpointsAgent tool backendsRAG service front endsWAF-protected inference APIs

MITRE ATLAS Techniques

AML.T0029Denial of AI Service
AML.T0049Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Art. 15
ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.3
OWASP LLM Top 10: LLM10

What are the technical details?

Original Advisory

### Summary The JSON body processor (`internal/bodyprocessors/json.go`) can be made to crash the whole process with an unrecoverable `fatal error: stack overflow`, using a request body that is well under the recommended `SecRequestBodyLimit` and the default `SecArgumentsLimit`. ### Root cause `readJSON` (json.go:113-143) runs a bounded, best-effort flattening walk (`readItems`) and *afterwards* calls `gjson.Valid(s)` on the raw body if `readItems` returned no error: ```go json := gjson.Parse(s) ... truncated, err = readItems(json, key, maxRecursion, argumentLimit, byteBudget, &usedBytes, &argCount, res) if err != nil { return res, truncated, err } if !gjson.Valid(s) { return res, truncated, errors.New("invalid JSON") } ``` `gjson.Valid` (gjson v1.18.0, `validany` -> `validarray`/`validobject`) recurses once per nesting level with **no depth bound**. `readItems` does have a depth bound (`maxRecursion`), enforced here (json.go:163-182): ```go func readItems(json gjson.Result, objKey []byte, maxRecursion int, argumentLimit int, byteBudget int, usedBytes *int, argCount *int, res map[string][]string) (truncated bool, err error) { if byteBudget > 0 && *usedBytes >= byteBudget { return true, nil // <-- checked first } if argumentLimit > 0 && *argCount >= argumentLimit { return true, nil // <-- checked second } ... if maxRecursion <= 0 { return false, errors.New("max recursion reached while reading json object") } ``` The byte-budget and argument-limit checks run *before* the recursion-depth check, and they short-circuit the walk with `truncated=true, err=nil` instead of recursing further. If the configured `SecArgumentsLimit` (`ArgumentLimit`, default 1000, `internal/corazawaf/waf.go:359`) is reached by earlier, shallow values in the document, `readItems` stops walking *before it ever reaches* a deeply nested tail later in the same document — so the `maxRecursion` error is never produced, `err` comes back `nil`, and `readJSON` falls through to the unconditional `gjson.Valid(s)` call on the complete raw body, including the part `readItems` never visited. This is not a new interaction with the recursion limit itself: at v3.7.0, `gjson.Valid` ran unconditionally before any recursion check at all, so a plain deeply-nested body crashed the process directly. A later fix added a depth check that returns an error before `Valid` runs for the *straightforward* case (nesting reached before any other guard fires). The argument-limit / byte-budget guards added since then (GHSA-6r3q-mjv7-xr8m, GHSA-3ww9-vw83-9w5x) reopened the same crash for the case above, because they short-circuit the walk (and therefore the recursion counter) ahead of the depth check, on both the request and response body path (`ProcessResponse` calls the same `readJSON`, json.go:57-88). Because this is `fatal error: stack overflow`, not a `panic`, it is **not** recoverable by any `recover()` in the calling goroutine — the process terminates unconditionally. ### PoC ```go package bodyprocessors import ( "strings" "testing" ) func TestStackOverflowRepro(t *testing.T) { body := "[" + strings.Repeat("1,", 1000) + strings.Repeat("[", 13_000_000) // 13,002,001 bytes total: under the recommended SecRequestBodyLimit // (13107200, coraza.conf-recommended:78) and default ArgumentLimit (1000, // internal/corazawaf/waf.go:359). _, _, _ = readJSON(body, 20, 1000) } ``` ``` $ go test -run TestStackOverflowRepro ./internal/bodyprocessors/ -v runtime: goroutine stack exceeds 1000000000-byte limit fatal error: stack overflow ... github.com/tidwall/gjson.validarray(...) .../gjson@v1.18.0/gjson.go:2584 github.com/tidwall/gjson.validany(...) .../gjson@v1.18.0/gjson.go:2499 github.com/tidwall/gjson.validarray(...) .../gjson@v1.18.0/gjson.go:2589 ... (repeats until the goroutine stack limit is hit) ``` Reproduced against commit `19b86824` (tag `v3.8.0`), both by calling `readJSON` directly and end-to-end through the recommended `coraza.conf-recommended` configuration (JSON `Content-Type`, default `SecArgumentsLimit`, recommended `SecRequestBodyLimit`). ### Impact An unauthenticated attacker who can send an HTTP request body (any endpoint protected by Coraza with the JSON body processor enabled, which is the default for `application/json`) can crash the entire host process with a single request, using a payload well within default and recommended body size and argument-count limits. There is no privilege or interaction requirement, and the crash cannot be caught or mitigated by the integrator (no `recover()` stops a stack-overflow fatal error). This is strictly worse than a CPU-exhaustion or slow-request DoS: the process must be restarted, and every in-flight request/transaction on that process is lost. ### Suggested fix Run an iterative, explicitly-bounded-depth pre-scan (or reuse `readItems`'s own recursion accounting) before calling `gjson.Valid`, and never call `gjson.Valid` on input whose nesting exceeds `maxRecursion`. The response path (`ProcessResponse`) needs the same treatment since it shares `readJSON`. ### AI involvement disclosure - **AI tools/models used:** Claude Sonnet 5 (Anthropic), via Claude Code. - **What was generated/assisted:** the initial vulnerability hypothesis and repro shape were supplied by the reporter as an existing written finding; Claude Sonnet 5 independently re-derived the root cause by reading the current source, wrote and ran a fresh PoC test against commit `19b86824` (tag `v3.8.0`), confirmed the crash and stack trace shown above, verified the default configuration values cited (`ArgumentLimit` default, `SecRequestBodyLimit` recommended value) against the current source, and drafted this advisory text. - **Review performed:** reproduced by hand by running the PoC test above with `go test -run TestStackOverflowRepro ./internal/bodyprocessors/ -v` against a clean checkout of commit `19b86824`; observed the `fatal error: stack overflow` and stack trace through `gjson.validarray`/`validany`; traced `readJSON`/`readItems` line by line to confirm the guard ordering described above; the PoC was reviewed by a human maintainer (fzipi) before submission of this advisory.

Exploitation Scenario

An attacker finds an LLM API gateway or model-serving endpoint protected by Coraza with the default configuration. They send one POST with Content-Type: application/json containing '[' followed by 1,000 entries of '1,' and then about 13 million '[' characters, which is under the recommended 13 MB body limit. The shallow values exhaust the argument limit, so the flattening walk stops before reaching the nested tail and never raises the recursion error. The raw body is then passed to gjson.Valid, which recurses without a depth bound until the Go runtime aborts with a fatal stack overflow. The WAF process dies, and the attacker repeats the request after each restart to keep the AI service unavailable.

Weaknesses (CWE)

CWE-674 — Uncontrolled Recursion: The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.

  • [Implementation] Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
  • [Implementation] Increase the stack size.

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Timeline

Published
October 8, 2026
Last Modified
October 8, 2026
First Seen
October 8, 2026

Related Vulnerabilities