Recent nginx for windows: $ DATA source code leakage Vulnerability

Source: Internet
Author: User

Painful belief

In fact, I have known this vulnerability earlier, and I believe there are still many people in the circle, because lake2 has analyzed the vulnerability principles similar to server software, and the impact is naturally not limited to nginx. Unfortunately, only the test method is available on the Internet. Everyone may think this is an ngix vulnerability. I will mainly analyze the principles here and tell you that the title of this blog post may be "ngix improper processing of NTFS exchange data stream requests on windows platforms, leading to source code leakage"

I will not introduce NTFS exchange data streams. Microsoft and Baidu have different naming methods. My name is English translation. I am called NTFS data streams directly. Microsoft official introduction:Http://support.microsoft.com/kb/105763

At my level, I cannot know exactly what internal types of NTFS data streams are, and what are their respective functions. Lake analyzed the IIS3/4: $ DATA leakage vulnerability. For details, seeHttp://edu.codepub.com/2010/0317/21103.php

I want to read the above two articles, and then I did some tests. Condition for exploits of nginx vulnerabilities:
0x00. No patch is installed
0x01. running on windows
0x02. the disk of the website directory is in NTFS format.

The reason why the title at the beginning of the article should be changed is here. However, after reading the lake analysis at that time (this nginx vulnerability was not found at that time), it was deemed that other web servers may not be able to handle the vulnerability.
Let's take a look at Microsoft's sample code:
# Include <windows. h>
# Include <stdio. h>

Void main ()
{
HANDLE hFile, hStream;
DWORD dwRet;

HFile = CreateFile ("testfile ",
GENERIC_WRITE,
File_pai_write,
NULL,
OPEN_ALWAYS,
0,
NULL );
If (hFile = INVALID_HANDLE_VALUE)
Printf ("Cannot open testfile ");
Else
WriteFile (hFile, "This is testfile", 16, & dwRet, NULL );

HStream = CreateFile ("testfile: stream ",
GENERIC_WRITE,
File_pai_write,
NULL,
OPEN_ALWAYS,
0,
NULL );
If (hStream = INVALID_HANDLE_VALUE)
Printf ("Cannot open testfile: stream ");
Else
WriteFile (hStream, "This is testfile: stream", 23, & dwRet, NULL );
}
As you can see, the file API provided by windows can be used to operate streaming files. The article pages mentioned fread and fopen streaming support. If the processing of the request is not good and the last two conditions of nginx are met, it is estimated that the disaster is not far away. In many cases, the web server software can correctly feedback and even parse the stream file content. : $ DATA is the first to be killed because it points to the content of the current stream.

At the end of the article, I hope that some people will publish some tips about the operating system for me to wait for cainiao to study. If the article is incorrect, please correct it.

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.