Apache HTTPD Newline Parsing Vulnerability (CVE-2017-15715)

中文版本(Chinese version)

Apache HTTPD is a widely-used HTTP server that can run PHP web pages through mod_php. A parsing vulnerability exists in versions 2.4.0 through 2.4.29, where a filename ending with 1.php\x0A will be treated as a PHP file, allowing attackers to bypass certain server security policies.

References:

Environment Setup

Execute the following commands to build and start a vulnerable Apache HTTPD server:

docker compose build
docker compose up -d

After the server is started, Apache will be running at http://your-ip:8080.

Vulnerability Reproduction

First, try to upload a file named 1.php. The upload will be blocked by the security check:

Upload blocked by security check

However, if we append a \x0A (note: must be \x0A alone, not \x0D\x0A) to the filename 1.php, the upload will succeed:

Successful upload with newline character

When accessing the uploaded file at /1.php%0a, it will be successfully parsed as a PHP file, despite not having a proper PHP extension. This confirms the existence of the parsing vulnerability:

Successful PHP execution