Gentoo Archives: gentoo-dev

From: "Tomáš Pružina" <tomas.pruzina@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] git security (SHA-1)
Date: Mon, 15 Sep 2014 11:39:45
Message-Id: CAHN-SfQhk_HeeW+u6ipvSAzhbLfHsv-oagL197ETAxHy+J0QDg@mail.gmail.com
1 On Mon, Sep 15, 2014 at 12:35 PM, hasufell <hasufell@g.o> wrote:
2 > Jauhien Piatlicki:
3 >> Hi,
4 >>
5 >> On 09/15/2014 01:37 AM, Kent Fredric wrote:
6 >>> On 15 September 2014 11:25, hasufell <hasufell@g.o> wrote:
7 >>>
8 >>>> Robin said
9 >>>>> The Git commit-signing design explicitly signs the entire commit,
10 >>>> including blob contents, to avoid this security problem.
11 >>>>
12 >>>> Is this correct or not?
13 >>>>
14 >>>
15 >>> I can verify a commit by hand with only the commit object and gpg, but
16 >>> without any of the trees or parents.
17 >>>
18 >>> https://gist.github.com/kentfredric/8448fe55ffab7d314ecb
19 >>>
20 >>>
21 >>
22 >> So signing of git commits does not guarantee enough security (taking
23 >> that SHA1 is weak and can be broken), right? Could we than just use
24 >> usual (not thin) manifests?
25 >>
26 >
27 > * there is no known SHA-1 collision afais
28 > * calculating one isn't that hard. NSA might be able to do it in
29 > reasonable time
30 > * however, the algorithms to do that will come up with random garbage,
31 > so it's a completely different thing to hide a useful vulnerability
32 > behind a SHA-1 collision
33 >
34
35 sha-1 has is not directly a security feature, rather merely consistency
36 check (albeit it has some security implications).
37
38 hash is generated by using hash of commit parent and is checked every time
39 you pull. You can actually take master commit and hash and then recursively
40 check whole tree (albeit only basic check from current head parent is done
41 when you pull, assuming that local tree is intact).
42
43 Corrupting a single commit should be easy enough, but since the system is
44 decentralised, people who you pull from should catch that attempt
45 automagically.
46
47 At least that's my understanding of how git (mercurial) works.
48
49 Linus himself sums it nicely here:
50
51 https://www.youtube.com/watch?feature=player_detailpage&v=4XpnKHJAok8#t=3375
52
53
54 T.P.