Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

[R1] Microsoft Windows DNS Server dns.exe answerIQuery() Function Remote Buffer Overflow



Microsoft Windows DNS server can be configured to respond to inverse queries when HKLM\System\CurrentControlSet\Services\DNS\Parameters\EnableIQueryResponseGeneration (REG_DWORD) is set to a non-zero value. By default this registry setting is missing and the DNS server returns a "Not Implemented" error for an inverse query. However, if inverse query response generation is enabled, there is a buffer over-read issue in dns.exe!answerIQuery(). Inside the function, Dns_ReadRecordStructureFromPacket() is called to parse a Resource Record (RR) inside the inverse query packet. That function returns a pointer to a location immediately followed by the end of the RR. This location is the end of the query packet. Later, a strlen() operation is performed. If the length of the string is not greater than 16, the string is then copied to a local stack buffer, which will become the QNAME (enclosed with open and close brackets) in the question section of the inverse query response. If the length of the string is greater than 16, an error message of return code 1 (Format Error) is returned.

The issues of performing a strlen() operation at the end of the inverse query packet may have different impacts:

  1. Data at the end of the packet can be non-zero up until a non-accessible page is reached. This can cause an access violation leading to a remote denial of service.
  2. Data at the end of the packet can be returned to the client if its 'strlen' is less than or equal to 16 bytes. This may result in a remote information disclosure issue.


Microsoft evaluated the issue and has opted not to provide a patch, stating:

We have completed our investigation and believe that the behavior that you are reporting does not have wide applicability and does not meet our bar for servicing in a security update. The product team is evaluating whether to address this behavior on future versions of Windows.

This issue can be worked around by ensuring that the Inverse Query functionality is not enabled, which is the default configuration. This can be carefully verified in the registry at HKLM\System\CurrentControlSet\Services\DNS\Parameters\EnableIQueryResponseGeneration.

Proof of Concept

Tenable will not be releasing the PoC sent to Microsoft. However, a plugin has been authored to detect this issue and is already in your Tenable Feed.

Disclosure Timeline

2016-01-11 - Tenable notified MSRC via [email protected]
2016-01-11 - Vendor replies, assigns Case 32278, TRK:0001002777
2016-01-12 - Vendor asks for our PoC, Tenable sends it
2016-02-08 - Vendor "successfully reproduced the issue"
2016-03-01 - Vendor says issue "does not have wide applicability and does not meet our bar for servicing in a security update"

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]