If someone can change a committed file inside a git repository , the main problem is that your system is FUBAR. Let's say I'm the attacker and I'm inside I can change committed files and I can generate a collision for each. If my goal is to deface the repository I can insert file with gibberish, i.e. I have a file with source code:
But wait, why should waste 1000 GPU to deface a Git repository when I can simply delete it. I can change the files, I can delete it. It's simply stupid.
An attack with a sense is to change this:
ptr=calloc(SIZE, sizeof(long));
inserting:
ptr=calloc(SIZE-10, sizeof(long));
Now I have a BOF, same hash, only a code review can find the fraudulent change.
This is beyond "I make a collision inserting commented gibberish" , like this:
// adojwqf'pjqeworivhneq;lnvl;dqjnfvljeqrvneljvn
You have to insert a change that works and implement an attack making it invisible.
Good luck with that. I also read in some comments some AI nonsense I find Star Trek bullshit.
> If you still insist on a working example pay me $125k and I'll produce one for you
Even with 100M$ budget, you can't.
But why I even want to do that ? I have access, I can replace the whole repo with one full of exploitable bugs !
So the initial question: "If I change sha-1 in Git with some newer version, is that a security improvement?" . I feel the the answer is "NO".
This is bullshit. Really. If you have only to "name a a commit" you can use a sequence from 0 to N. Why someone should waste computation power to calculate an hash that's also a naming system really not user friendly? Think about it.
The correct answer is to signing the commit AND for database indexing:
"Git uses hashes in two important ways.
When you commit a file into your repository, Git calculates and remembers the hash of the contents of the file. When you later retrieve the file, Git can verify that the hash of the data being retrieved exactly matches the hash that was computed when it was stored. In this fashion, the hash serves as an integrity checksum, ensuring that the data has not been corrupted or altered.
For example, if somebody were to hack the DVCS repository such that the contents of file2.txt were changed to “Fred”, retrieval of that file would cause an error because the software would detect that the SHA-1 digest for “Fred” is not 63ae94dae606…
Git also uses hash digests as database keys for looking up files and data.
If you ask Git for the contents of file2.txt, it will first look up its previously computed digest for the contents of that file[45], which is 63ae94dae606… Then it looks in the repository for the data associated with that value and returns “Erik” as the result. (For the moment, you should try to ignore the fact that we just used a 40 character hex string as the database key for four characters of data.)"
... omissis ...
ptr=calloc(SIZE, sizeof(long));
... etc ...
then I have :
aDjw'pfojqe'rf[24oijgfpoemgl;m,g02ir-9u13]9fu24[efgje2ioprn
Same sha1 hash.
But wait, why should waste 1000 GPU to deface a Git repository when I can simply delete it. I can change the files, I can delete it. It's simply stupid.
An attack with a sense is to change this:
ptr=calloc(SIZE, sizeof(long));
inserting:
ptr=calloc(SIZE-10, sizeof(long));
Now I have a BOF, same hash, only a code review can find the fraudulent change.
This is beyond "I make a collision inserting commented gibberish" , like this:
// adojwqf'pjqeworivhneq;lnvl;dqjnfvljeqrvneljvn
You have to insert a change that works and implement an attack making it invisible.
Good luck with that. I also read in some comments some AI nonsense I find Star Trek bullshit.
> If you still insist on a working example pay me $125k and I'll produce one for you
Even with 100M$ budget, you can't.
But why I even want to do that ? I have access, I can replace the whole repo with one full of exploitable bugs !
So the initial question: "If I change sha-1 in Git with some newer version, is that a security improvement?" . I feel the the answer is "NO".