Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
Last active December 19, 2015 07:18
Show Gist options
  • Save gregoryyoung/5917423 to your computer and use it in GitHub Desktop.
Save gregoryyoung/5917423 to your computer and use it in GitHub Desktop.
Proof that httplistener does not use http.sys kernel caching
From HttpListener source code
http://www.dotnetframework.org/default.aspx/DotNET/DotNET/8@0/untmp/whidbey/REDBITS/ndp/fx/src/Net/System/Net/HttpListenerResponse@cs/2/HttpListenerResponse@cs
line 525
UnsafeNclNativeMethods.HttpApi.HttpSendHttpResponse(
HttpListenerContext.RequestQueueHandle,
HttpListenerRequest.RequestId,
(uint)flags,
pResponse,
null,
null,
SafeLocalFree.Zero,
0,
asyncResult==null ? null : asyncResult.m_pOverlapped,
null );
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364499(v=vs.85).aspx
Argument 5 is the CACHE_POLICY. It is set to null which means no caching.
SO NO YOU DO NOT USE KERNEL MODE CACHING WITH HTTP LISTENER
@HughJeffner
Copy link

I guess this is nice to know given the discovered vulnerability in http.sys: https://technet.microsoft.com/en-us/library/security/ms15-034.aspx#ID0EXIAC

Disabling kernel mode caching is given as a workaround. Of course if you are using a supported OS you can just patch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment