News for hackers. Stuff that matters.
Re:Using Immutable Caching to Speed Up the Web by niftich on Thursday January 26, 2017 @04:39PM (#13495482)
In a browser's current usage model, this is vulnerable to a 'cache origin confusion attack'. See this thread [1]. It's a bit hard to follow, so perhaps see these posts [2][3], which state the problem succinctly. Let me adapt the text from [3]:

The problem is that www.victim.com/evil.js doesn't exist, and never did, but your browser won't know that if it's in the cache -- this gives you a way of faking files existing on other servers at the URL of your choice, and as long as they're in the cache you'll get away with it.

[1] https://news.ycombinator.com/item?id=10310594 [2] https://news.ycombinator.com/item?id=10311555 [3] https://news.ycombinator.com/item?id=10312333

Re:Using Immutable Caching to Speed Up the Web by btrask on Thursday January 26, 2017 @06:45PM (#13496488)
This issue is discussed here, with what I think is a workable solution: https://github.com/w3c/webappsec-subresource-integrity/issue...
Re:Using Immutable Caching to Speed Up the Web by wanderr on Friday January 27, 2017 @04:24AM (#13498683)
I think the best way to fully quell the objections involves subresource integrity but I think the ideal way to deal would be to add a new attribute, sameas="https://canonical jquery link" or something along those lines. Then if the browser already has canonical jquery link AND the subresource integrity checks out it'll use that one. Otherwise it will load from wherever the developer specified and not be stored in a shared cache associated with the canonical jquery url in any way. Browsers can track references to sameas URLs that they keep getting cache misses on and go fetch them in the background for future use, possibly even going back and deleting the duplicates it had from before. This would allow developers to have a much greater chance that their libraries load from cache without adding more dns lookups and dependencies on cdns or servers they can't control.
Re:Using Immutable Caching to Speed Up the Web by saurik on Thursday January 26, 2017 @06:35PM (#13496431)
From that thread, "CSP already has a mechanism for hash-based whitelisting - if this is the only limitation, it'd be just as easy to allow cache-sharing whenever CSP is absent and/or the specific hash is explicitly white-listed." <- I totally understand the attack, but fail to see why it would be a problem if CSP actually does, in fact, have the ability to whitelist hashes (and looking at the spec, it does seem to, though I have not paid attention to CSP before and admit I could be misinterpreting the spec based on this prompt).
Re:Using Immutable Caching to Speed Up the Web by tetrep on Thursday January 26, 2017 @06:10PM (#13496246)
This is fixed by relying on CORS and using a key of (domain, hash) rather than just the hash.
Re:Using Immutable Caching to Speed Up the Web by woogley on Thursday January 26, 2017 @06:12PM (#13496261)
But then you're still downloading jQuery (or whatever) again for every unique domain
Re:Using Immutable Caching to Speed Up the Web by d33 on Thursday January 26, 2017 @06:34PM (#13496423)
Not if it points to a CDN.
Re:Using Immutable Caching to Speed Up the Web by woogley on Thursday January 26, 2017 @07:25PM (#13496699)
This brings us back to current status, as it defeats the purpose of normalizing arbitrary CDNs with the hash