Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Nginx-CVE-2013-4547 — Docker-based lab demonstrating Nginx CVE-2013-4547 URI parsing vulnerability with step-by-step exploitation for privilege bypass and code execution. | Kitploit
Tools/GitHubGitHub/cyberharsh/nginx-cve-2013-4547
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingMisconfigurationLearning & Education
GitHubcyberharsh/nginx-cve-2013-4547

Nginx-CVE-2013-4547

Docker-based lab demonstrating Nginx CVE-2013-4547 URI parsing vulnerability with step-by-step exploitation for privilege bypass and code execution.

View Repository
3146 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Nginx Filename Logic Vulnerability (CVE-2013-4547)

Vulnerability Description

Affected versions: Nginx 0.8.41 ~ 1.4.3 / 1.5.0 ~ 1.5.7

Reference links:

  • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4547
  • https://blog.werner.wiki/file-resolution-vulnerability-nginx/
  • http://www.91ri.org/9064.html

Vulnerability Description

This vulnerability is not directly related to code execution; its main cause is the incorrect parsing of the request URI, resulting in an erroneous retrieval of the user-requested filename, leading to permission bypass and secondary effects such as code execution.

For example, when Nginx matches a request ending with .php, it forwards it to fastcgi for parsing. A common configuration is as follows:

root@kitploit:~
location ~ \.php$ {
    include        fastcgi_params;

    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
    fastcgi_param  DOCUMENT_ROOT /var/www/html;
}

Under normal circumstances (with pathinfo disabled), only files with the .php extension are sent to fastcgi for parsing.

In the presence of CVE-2013-4547, if we request 1.gif[0x20][0x00].php, this URI matches the regex \.php$ and enters this Location block. However, after entering, Nginx mistakenly treats the requested file as 1.gif[0x20] and sets it as the value of SCRIPT_FILENAME, sending it to fastcgi.

Fastcgi then parses based on the value of SCRIPT_FILENAME, leading to a parsing vulnerability.

Therefore, we only need to upload a file ending with a space to cause PHP to parse it.

Another example: many websites restrict access to the admin panel by IP:

root@kitploit:~
location /admin/ {
    allow 127.0.0.1;
    deny all;
}

We can request a URI like /test[0x20]/../admin/index.php. This URI does not match the /admin/ location, bypassing the IP restriction; however, the final requested file is /test[0x20]/../admin/index.php, which resolves to /admin/index.php, successfully accessing the admin panel. (This requires a directory named test : this is a characteristic of Linux systems. If a directory does not exist, even a parent directory jump will cause a "file not found" error. Windows does not have this limitation.)

Vulnerability Test

Start the vulnerable environment:

root@kitploit:~
docker-compose build
docker-compose up -d

After the environment starts, visit http://your-ip:8080/ to see an upload page.

This environment uses a blacklist validation, so we cannot upload files with a .php extension. We need to exploit CVE-2013-4547. Upload a file named 1.gif , note the trailing space:

Visit http://your-ip:8080/uploadfiles/1.gif[0x20][0x00].php to find that PHP has been parsed:

Note that [0x20] is a space, and [0x00] is \0. Neither character needs to be URL-encoded.

Download Tool