Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
Last active December 19, 2015 07:18
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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