RE: Prevent caching of pdf files

From: Michael Wojcik (Michael.Wojcik_at_microfocus.com)
Date: 12/07/03

  • Next message: Peter Gutmann: "Re: Prevent caching of pdf files"
    To: SECPROG@securityfocus.com
    Date: Sun, 7 Dec 2003 12:33:02 -0800 
    
    

    > From: bsec [mailto:bsec@cotse.net]
    > Sent: Friday, December 05, 2003 5:33 PM

    > Currently on a secure Internet application we use the
    > "Cache-Control: No Cache" header to prevent information from
    > caching on client machines. We would like to begin to provide pdf
    > files via our application; however, there is a known issue with
    > accessing pdf files with IE 6.0 sp1 when the no-cache header is
    > used. (Please refer to
    > http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
    > for details.) As we have no control over the client machines
    > accessing our application, is there another way to prevent pdf
    > files from being automatically stored on the clients without using
    > the no-cache header?

    My personal choice would be to avoid PDF files like the plague, as I think
    they're nearly as bad an information-representation choice as HTML email, in
    terms of benefit-cost ratio. But if you're determined...

    (I'm also assuming here that the threat you're trying to address is an
    attacker retrieving documents from the cache at a later date, not a hostile
    user trying to keep copies of documents being served, which is of course
    impossible to prevent. So we're assuming a cooperative user and an
    otherwise normally-functioning user agent.)

    The advisory only mentions the Cache-Control header and the "Do Not Save
    Encrypted Files" option. It sounds like there's a generic issue with
    caching - that IE 6sp1 simply will refuse to download or render PDFs over
    SSL if caching is disabled - in which case you're out of luck. (I suspect
    the problem is that IE caches the PDF file and then invokes the Acrobeast
    ActiveX control against it, or some such thing.)

    However, you could try some alternate methods of discouraging caching just
    in case it's actually an issue specifically with Cache-Control and "Do Not
    Save". See chapter 13 of RFC 2616 (HTTP/1.1) for full information.

    For example:

    1. HTTP/1.1 specifically requires that a cache invalidate any cached entity
    referred to by a URL in response to a request using the PUT, DELETE, or POST
    method (13.10). In effect, that means that POST should always fetch a fresh
    version of a document, not a cached one. That doesn't stop a cache from
    caching the result of a POST request. However, you might expect a
    well-written cache to not cache the results of a POST, on the grounds that
    there probably won't be a subsequent GET for the same entity. I have no
    idea whether IE does, but I'd give this a try first.

    2. HTTP/1.1 specifies that no HTTP/1.1-compliant cache mechanism should
    treat an HTTP/1.0 response to a GET request with a query URL (one containing
    a "?" character) as fresh, unless that response contains expiration
    information, because it was common practice in HTTP/1.0 for query-URL GET
    requests to have side effects (13.9). However, I hope your server is
    HTTP/1.1, not 1.0, so this probably doesn't help. (Anyway, I have no idea
    whether IE respects this rule, or fully complies with caching freshness
    rules.)

    3. HTTP/1.1 caching incorporates an expiration mechanism. HTTP/1.1 allows a
    server to specify an expiration time in the past for a response to force a
    cache to validate any cached copy before returning it to the client
    (13.2.1). A "lazy" cache might simply avoid caching any already-expired
    response, since it will have to validate it anyway. I don't know what IE
    does.

    In the end, though, Cache-Control is the mechanism designed into HTTP/1.1
    for preventing caching, and it's broken in IE6sp1. (Who would have
    thought?) Trying to trick the browser into not caching the response through
    other means is klugy at best and unlikely to work in the long run.

    Hmm... It appears that some browsers offer Javascript methods to remove
    cache entries. I haven't investigated further, but you might try some
    Javascript references for more information.

    -- 
    Michael Wojcik
    Principal Software Systems Developer, Micro Focus
    

  • Next message: Peter Gutmann: "Re: Prevent caching of pdf files"

    Relevant Pages

    • Re[2]: [PHP] dynamic -> static
      ... As I wrote already this issue is mainly because of search engines ... incompatibility with dynamic content sites (to be more exact - with ... You can cache your code using PHP Accelerator or Turck ... MM> implementing a caching layer between your application and your database. ...
      (php.general)
    • Re: [PHP] Aggressive PHP Smart Caching
      ... i have begun to experiment w/ your caching tool. ... it is also important that the script calling ob_end_flushhave access to ... the header method in the first bit of code in the cache tool. ...
      (php.general)
    • Re: [PHP] dynamic -> static
      ... You can cache your code using PHP Accelerator or Turck ... implementing a caching layer between your application and your database. ... 404 causes it to error out regardless of the content of the response. ... with any caching system as above - finding and flushing stale data. ...
      (php.general)
    • Re: GC *and* Universal Group Caching
      ... Appreciate the extra info. So, I take it that if I>>authenticate to a DC that is a GC and caching is turned on pointed at>>another domain, the DC will get Universal group membership from it's>>cache as its own behavior has been altered to do so. ... >>>>>>-->>>Joe Richards Microsoft MVP Windows Server Directory Services>>>www.joeware.net>>> ...
      (microsoft.public.windows.server.active_directory)
    • Re: IIS 6.0 caching Image Files when we dont want it
      ... Well, your application does not sound like it is cache friendly, so maybe ... the decision to do static file caching works like this: ... IF Static File Caching is not disabled (W3SVC/DisableStaticFileCache is ... Disabling static file cache does indeed solve the problem but affects other ...
      (microsoft.public.inetserver.iis)