News for hackers. Stuff that matters.
Re:A new hash algorithm for Git by anaisbetts on Tuesday February 04, 2020 @04:19AM (#22233723)
I don't understand the practical attack vector for breaking SHA1s in Git. Not only are objects checksummed by SHA1, they also encode the length. Finding a SHA1 collision is plausible, but finding a SHA1 collision that both lets you do something Nefarious, and is the length you need, seems really really unlikely
Re:A new hash algorithm for Git by est31 on Tuesday February 04, 2020 @04:41AM (#22233846)
The shattered collision attack featured two pdfs with the same sha1 and wait for it, the same length. Also note that even with normal sha1, the length is hashed into the final sha1 hash already, that's what the merkle damgard scheme is about. You can read about it on Wikipedia.

Reusing the precise collision from the shattered attack is made impossible by initializing the state with anything other than the prefix from the shattered attack. But the cost for mounting such an attack yourself is only 11k USD. However, as git uses the sha1collisiondetection library, such an attack would be detected by current git. Thus, this library is a much better protection than the length encoding.

Re:A new hash algorithm for Git by HereBeBeasties on Tuesday February 04, 2020 @04:39AM (#22233835)
You're assuming that 100% of the source code matters, but most source code has comments. Some has a lot of comments (boilerplate headers). Delete all the comments and superfluous whitespace, add nefarious code, put in a comment in the remaining bytes for the sole purpose of causing a hash collision (likely plenty of bytes to play with).
Re:A new hash algorithm for Git by scoutt on Tuesday February 04, 2020 @05:13AM (#22234021)
Yes, but...

> this new version would have to contain the desired hostile code, still function as a working floppy driver, and not look like an obfuscated C code contest entry

It's still plausible that one can pull a trick like that to introduce malicious code into the repo, but improbable.

Re:A new hash algorithm for Git by tialaramex on Tuesday February 04, 2020 @04:21AM (#22233742)
This makes no sense. The collision manufacture algorithm of course produces the same length output in both the A and B documents. Doing otherwise would be considerably harder in fact.
Re:A new hash algorithm for Git by acidictadpole on Tuesday February 04, 2020 @10:34AM (#22236685)
The author does seem to concede that hitting all the checkmarks in an attack on git would be pretty tricky:

> An attacker would not just have to do that, though; this new version would have to contain the desired hostile code, still function as a working floppy driver, and not look like an obfuscated C code contest entry

The whole idea is that they want to switch away before these things become likely. They are unlikely now, but SHA-1 is only getting weaker as time goes by and more research is done.

Re:A new hash algorithm for Git by pdonis on Tuesday February 04, 2020 @11:59AM (#22237923)
> and not look like an obfuscated C code contest entry

The full quote here is even better:

"and not look like an obfuscated C code contest entry (at least not more than it already does)."

Re:A new hash algorithm for Git by xxs on Tuesday February 04, 2020 @04:49AM (#22233904)
Length actually is already part of the hash result... and the sha-1 collision uses the same length pdfs.
Re:A new hash algorithm for Git by upofadown on Tuesday February 04, 2020 @08:10AM (#22235092)
To make the collision work you need to produce two different files, both with some randomish looking junk in them. So if you can do that in a way where you can substitute one of the files for the other without getting caught then you are almost for sure smart enough to also figure out a way to make the lengths the same.
Re:A new hash algorithm for Git by phaemon on Tuesday February 04, 2020 @06:34AM (#22234446)
As mentioned, the shattered PDFs[1] have the same length, however it's worth noting that adding the Git header breaks the matching, ie. you get different SHA sums for the files in Git because of the header.

[1] https://shattered.io/

Re:A new hash algorithm for Git by kzrdude on Tuesday February 04, 2020 @07:29AM (#22234769)
SHA1 is crumbling. It's being replaced because it is likely to be broken further, in practice.