Re:SHA-1 'fully and practically broken' by new collision (2020)
by garmaine on Tuesday October 12, 2021 @10:46PM
(#28847668)
It doesn't take any money or time. Google's break of SHA-1 was fully reusable. So long as committing a PDF to the repo counts, there's a script that will trivially concat two PDFs in such a way as that they each render to their original (different) contents, but both have the same SHA-1 hash. Put in a repo and `git add foo.pdf` and you're done.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by marcan_42 on Tuesday October 12, 2021 @10:55PM
(#28847720)
Nope. Google's break of SHA-1 was reusable in the sense that you can add an arbitrary (identical) suffix to both PDFs and keep the collision. But Git does not use raw SHA-1 hashes, it adds a prefix before computing object hashes. Therefore, Google's break of SHA-1 cannot be reused to break Git.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by outworlder on Tuesday October 12, 2021 @05:04PM
(#28845061)
> presumably you can later substitute the initial commit with the other one without anybody being able to detect the substitution.
How? Which operation would be involved? Will it not show anywhere else(reflog)?
Re:SHA-1 'fully and practically broken' by new collision (2020)
by formerly_proven on Tuesday October 12, 2021 @05:14PM
(#28845173)
The reflog shows changes to references. References are hashes. Git is CAS, and uses the CAS assumption: H(m1) = H(M2) <=> m1 = m2.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by filmor on Wednesday October 13, 2021 @02:50AM
(#28848983)
What do you mean by "CAS"?
Re:SHA-1 'fully and practically broken' by new collision (2020)
by smsm42 on Wednesday October 13, 2021 @02:58AM
(#28849037)
I think it means Content Addressable Storage - https://en.wikipedia.org/wiki/Content-addressable_storage
In short, it's a method of storage where object's identity is derived from object's content (usually via hashing it). So the assumption is: same hash => same content => same object.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by slim on Wednesday October 13, 2021 @03:24AM
(#28849262)
By replacing the file on disk (you need to have the capability of acquiring access to the server)
Re:SHA-1 'fully and practically broken' by new collision (2020)
by adrian_b on Tuesday October 12, 2021 @05:11PM
(#28845145)
Because such an operation is unlikely to succeed even if the hashes match, replacing SHA-1 was not a high priority for Git.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by noway421 on Tuesday October 12, 2021 @05:14PM
(#28845170)
`git push --force` I assume. In GitHub, this will leave a trail of events though - Webhook events and auditing.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by DSMan195276 on Tuesday October 12, 2021 @06:21PM
(#28845788)
I would think it's not that simple because `git push --force` doesn't do anything if it thinks the histories are the same, and in this case we've created a history that appears to be the same. You'd likely need a custom git client (which isn't a problem) but I don't know enough about the internals of a git push to know if the server would even accept objects if they match hashes of objects it already has (it may just go "I don't need that" and ignore it, because what's the point in doing anything with it?). Presumably it would depend on the exact server implementation whether you could get it to replace an existing object with a "new" one which is actually the same hash, but frankly I think that's unlikely because it would be pointless work from the view of the server. If it does happen I'm not sure what auditing you would actually be able to see, webhooks and such might not be triggered because the history didn't actually "change".
What you could do however is just host it yourself somewhere else, say put it on a fork. Or if you have access to the actual repository hosting the original version, you could just manually replace it yourself. git clients aren't going to just automatically pull the "new" version though so you'll have some combo of people with the old and people with the new, and it gets a little messier from there.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by sverhagen on Tuesday October 12, 2021 @06:37PM
(#28845972)
If you can force push, why would you then not push a different commit before pushing your updated commit with the same, original hash, or does that also not work?
Re:SHA-1 'fully and practically broken' by new collision (2020)
by DSMan195276 on Tuesday October 12, 2021 @07:06PM
(#28846211)
I wouldn't expect that to work reliably because git doesn't actively remove unused objects from the store, hence why you can do `git reflog` to go find stuff that's not actually referenced anywhere anymore. `git gc` is necessary to make them actually go away, and whether that ever happens and how often is up to the server. I know for example that Github practically never does it, and even if it did happen it would be hard to reliably ensure no references to the relevant object still exist anywhere on the server. For example, you would have to force push every branch on the server that references the object, and if the git server creates branches for internal use you might not be able to touch those or convince the server the object is unused. And even if all the references are gone if the object is never actually deleted from the server then it should just get used again if you try to do a `git push`.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by atdt on Tuesday October 12, 2021 @07:03PM
(#28846185)
By default Git keeps inaccessible/orphaned objects for two weeks before they are garbage-collected.
Re:SHA-1 'fully and practically broken' by new collision (2020)
by cerved on Wednesday October 13, 2021 @03:40AM
(#28849381)
force push only updates a remote ref if it's not a fast forward. it doesn't do any forced pushing of objects.
you need to modify the object store manually, so access to the filesystem
Re:SHA-1 'fully and practically broken' by new collision (2020)
by radishingr on Wednesday October 13, 2021 @05:42AM
(#28850156)
I believe it let's you substitute an entire chain of commits based on some starting commit.
What is possible now is something that is much easier: if you have enough money and time, you can create 2 commits with the same hash, which start with some different parts, which may be chosen arbitrarily, then they have to include some parts that must be computed to ensure that the hashes will match and which will be gibberish that might be disguised in some constants or some binary blob, if possible.
Then you can commit one of them and presumably you can later substitute the initial commit with the other one without anybody being able to detect the substitution.