git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Demi M. Obenour" <athena@invisiblethingslab.com>
To: Git <git@vger.kernel.org>
Subject: check_refname_format allows refs with components that begin with -, even though `git tag` does not
Date: Tue, 10 Nov 2020 14:32:04 -0500	[thread overview]
Message-ID: <c926193b-a328-7562-6d4b-1ab2765c8cca@invisiblethingslab.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 927 bytes --]

If I try to create a Git tag with a name beginning with `-`,
Git complains.  However, Git does not check that a repository does
not have tags containing `-`.  This almost led to a vulnerability
in the QubesOS `verify-git-tag` script.  Fortunately, this was not
exploitable, as neither `git tag -v`, `git verify-tag --raw`, nor
`git describe` have options that are useful to an attacker.

Since this could cause vulnerabilities in other programs, I initially
reported it as an embargoed security bug, but was told to post it
publicly.

The best idea I had for a fix is to print names beginning with `-`
using the fully-qualified form, such as "refs/tags/-a".  Also, `--`
is used as a delimiter in many commands, and can’t be escaped,
so disallowing it might be a good idea.

In the long run, I hope to see leading dashes banned entirely, but
backwards compatibility might prevent that.

Sincerely,

Demi

[-- Attachment #1.1.2: OpenPGP_0xB288B55FFF9C22C1.asc --]
[-- Type: application/pgp-keys, Size: 4041 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2020-11-10 19:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 19:32 Demi M. Obenour [this message]
2020-11-10 20:09 ` check_refname_format allows refs with components that begin with -, even though `git tag` does not Junio C Hamano
2020-11-10 21:35   ` Jeff King
2020-11-10 21:37     ` [PATCH 1/3] rev-parse: don't accept options after dashdash Jeff King
2020-11-10 21:38     ` [PATCH 2/3] rev-parse: put all options under the "-" check Jeff King
2020-11-10 21:40     ` [PATCH 3/3] rev-parse: handle --end-of-options Jeff King
2020-11-10 22:23       ` Junio C Hamano
2020-11-10 22:28         ` Demi M. Obenour
2020-11-11  2:22         ` Jeff King
2020-11-10 21:33 ` check_refname_format allows refs with components that begin with -, even though `git tag` does not Ævar Arnfjörð Bjarmason

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=c926193b-a328-7562-6d4b-1ab2765c8cca@invisiblethingslab.com \
    --to=athena@invisiblethingslab.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).