Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've wanted something like that. The main problem is security: find a hash collision, magic XSS.


That's a non problem if you use a cryptographically sound hashing algorithm. If someone can find collisions to sha3, they can do a lot more damage than xss.


Edit: just reread the GP and saw that they said the content should be able to come from a cache of a different domain. You're right, hash collision there would be bad (as others had mentioned you'd want something with a low chance if collision construction).

How does this introduce a new XSS issue? It's no different from the current system. And in this case the hash isn't being used to verify the content, it's there for cache invalidation.

I guess someone could poison your local cache somehow, and maybe that could be a problem with shared cdns. But there are other mechanisms to make sure you're delivered the right content in the first instance.

I think the main issues are actually browser support and having to deal with it in your own framework / code. That's the point people start saying - you know what, the existing system works well enough, I'll jut crank up the expiry on my existing headers and stick a cache buster in the URL when it needs to change.


though you could say this about any system that uses hashing. if sha256 or 512 is used, the likelihood of collisions with other functioning code, especially code that would yield useful xss seems impossibly small.


Better yet, use multiple hashes. Finding a simultaneous collision in sha256 and md5 seems pretty unlikely.


No. This is bad advice, do not do this; it comes up every time there's a problem with a hash algorithm. The equivalent number of bits in a hashing algorithm designed as such (e.g. sha-384) will be substantially more secure than sha256+md5.


That's not the point.

The point is that you don't want to stand on only one leg when a flaw in that leg may be discovered in the future.

Admittedly MD5 was a poor example from me in that light...

A more realistic mix might be: sha256+RIPEMD160+Whirlpool.

Or, in crypto-speak: Concatenating outputs from multiple hash functions provides collision resistance as good as the strongest of the algorithms included in the concatenated result. [1]

[1] http://en.wikipedia.org/wiki/Cryptographic_hash_function#Con...


Even a very serious attack against SHA-512 would be unlikely to render it as weak as RIPEMD-160 (compare even e.g. MD4, which is pretty thoroughly broken but the attacks still take compute time). If you have the bits, it's better to spend them on a longer hash rather than more hashes.


Even a very serious attack against SHA-512 would

What makes you think you can predict the consequences of an attack against SHA-512?

Don't put all your eggs in one basket.


> What makes you think you can predict the consequences of an attack against SHA-512?

70 years of cryptographic history.

> Don't put all your eggs in one basket.

Don't use cryptographic primitives in ways they weren't designed for. That's a surefire recipe for disaster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: