We earn commissions when you shop through affiliate links on this site, at no extra cost to you. Our guides and technical recommendations are written independently of these relationships: a commission never decides what we recommend, how we diagnose a problem or what we publish, and the content does not depend on it. Affiliate disclosure

Security · Published 2026-11-14

ModSecurity CVE-2026-104269: Upload filename Bypass

CVE-2026-104269: ModSecurity 3 before 3.0.17 reads only filename=, while Go reads filename*, so a .php upload the WAF blocks slips through. Tested in Docker.

TL;DR

  • A WAF only protects you if it reads a request the same way your application does. CVE-2026-104269 is a case where it does not: ModSecurity 3 before 3.0.17 and some backend parsers disagree about an uploaded file's name.
  • The trick is two names in one header. Content-Disposition: form-data; name="file"; filename="safe.jpg"; filename*=UTF-8''shell.php. The filename* form is RFC 2231's extended parameter.
  • We reproduced it: on libmodsecurity 3.0.16, a rule that blocks .php uploads let that request through (HTTP 200), while a Go backend behind it saved shell.php. On 3.0.17 the same rule returned 403.
  • Fixed in libmodsecurity 3.0.17 (released 29 September 2026). The advisory is GHSA-5pww-8rfg-9crf; the CVE record was published 5 November 2026.
  • Not everyone is affected the same way. It bites backends whose parser honors filename* (Go's standard library does). PHP's upload handling reads only filename= and is not affected. In our test, python-multipart also read filename=.

What the flaw is

When a browser or a client uploads a file, the filename travels in a Content-Disposition header. RFC 2231 and RFC 6266 add an extended form, filename*, which can carry a charset and non-ASCII characters, and when both filename and filename* are present, a parser that follows those RFCs uses filename*.

ModSecurity 3 before 3.0.17 did not. It read only the plain filename. So a single upload could carry a benign filename="safe.jpg" that the WAF inspects and a real filename*=UTF-8''shell.php that an RFC-aware backend extracts. The WAF's rules and the application end up judging two different names for the same file. The GitHub advisory scores it AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N: no authentication, network reachable, an integrity impact that crosses a trust boundary.

How we reproduced it

Two official OWASP ModSecurity CRS images, identical except for the engine version (confirmed by the libmodsecurity.so filename inside each):

  • owasp/modsecurity-crs:4-nginx-alpine-202609230209 → libmodsecurity 3.0.16 (vulnerable)
  • owasp/modsecurity-crs:4-nginx-alpine-202611090911 → libmodsecurity 3.0.17 (fixed)

Behind the WAF, a small Go service (Go 1.23, standard-library mime/multipart) that reports and saves the filename it parses. One custom rule, a common "block PHP uploads" filter:

# Block any uploaded file whose name ends in .php
SecRule FILES "@rx \.php$" "id:1000,phase:2,deny,status:403,log,t:lowercase"

The payload is one multipart part with both names. There is nothing malicious in the body; the point is the header:

# The upload header: one part, two filenames (the point is this header, not the body)
Content-Disposition: form-data; name="file"; filename="safe.jpg"; filename*=UTF-8''shell.php

What each side saw

First, what the backends extract from that header, with no WAF in front. Go's standard library follows RFC 2231 and takes filename*; python-multipart 0.0.33 takes the plain filename:

# What each backend extracts from the dual-filename header, no WAF in front
filename="safe.jpg"; filename*=UTF-8''shell.php
  Go stdlib (mime/multipart):  shell.php     <- honors filename*
  python-multipart 0.0.33:     safe.jpg      <- uses filename

Then the same request through the WAF, with the .php rule active and the Go service as the backend:

# Same request through the WAF, .php rule active, Go backend
libmodsecurity 3.0.16 (vulnerable):  HTTP 200   <- rule did not fire; Go saved shell.php
libmodsecurity 3.0.17 (fixed):       HTTP 403   <- rule fired on the filename* value

On 3.0.16 the request sails past a rule written specifically to stop it, and the file lands as shell.php. On 3.0.17, with the same rule and the same CRS version, the engine now surfaces the filename* value into FILES, so the rule matches and returns 403. The fix is in the engine, not in the ruleset.

Two things we checked so we would not overstate it:

  • A duplicated plain filename="safe.jpg"; filename="shell.php" is rejected outright, HTTP 400, on both versions. That is a different, already-handled case.
  • python-multipart read safe.jpg, the same name the pre-fix engine saw, so a Starlette or FastAPI app on that parser did not disagree with the WAF in our test. The bypass needs a backend that prefers filename*.

Who is affected

  • Affected: ModSecurity 3.0.0 through 3.0.16 in front of a backend whose multipart parser honors filename*. Go's standard library does, which covers a lot of Go upload handlers and reverse-proxied services. Other RFC 2231-aware parsers in Node, Java and Python stacks may too; test yours rather than assume.
  • Not affected by this exact trick: PHP's native $_FILES handling, which reads only filename=. A backend that ignores filename* sees the same name the old engine saw, so there is no disagreement.
  • Not the vulnerability: the WAF blocking an upload it should allow. This is the opposite, an upload the WAF should block getting through.

What to do

  1. Upgrade libmodsecurity to 3.0.17. Check the version you actually run, not the connector or the image tag:
   # The engine version is in the shared library name
   find / -name 'libmodsecurity.so.3.0.*' 2>/dev/null

On the OWASP CRS images, pull a build dated after 29 September 2026 and confirm it reports 3.0.17.

  1. Do not rely on the WAF alone to decide what a file is. Validate the filename and the content type again in the application, from the same field the application will actually use to store the file. A WAF is one layer; the upload handler is the one that writes to disk.
  1. Store uploads out of the web root and never execute them. A file called shell.php is only dangerous if something runs it. Serve uploads from a path the application server will not interpret, and set the storage directory non-executable.
  1. If you cannot patch immediately, add a rule that rejects requests carrying an extended filename parameter in a multipart part, or that flags a mismatch, using the new MULTIPART_FILENAME_CHARSET and MULTIPART_DUPLICATE_PART_HEADER variables that 3.0.17 introduces. That is a stopgap; the upgrade is the fix.

What we have not verified

  • Other parsers. We tested Go 1.23 and python-multipart 0.0.33. The advisories also name Node, Java and other Python stacks; we did not test those and do not claim a result for them. Test your own backend with the header above and read which name it stores.
  • Your ruleset. We used one explicit FILES rule to make the behavior unambiguous. Whether your CRS paranoia level or a custom rule set catches the filename* form on 3.0.16 depends on your rules; the engine change is what makes 3.0.17 surface the value at all.
  • Exploitation in the wild. Public proof-of-concept code exists, per the advisories. We did not assess active exploitation.

Related guides

Sources

More from the blog

This article is educational information, not incident-response or legal advice. Verify package status with your operating system, hosting, or runtime vendor.