git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Git Mailing List <git@vger.kernel.org>,
	David Roundy <roundyd@physics.oregonstate.edu>
Subject: Re: insecurity in verify-tag?
Date: Wed, 25 Nov 2009 13:54:53 +0100	[thread overview]
Message-ID: <4B0D291D.4060100@drmicha.warpmail.net> (raw)
In-Reply-To: <117f2cc80911240856lbbb923buc7d0407bc2cba6a9@mail.gmail.com>

David Roundy venit, vidit, dixit 24.11.2009 17:56:
> I've just been looking at the code and I see what looks like a (minor)
> security hole in the verify-tag feature.  In particular, the tag
> verification code doesn't check that the tag is signed by the same
> user that created the tag.  To be fair, gpg does output the identity
> of the key that created the signature as well as the key used to
> create the signature, so an astute user could detect that some
> shenanigans is going on.
> 
> An attack would simply require getting one's own public key into the
> keyring of a user.  This probably wouldn't be very easy at the moment,
> but if people were to actually use encrypted email (and if they set
> their mail agents to download public keys), it might require no more
> then sending a signed email to a mailing list.
> 
> Of course, you'd also somehow have to trick them into pulling (or
> cloning) your corrupt tag, which probably requires compromising a
> server (or mirror) somewhere.  But of course, the whole point of
> signing tags is to eliminate precisely this danger.
> 
> What should be done about this? First, there ought to be a feature to
> limit git verify-tag to use a specific keyring.  Maybe there is an
> environment variable, and it's just not documented in the man page?
> 
> It would also seem like a good idea to at a minimum check that the
> name/email associated with the signature is the same as that of the
> tagger.  This doesn't gain you *too* much, since an attacker can
> always create his own key with any name and email he likes, but at
> least it means that users could feel safe adding keys to their public
> keyring, as long as those keys have reasonable names/emails associated
> with them, and as long as they run git show on a tag before trusting
> that that tag came from a particular person.  i.e. it seems reasonable
> for me to expect that if I run:
> 
> $ git show v1.0
> tag v1.0
> Tagger: Linus Torvalds ...
> ...
> [user carefully reads the Tagger line...]
> $ git verify-tag v1.0 && make
> 
> That I won't be running make on a repository that wasn't signed by a
> key that at least *claims* to belong to Linus Torvalds.
> 
> Thoughts?

My thought is that this is the wrong way to deal with signatures, be it
signatures on tags or signatures on other documents such as e-mails.

Everyone can produce a valid signature. Everyone can set an arbitrary
tagger name or commit author. They are meaningless. A "Tagger" really is
the committer of a tag object, whereas the signer is the actual author
of the signature.

The only case where a signature bears any value is when

- the signature is valid (in the sense of formal validity)
AND
- you trust the signer (i.e. the person and the key).

Specifically, you are supposed NOT to go by the return code of gpg
--verify (which is behind verify-tag). It doesn't mean all that much. On
a side note, that was an attack vector on gpg users last year or so.

All that git itself could do is compare the tagger and the signer, and
warn you if they differ, that is: the signer's key contains no uid
matching the tagger. But this piece of information is really orthogonal
to the issue of trustworthiness.

Note that the actual signature verification process depends also on the
gpg trust model (pgp/classic/...) that you're using and your trustdb. If
you want to use a specific gpg setup or keyring for tag purposes you can
do something like

GNUPGHOME=~/.gpgforgit git verify-tag v1.6.5

Michael

      reply	other threads:[~2009-11-25 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 16:56 insecurity in verify-tag? David Roundy
2009-11-25 12:54 ` Michael J Gruber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0D291D.4060100@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=roundyd@physics.oregonstate.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).