Nginx Code Execution with Null Bytes hidden points and key points

Source: Internet
Author: User
Tags php syntax error

Last night, the black pot posted a foreigner-exposed Nginx vulnerability on Weibo, and few people started to pay attention to it. I tested and verified the installation environment, I tried two websites on the Internet and verified the vulnerability, So I uploaded the vulnerability on Weibo immediately.

This vulnerability was launched in July 20. Foreigners have made a very detailed analysis. For more information, see:

Https://nealpoole.com/blog/2011/07/possible-arbitrary-code-execution-with-null-bytes-php-and-old-versions-of-nginx/

Here I will talk about the hidden points and key points of this vulnerability:

1. old broilers become new Broilers

We should remember 80 sec issued nginx file type error Parsing Vulnerability: http://www.bkjia.com/Article/201005/47604.html

The vulnerability is exploited as follows:

/Test.jpg/x. php

 

The temporary solution is:

If ($ fastcgi_script_name ~ \ .. * \/. * Php ){
Return 403;
}

 

New vulnerabilities are exploited in the following ways:
/Test.jpg % 00.php

 

Matched with the regular expression fastcgi_script_name, we will find that this vulnerability is not found, so it is very rare that bots that have been hacked by this vulnerability can be hacked again.

 

2. Methods to accurately identify this vulnerability.

Generally, this vulnerability can be exploited only in applications that can upload files. Therefore, the Forum bears the brunt of this vulnerability. For example, the two files on the discuz forum can easily identify this vulnerability.

1. PHP syntax error.

2. Eat the first line of CGI # comment.

Specific can refer to: http://www.bkjia.com/Article/201101/81627.html

The principle is here.

BY: black box of RAyh4c

Iii. Scope of vulnerability impact

Https://svn.nginx.org/nginx/browser/nginx#tags

All versions of nginx 0.7.65 or lower (0. 5. *, 0. 6. *, 0. 7. *) and 0.8.37 (0. 8. *) are affected.

In fact, some old versions are still affected, but many of the earliest companies in China that sought after ngnix do not have many vulnerable nginx versions used online, especially for security companies, so be careful when you get hacked.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.