Skip to content

CVE-2026-27654: Verified Reproduction

CVE-2026-27654: nginx WebDAV: heap-buffer-overflow in COPY/MOVE with alias directive

CVE-2026-27654 is verified against nginx · source. Affected versions: OSS 0.5.13–0.9.7, 1.0.0–1.28.2, 1.29.0–1.29.6; Plus R32–R36. Vulnerability class: RCE. This high reproduction includes runnable sandbox proof, artifacts, and a plain-text agent view under REPRO-2026-00171.

REPRO-2026-00171 nginx · source RCE May 28, 2026 CVE entry .txt
Severity
HIGH
CVSS
8.2
Reproduced in
21m 40s
Tool calls
173
Spend
$1.68
01 · Overview

What Is CVE-2026-27654?

CVE-2026-27654 is a high-severity heap-based buffer overflow (CWE-122) in nginx's ngx_http_dav_module, reachable unauthenticated via WebDAV COPY/MOVE requests against a location configured with the alias directive. Pruva reproduced it (reproduction REPRO-2026-00171).

02 · Severity & CVSS

CVE-2026-27654 Severity & CVSS Score

CVE-2026-27654 is rated high severity, with a CVSS base score of 8.2 out of 10.

HIGH threat level
8.2 / 10 CVSS base
Weakness CWE-122 (Heap-based Buffer Overflow)

High — serious impact or readily exploitable. Prioritize remediation.

03 · Affected Versions

Affected nginx Versions

nginx · source versions OSS 0.5.13–0.9.7, 1.0.0–1.28.2, 1.29.0–1.29.6; Plus R32–R36 are affected.

How to Reproduce CVE-2026-27654

$ pruva-verify REPRO-2026-00171
or curl -O https://www.pruva.dev/api/v1/reproductions/REPRO-2026-00171/artifacts/bundle/repro/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh
Run in a VM or disposable container. This exploits a real vulnerability.
06 · Proof of Reproduction

Proof of Reproduction for CVE-2026-27654

Reproduced
Vulnerable 1.29.6
Fixed 1.29.7
How the agent worked 634 events · 173 tool calls · 22 min
22 minDuration
173Tool calls
151Reasoning steps
634Events
4Dead-ends
Agent activity over 22 min
Support
18
Repro
238
Variant
373
0:0021:40

Root Cause and Exploit Chain for CVE-2026-27654

Versions: 0.5.13–0.9.7, 1.0.0–1.28.2, 1.29.0–1.29.6Fixed: 1.28.3 (stable), 1.29.7 (mainline)

CVE-2026-27654 is a heap-based buffer overflow in nginx's ngx_http_dav_module that triggers when processing WebDAV COPY or MOVE requests under a location that uses the alias directive. The vulnerability stems from an integer underflow in ngx_http_map_uri_to_path(): when the destination URI (duri) is shorter than the location prefix length (clcf->alias), the buffer size calculation clcf->root.len + r->uri.len - alias + 1 underflows as an unsigned size_t, resulting in a near-zero or wrapped allocation. The subsequent memcpy of the alias root path and destination URI then overflows the tiny heap buffer. This is reachable unauthenticated by any client that can send a WebDAV COPY/MOVE request to an nginx instance with dav_methods enabled under an aliased location.

  • Package/component affected: nginx Open Source and Plus, ngx_http_dav_module
  • Affected versions: 0.5.13–0.9.7, 1.0.0–1.28.2, 1.29.0–1.29.6
  • Fixed versions: 1.28.3 (stable), 1.29.7 (mainline)
  • Risk level: High (CVSS 3.1: 8.2, CVSS 4.0: 8.8)
  • Consequences: Worker process crash (DoS), potential arbitrary file write outside the intended directory, and possible escalation to RCE depending on heap allocator state.

Root Cause

The bug is located in ngx_http_dav_copy_move_handler() (src/http/modules/ngx_http_dav_module.c). Before computing the destination filesystem path, the handler temporarily overwrites r->uri with the parsed Destination header URI (duri) and calls ngx_http_map_uri_to_path(). That function computes the required buffer length with:

path->len = clcf->root.len + reserved + r->uri.len - alias + 1;

All operands are unsigned size_t. When alias (which stores the location prefix length) is larger than clcf->root.len + r->uri.len + 1, the subtraction wraps around. For example, with location /davvvv/ (alias = 7) and alias /a/ (root.len = 3), a destination URI of /xx (len = 2) produces:

3 + 2 - 7 + 15 - 7 wraps to SIZE_MAX - 1, then + 1 wraps back to 0.

ngx_pnalloc(pool, 0) returns a tiny pointer from the nginx pool. The following ngx_copy(path->data, clcf->root.data, 3) writes 3 bytes into a zero-byte allocation, and the subsequent ngx_copy(last, r->uri.data + alias, r->uri.len - alias) passes a negative-size parameter (-5) to memcpy, causing a massive out-of-bounds read/write.

Fix commit: 9739e75 in the nginx repository (Dav: destination length validation for COPY and MOVE.). The patch adds an explicit check before the path mapping:

if (clcf->alias && clcf->alias != NGX_MAX_SIZE_T_VALUE && duri.len < clcf->alias) {
    return NGX_HTTP_BAD_REQUEST;
}

This rejects any COPY/MOVE request whose destination URI is shorter than the location prefix, preventing the underflow.

Reproduction Steps

The reproduction is fully automated in repro/reproduction_steps.sh.

What the script does:

  1. Clones the nginx repository (or reuses the existing clone).
  2. Builds the vulnerable version (release-1.29.6) and the fixed version (release-1.29.7), both compiled with AddressSanitizer (-fsanitize=address).
  3. Creates a minimal nginx configuration with a location /davvvv/ that maps via alias to a short directory path, and enables dav_methods COPY MOVE.
  4. Starts the vulnerable nginx binary in the foreground (daemon off; master_process off;), sends a COPY request with a deliberately short Destination: http://127.0.0.1:8080/xx header, and captures ASAN output via ASAN_OPTIONS=log_path=....
  5. Repeats the same request against the fixed nginx binary and captures the HTTP response.
  6. Verifies that the vulnerable build crashes with an ASAN error while the fixed build returns HTTP 400 Bad Request with no ASAN error.

Expected evidence:

  • logs/vulnerable_asan.txt — ASAN report showing negative-size-param: (size=-5) inside ngx_http_map_uri_to_path called from ngx_http_dav_copy_move_handler.
  • logs/fixed_curl.txt — HTTP 400 Bad Request response from nginx/1.29.7.

Evidence

Vulnerable build (release-1.29.6)

ASAN log (logs/vulnerable_asan.txt):

==16927==ERROR: AddressSanitizer: negative-size-param: (size=-5)
    #0 ... in memcpy
    #1 ... in ngx_http_map_uri_to_path src/http/ngx_http_core_module.c:1987
    #2 ... in ngx_http_dav_copy_move_handler src/http/modules/ngx_http_dav_module.c:703
    #3 ... in ngx_http_dav_handler src/http/modules/ngx_http_dav_module.c:194
    #4 ... in ngx_http_core_content_phase src/http/ngx_http_core_module.c:1282
    ...
SUMMARY: AddressSanitizer: negative-size-param ... in memcpy

The stack trace confirms the crash occurs inside ngx_http_map_uri_to_path while handling the COPY request in the DAV module.

Fixed build (release-1.29.7)

HTTP response (logs/fixed_curl.txt):

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.29.7</center>
</body>
</html>

HTTP_CODE:400

The fixed binary rejects the malicious request with a 400 Bad Request and logs:

client sent invalid "Destination" header: "http://127.0.0.1:8080/xx"
Environment
  • OS: Linux 6.18.5 x86_64
  • Compiler: GCC 13.3.0
  • ASAN flags: -fsanitize=address -g -O1 -fno-omit-frame-pointer
  • nginx configure: --with-http_dav_module

Recommendations / Next Steps

  1. Upgrade immediately to nginx 1.28.3 (stable) or 1.29.7 (mainline) or later.
  2. Mitigation (if upgrading is not immediately possible): disable WebDAV COPY and MOVE methods, or avoid using the alias directive in locations that expose DAV methods.
  3. Regression testing: any future changes to ngx_http_dav_copy_move_handler or ngx_http_map_uri_to_path should include a test case with a destination URI shorter than the location prefix under an aliased location.
  4. Code review: audit other callers of ngx_http_map_uri_to_path that temporarily modify r->uri to ensure similar length validations are in place.

Additional Notes

  • Idempotency: repro/reproduction_steps.sh has been executed twice consecutively on a clean environment and produced the same confirmed verdict both times.
  • Edge cases: The trigger requires a specific relationship between the alias path length, the location prefix length, and the destination URI length. The script uses location /davvvv/ (len 7) + alias /a/ (len 3) + destination /xx (len 2) to force the underflow to wrap to exactly 0, which maximizes the chance of a detectable heap overflow. Other combinations (e.g., longer destination URIs that still underflow to small non-zero values) are also exploitable.
  • Limitations: The reproduction requires building nginx from source with ASAN, which takes several minutes. The script caches the built binaries in $ROOT/builds/ to avoid repeated compilation.

CVE-2026-27654 Reproduction Transcript

The agent's step-by-step process — every tool call, every handoff, the moment the exploit fired.

Full session Replay every step — scrub the timeline or play it back.

Event 1/40
0:000:34
0:00
session startedaccounts/fireworks/models/kimi-k2p6 · cve-2026-27654 · cve-2026
0:04
0:04
web search
0:04
error

Unknown error

0:06
0:06
0:06
error

Unknown error

0:26
0:26
extract_facts
no facts extracted
0:26
0:26
0:26
supportrepro
0:28
0:28
0:28
0:29
0:29
0:29
0:29
0:31
0:32
$git clone --depth=100 https://github.com/nginx/nginx.git external/nginx
1.0s
Cloning into 'external/nginx'...
0:34
0:34
$cd external/nginx && git log --oneline release-1.29.6..release-1.29.7 -- src/http/modules/ngx_http_dav_module.c
9739e75 Dav: destination length validation for COPY and MOVE.

Artifacts and Evidence for CVE-2026-27654

Scripts, logs, diffs, and output captured during the reproduction.

bundle/context.json2.5 KB
bundle/metadata.json0.6 KB
bundle/ticket.md5.0 KB
bundle/repro/rca_report.md6.8 KB
bundle/repro/reproduction_steps.sh4.8 KB
bundle/repro/validation_verdict.json1.2 KB
bundle/repro/nginx.conf0.5 KB
bundle/logs/vuln_prefix_curl_err.txt0.0 KB
bundle/logs/vuln_exact_stdout.txt0.0 KB
bundle/logs/fixed_prefix_curl_err.txt0.0 KB
bundle/logs/fixed_stderr.txt0.0 KB
bundle/logs/vuln_urlenc_curl.txt0.0 KB
bundle/logs/vuln_nested_curl_err.txt0.0 KB
bundle/logs/test_stderr.txt0.0 KB
bundle/logs/fixed_prefix_stderr.txt0.0 KB
bundle/logs/fixed_nested_curl_err.txt0.0 KB
bundle/logs/vulnerable_asan.txt3.2 KB
bundle/logs/fixed_script_curl.txt0.2 KB
bundle/logs/vuln_prefix.182683.2 KB
bundle/logs/vuln_move_stderr.txt0.0 KB
bundle/logs/fixed_exact_curl.txt0.2 KB
bundle/logs/fixed_nested_stdout.txt0.0 KB
bundle/logs/asan_vulnerable.170163.2 KB
bundle/logs/variant_final.log1.1 KB
bundle/logs/vuln_exact_curl_err.txt0.0 KB
bundle/logs/fixed_curl_err.txt0.0 KB
bundle/logs/fixed_urlenc_stderr.txt0.0 KB
bundle/logs/fixed_script_curl_err.txt0.0 KB
bundle/logs/vuln_script_stdout.txt0.0 KB
bundle/logs/fixed_nested_stderr.txt0.0 KB
bundle/logs/fixed_move_stdout.txt0.0 KB
bundle/logs/fixed_script_stdout.txt0.0 KB
bundle/logs/vuln_move_stdout.txt0.0 KB
bundle/logs/fixed_move_curl_err.txt0.0 KB
bundle/logs/error.log8.6 KB
bundle/logs/vuln_script_curl.txt0.0 KB
bundle/logs/fixed_script_stderr.txt0.0 KB
bundle/logs/vuln_prefix_stdout.txt0.0 KB
bundle/logs/fixed_move_stderr.txt0.0 KB
bundle/logs/vuln_move.182923.2 KB
bundle/logs/fixed_nested_curl.txt0.2 KB
bundle/logs/vuln_script.182863.2 KB
bundle/logs/vuln_script_curl_err.txt0.0 KB
bundle/logs/vuln_nested_stdout.txt0.0 KB
bundle/logs/vulnerable_curl_err.txt0.0 KB
bundle/logs/fixed_exact_stdout.txt0.0 KB
bundle/logs/vuln_nested.182803.2 KB
bundle/logs/test_stdout.txt0.0 KB
bundle/logs/fixed_prefix_stdout.txt0.0 KB
bundle/logs/fixed_urlenc_curl_err.txt0.0 KB
bundle/logs/vuln_nested_stderr.txt0.0 KB
bundle/logs/access.log3.3 KB
bundle/logs/vuln_script_stderr.txt0.0 KB
bundle/logs/vulnerable_stdout.txt0.0 KB
bundle/logs/vuln_urlenc_stdout.txt0.0 KB
bundle/logs/variant_tests.log0.1 KB
bundle/logs/vuln_prefix_curl.txt0.0 KB
bundle/logs/vuln_nested_curl.txt0.0 KB
bundle/logs/fixed_move_curl.txt0.2 KB
bundle/logs/vuln_move_curl_err.txt0.0 KB
bundle/logs/vulnerable_curl.txt0.0 KB
bundle/logs/test_curl_err.txt0.0 KB
bundle/logs/test_curl.txt0.0 KB
bundle/logs/vuln_urlenc_stderr.txt0.0 KB
bundle/logs/vuln_move_curl.txt0.0 KB
bundle/logs/fixed_exact_stderr.txt0.0 KB
bundle/logs/nginx.pid0.0 KB
bundle/logs/vuln_exact.182743.2 KB
bundle/logs/vuln_urlenc_curl_err.txt0.0 KB
bundle/logs/fixed_urlenc_stdout.txt0.0 KB
bundle/logs/fixed_curl.txt0.2 KB
bundle/logs/vulnerable_stderr.txt0.0 KB
bundle/logs/fixed_stdout.txt0.0 KB
bundle/logs/vuln_exact_curl.txt0.0 KB
bundle/logs/vuln_prefix_stderr.txt0.0 KB
bundle/logs/vuln_exact_stderr.txt0.0 KB
bundle/logs/vuln_urlenc.182983.2 KB
bundle/logs/fixed_exact_curl_err.txt0.0 KB
bundle/logs/fixed_urlenc_curl.txt0.2 KB
bundle/logs/fixed_prefix_curl.txt0.2 KB
08 · How to Fix

How to Fix CVE-2026-27654

Coming soon

Step-by-step mitigation and hardening guidance for CVE-2026-27654 — configuration checks, workarounds where no patch exists, and how to verify you're protected — is on the way.

10 · FAQ

FAQ: CVE-2026-27654

How does the nginx WebDAV COPY/MOVE exploit work?

An unauthenticated client sends a WebDAV COPY or MOVE request with a crafted Destination header to a location using alias (rather than root) where the destination URI doesn't map 1:1 to the location prefix; ngx_http_dav_copy_move_handler() temporarily overwrites r->uri with the parsed Destination path, and the underflowed length calculation causes a heap-buffer-overflow write in the nginx worker process.

Which nginx versions are affected by CVE-2026-27654, and where is it fixed?

nginx OSS 0.5.13-0.9.7, 1.0.0-1.28.2, and 1.29.0-1.29.6, plus nginx Plus R32-R36, are affected; it is fixed in 1.28.3 (stable) and 1.29.7 (mainline).

How severe is CVE-2026-27654, and does it lead to RCE?

It is rated high severity (CVSS 3.1: 8.2, CVSS 4.0: 8.8). Confirmed impact is a worker crash/DoS and, in some configurations, arbitrary file write at controllable paths; escalation to RCE via worker-heap corruption is possible but not guaranteed, depending on the allocator state.

How can I reproduce CVE-2026-27654?

Download the verified script from this page and run it in an isolated environment against a vulnerable nginx build with dav_methods enabled under an aliased location; it sends a crafted WebDAV COPY/MOVE request with a short Destination header and shows the heap-buffer-overflow write in the worker process, then confirms the fixed build does not overflow.
11 · References

References for CVE-2026-27654

Authoritative sources for CVE-2026-27654 — official vulnerability databases and the upstream advisory. Pruva's reproduction verifies the issue firsthand; these are the primary records to corroborate it.