Skip to main content
Vulnerability Database/CVE-2026-107826

CVE-2026-107826: OWASP Coraza WAF Buffer Overflow Vulnerability

CVE-2026-107826 is a buffer overflow flaw in OWASP Coraza WAF that allows attackers to crash the hosting process via deeply nested JSON payloads. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107826 Overview

OWASP Coraza is a Golang web application firewall (WAF) library compatible with ModSecurity rulesets. CVE-2026-107826 affects versions 3.0.0 through 3.8.0 and allows an unauthenticated attacker to crash the hosting process with a crafted JSON body. The flaw lives in readJSON inside internal/bodyprocessors/json.go, which calls gjson.Valid on raw request bodies without a depth bound. A payload containing shallow leading values followed by a deeply nested tail bypasses the bounded flattening walk and triggers an unrecoverable fatal stack overflow in gjson. Both ProcessRequest and ProcessResponse JSON paths are affected. The issue is fixed in version 3.8.1.

Critical Impact

An unauthenticated remote attacker can terminate any process embedding Coraza by sending a single JSON payload that stays within recommended body-size and argument-count limits.

Affected Products

  • OWASP Coraza WAF 3.0.0 through 3.8.0
  • Applications and proxies embedding the coraza Go library (including Caddy and Traefik integrations)
  • Services exposing ProcessRequest or ProcessResponse with the JSON body processor enabled

Discovery Timeline

  • 2026-10-09 - CVE-2026-107826 published to the National Vulnerability Database (NVD)
  • 2026-10-16 - Last updated in NVD database

Technical Details for CVE-2026-107826

Vulnerability Analysis

The vulnerability is an uncontrolled recursion flaw [CWE-674] in Coraza's JSON body processor. The processor performs two passes over an incoming JSON body. The first pass is readItems, a bounded flattening walk that enforces SecArgumentsLimit and a byte budget. When either limit trips, the walk sets truncated=true and returns without descending into the remaining input. The second pass unconditionally calls gjson.Valid on the entire raw body to validate syntax before the request proceeds.

gjson version 1.18.0 validates arrays and objects through mutual recursion in validany, validarray, and validobject with no depth cap. An attacker who prefixes a JSON document with enough shallow key-value pairs to exhaust SecArgumentsLimit or the byte budget can then append a deeply nested tail that readItems never visits. gjson.Valid then recurses once per nesting level on the tail and overruns the goroutine stack. The runtime cannot recover from a stack overflow in Go, so the entire hosting process terminates.

Root Cause

The readJSON function treated the bounded walk's internal maxRecursion guard as sufficient protection against deep nesting. That guard only fires when readItems actually descends into nested containers. Truncation short-circuits the descent, so the guard is skipped for the untouched tail. Validation then happens outside any depth-bounded context.

Attack Vector

The attack requires only network access to any endpoint protected by a vulnerable Coraza deployment that enables the JSON body processor. The request can comply with recommended body-size and argument-count limits, so standard rate-limit and size-based mitigations do not block it. The payload shape is a shallow prefix followed by thousands of nested [ or { characters.

go
 	if err != nil {
 		return res, truncated, err
 	}
+	// readItems's own recursion guard never fires when argumentLimit or
+	// byteBudget truncates the walk before it reaches a deeply nested tail:
+	// the ForEach loop stops (truncated=true, err=nil) without ever
+	// recursing into that tail, so maxRecursion is never checked against it.
+	// gjson.Valid recurses with no depth bound at all (validany ->
+	// validarray/validobject in gjson v1.18.0), so calling it unconditionally
+	// on such a tail crashes the process with an unrecoverable
+	// "fatal error: stack overflow" -- see GHSA-6gcq-wc29-5xf2. This iterative
+	// check bounds that recursion before Valid ever runs.
+	if jsonNestingExceedsLimit(s, maxRecursion) {
+		return res, truncated, errors.New("max recursion reached while reading json object")
+	}
 	if !gjson.Valid(s) {
 		return res, truncated, errors.New("invalid JSON")
 	}
 	return res, truncated, nil
 }

+// jsonNestingExceedsLimit reports whether s, read as raw JSON text, ever
+// nests object/array containers deeper than limit. It is a single pass over
+// the bytes with a depth counter -- no recursion -- so unlike gjson.Valid's
+// recursive descent it cannot itself stack-overflow regardless of how deep
+// (or how long) the input actually nests. It does not fully validate JSON
+// syntax; that is still gjson.Valid's job once nesting is known to be safe.
+func jsonNestingExceedsLimit(s string, limit int) bool {
+	depth := 0
+	inString := false

Source: GitHub Commit 814e1898. The patch introduces jsonNestingExceedsLimit, an iterative depth counter that runs before gjson.Valid and returns an error if the raw body nests deeper than maxRecursion.

Detection Methods for CVE-2026-107826

Indicators of Compromise

  • Unexpected process termination of the Coraza-embedding service with a Go runtime message fatal error: stack overflow.
  • Crash reports showing gjson.validany, gjson.validarray, or gjson.validobject deep in the goroutine backtrace.
  • HTTP request logs showing JSON bodies with long trailing runs of [ or { characters immediately before the crash timestamp.

Detection Strategies

  • Inspect inbound JSON bodies for container-opening characters exceeding a conservative depth threshold (for example, 100) using an iterative scanner upstream of Coraza.
  • Correlate service restarts with the arrival of large or deeply nested JSON payloads from the same source address.
  • Audit the Coraza library version in all Go binaries by scanning module graphs for github.com/corazawaf/coraza entries below v3.8.1.

Monitoring Recommendations

  • Alert on repeated unclean exits of WAF-protected services, particularly when accompanied by SIGABRT or stack-overflow signatures.
  • Track request-body entropy and bracket-density metrics on JSON endpoints to flag denial-of-service probing.
  • Capture full request bodies on crash to accelerate root-cause analysis and attacker attribution.

How to Mitigate CVE-2026-107826

Immediate Actions Required

  • Upgrade all deployments embedding Coraza to version 3.8.1 or later.
  • Rebuild and redeploy any Go binary that transitively depends on github.com/corazawaf/coraza at a vulnerable version.
  • Restart Coraza-fronted services after upgrading to clear any stale module caches in build pipelines.

Patch Information

The fix is published in GitHub Release v3.8.1 and tracked in GitHub Security Advisory GHSA-6gcq-wc29-5xf2. The code change is in commit 814e1898, which adds an iterative nesting check before gjson.Valid runs.

Workarounds

  • Reject JSON bodies at an upstream proxy when nesting depth exceeds a safe limit, enforced by an iterative parser rather than a recursive one.
  • Disable the JSON body processor in Coraza configuration where request semantics allow, forcing JSON bodies to be treated as opaque text.
  • Deploy the Coraza-embedding service behind a process supervisor that imposes strict request-concurrency limits to reduce blast radius during exploitation attempts.
bash
# Update the Coraza dependency in a Go module to the patched release
go get github.com/corazawaf/coraza/v3@v3.8.1
go mod tidy
go build ./...

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.