W3C home > Mailing lists > Public > ietf-http-wg@w3.org > April to June 2013

Re: Caching 412 responses

From: Ben Niven-Jenkins <ben@niven-jenkins.co.uk>
Date: Tue, 28 May 2013 07:13:42 +0100
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Message-Id: <AC9046EB-F39B-4E5D-846D-CAA632402F4F@niven-jenkins.co.uk>
To: Mark Nottingham <mnot@mnot.net>
Mark,

Sorry for the delay in responding. Yes it makes sense.

Ben

On 17 May 2013, at 04:26, Mark Nottingham wrote:

> Hi Ben,
> 
> In the current model, the server *has* to make a 412 explicitly cacheable (e.g, with CC: max-age, as you do below) or otherwise usable (e.g., with CC: public) for an intermediary to store it, so I don't see how this is exploitable; the server shouldn't make those responses cacheable (and indeed, AFAICT none do).
> 
> The same could be said about 413 (Request Entity Too Large), 415 (Unsupported Media Type), 416 (Requested Range Not Satisfiable), 428 (Precondition Required), and probably a few more. If someone wants to make these responses cacheable, they need to do the work to make them properly cacheable (by including Vary).
> 
> Make sense?
> 
> Regards,
> 
> 
> 
> On 16/02/2013, at 9:57 PM, Ben Niven-Jenkins <ben@niven-jenkins.co.uk> wrote:
> 
>> Colleagues,
>> 
>> RFC2616 and the HTTPbis drafts allow an intermediary to cache a 412 response to a request with an If-Match header, if the response contains appropriate Cache-Control headers.
>> 
>> My understanding of the specifications is that the intermediary is then within its right to serve the cached 412 response in response to subsequent GET requests that do not contain an If-Match header (see bottom of this mail for an example set of requests/responses that illustrate what I'm trying to describe).
>> 
>> This seems problematic because if an attacker knows an origin returns cacheable 412 responses, the attacker could fill the cache with 412 responses for a set of URLs (from that origin) by making spurious If-Match requests it knows will return 412 responses, and those 412 responses would subsequently be served up to other clients instead of the 'real' response the origin would have given if the 412 was not cacheable or if the attacker had not poisoned the intermediary's cache with 412s.
>> 
>> I was wondering whether this is a gap in the spec and cacheable 412 responses should have an explicit (or implicit?) Vary: If-Match semantic associated with them?
>> 
>> Or, whether it is purposely the way it is and is a case of providing the rope and letting people hang themselves if they so choose (Origin servers can always add the Vary: header if they care about cache poisoning, intermediaries can always not cache 412 responses, etc.).
>> 
>> An example (with only the relevant Headers included for compactness) of what I am talking about would be:
>> 
>> First request:
>> GET /foo HTTP/1.1
>> Host: example.com
>> If-Match: "thisisnotanetag"
>> 
>> HTTP/1.1 412 Precondition Failed
>> Cache-Control: max-age=900
>> ...rest of response...
>> 
>> 
>> Subsequent request:
>> GET /foo HTTP/1.1
>> Host: example.com
>> 
>> HTTP/1.1 412 Precondition Failed
>> Age: 10
>> Cache-Control: max-age=900
>> ...rest of response...
>> 
>> Thanks
>> Ben
>> 
>> 
> 
> --
> Mark Nottingham   http://www.mnot.net/
> 
> 
> 
> 
Received on Tuesday, 28 May 2013 06:14:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 11:11:13 UTC