
Technical analysis of CVE-2026-24072, a local privilege escalation in Apache HTTP Server mod_rewrite, including root cause, patches, and Dockerized testing lab for verification.
CVE-2026-24072 is a moderate-severity local privilege escalation vulnerability in Apache HTTP Server 2.4.66 and earlier. It allows local
.htaccessauthors to read arbitrary files on the filesystem with the privileges of thehttpduser by leveragingap_exprexpression evaluation insidemod_rewrite,mod_setenvif, andmod_proxy_fcgi.
| Field | Value |
|---|
| CVE ID | CVE-2026-24072 |
| Severity | Moderate (Local Privilege Escalation / Information Disclosure) |
| Affected | Apache HTTP Server <= 2.4.66 |
| Fixed | Apache HTTP Server 2.4.67 |
| Attack Vector | Local (requires .htaccess write access) |
CVE-2026-24072-analysis.mdmod_rewrite.diff, mod_setenvif.diff, mod_proxy_fcgi.diffexamples/Apache's expression evaluation engine (ap_expr) provides filesystem introspection functions:
file(path) — reads file contentsfilesize(path) — returns file size-d path, -e path, -f path, -s path, -L path, -h path, -x path — filesystem testsIn 2.4.66 and earlier, modules such as mod_rewrite (via RewriteCond expr=...), mod_setenvif (via SetEnvIfExpr), and mod_proxy_fcgi (via ProxyFCGIBackendType condition expressions) would parse and evaluate ap_expr expressions without passing the AP_EXPR_FLAG_RESTRICTED flag when operating in .htaccess context. This meant that any local user who could write a .htaccess file could use these expression functions to probe or read the filesystem with the full privileges of the httpd process.
The fix is conceptually simple: when parsing ap_expr expressions in .htaccess context, pass the AP_EXPR_FLAG_RESTRICTED flag.
All three patched modules use the same idiom to detect .htaccess parsing context:
int in_htaccess = cmd->pool == cmd->temp_pool;
When Apache parses .htaccess files, the per-directory configuration pool (cmd->pool) is the same as the temporary pool (cmd->temp_pool). This is a well-known internal Apache convention for detecting .htaccess (per-directory) context vs. main server/virtual host context.
| File | Description |
|---|---|
CVE-2026-24072-analysis.md | Full technical analysis and impact assessment |
mod_rewrite.diff | Patch for modules/mappers/mod_rewrite.c |
mod_setenvif.diff | Patch for modules/metadata/mod_setenvif.c |
mod_proxy_fcgi.diff | Patch for modules/proxy/mod_proxy_fcgi.c |
httpd-2.4.66/ | Source tree of vulnerable Apache version |
httpd-2.4.67/ | Source tree of fixed Apache version |
examples/ | Proof-of-concept .htaccess files |
This repository includes a Dockerized testing lab that lets you swap between the vulnerable and patched mod_rewrite modules to verify the fix works:
# Build and start the lab
make build
make up
# Run the full automated test matrix (both variants)
make test
The lab uses a sentinel file (/opt/sentinel/secret.txt) that is readable only by the daemon user (the user httpd runs as). On the vulnerable build, .htaccess expressions can read and match the sentinel's contents. On the fixed build, parsing fails with not available in restricted context.
See docs/TESTING.md for the full guide.
| File | Description |
|---|---|
CVE-2026-24072-analysis.md | Full technical analysis and impact assessment |
mod_rewrite.diff | Patch for modules/mappers/mod_rewrite.c |
mod_setenvif.diff | Patch for modules/metadata/mod_setenvif.c |
mod_proxy_fcgi.diff | Patch for modules/proxy/mod_proxy_fcgi.c |
httpd-2.4.66/ | Source tree of vulnerable Apache version |
httpd-2.4.67/ | Source tree of fixed Apache version |
examples/ | Proof-of-concept .htaccess files |
docker/ | Docker build files for the testing lab |
scripts/ | Swap and test scripts |
tests/ | Test fixtures and matrix |
docs/TESTING.md | Full testing guide |
docs/session/ | Session export from the design process |
This repository is for educational and defensive purposes only. The proof-of-concept examples are intended to help security professionals understand and defend against this vulnerability. Do not use these techniques on systems you do not own or have explicit permission to test.