Live data from Hacker News

Git security vulnerability announced

github.blog

291–300 of 302 posts

Re: Git security vulnerability announced

#291

Earlier quoted context omitted.

This is really dismissive. Unexpected execution is not a users fault, and can happen for a variety of reasons (you telling me you’ve never unzipped a full git path someone sent you?)

Hi! I can cheerfully confirm that I've absolutely never: - received a git repo as an archive from someone, and then - changed to root with "su" before unpacking it somewhere, such that - the chosen location was above the home directory layer of a multi-user system. - in such a way that one of the directories of the /path/to/home path has a .git/ subdirectory as a direct child, and not as an unpacked-tarball/.git gran…

Good for you. You are not everyone.

Re: Git security vulnerability announced

#292

> Run the uninstaller under an administrator account rather than as the SYSTEM user How do I run something as SYSTEM? I thought I always ran as "me" or Administrator. Is this only likely to happen for deployment automation tools? > Avoid running the uninstaller until after upgrading Don't leave us with this cliff-hanger... Does the upgrade installer run the uninstaller first? (The original report doesn't have this bu…

IIRC startup scripts and such are run under SYSTEM. Some orgs have incredibly awful startup scripts that take minutes, it's not impossible that one of them has a script of "git-uninstall.exe && git-install.exe" to "ensure" git is installed.

Re: Git security vulnerability announced

#293

Earlier quoted context omitted.

In a company with 10000 computers you don't want to have an IT person walk to each of them to roll out new software or install an update. Sure, attackers would have a harder time, but IT departments would also have to be orders of magnitude larger

Humor me for a second: why not have them install the software themselves?

Probably because most of the users were hired to do accounting, legal work, advertising, etc., not to provide IT support.

Re: Git security vulnerability announced

#294
post #69

Earlier quoted context omitted.

You don't have to trust repos you clone, if I understand correctly. You just need to trust ones you're given in other ways. The difference is, clone won't let you set up arbitrary config (or malformed internal data or etc.)

Can you store a .git/config filepath in a git repository, either via the cli or manually hacking the repo data files?

No.

I think long ago there may have been some bug that allowed it with a hacked repo, so it's not a ridiculous thing to consider, but no git won't let you and any way you could would be a major CVE.

Re: Git security vulnerability announced

#295

Earlier quoted context omitted.

In a company with 10000 computers you don't want to have an IT person walk to each of them to roll out new software or install an update. Sure, attackers would have a harder time, but IT departments would also have to be orders of magnitude larger

Humor me for a second: why not have them install the software themselves?

You must not work in IT with end users.

Re: Git security vulnerability announced

#296
post #57

Earlier quoted context omitted.

Looks like git complains of invalid paths when you try that.

Just because the cli won’t add doesn’t mean it may not be possible.

I was able to manually construct a commit with a .git subdirectory using `git mktree` and `git commit-tree`, but Git still refused to create the .git subdirectory in the index or working copy:

  [testrepo]$ git checkout --orphan test-branch
  
  [testrepo]$ git update-ref HEAD f4da9cde406a7b80d99694b5f8d369a8dd6e5a7d
  
  [testrepo]$ git ls-tree -r HEAD
  100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    a/.git/config

  [testrepo]$ git show
  commit f4da9cde406a7b80d99694b5f8d369a8dd6e5a7d (HEAD -> test-branch)
  Author: >
  Date:   >

      WIP2

  diff --git a/a/.git/config b/a/.git/config
  new file mode 100644
  index 0000000..e69de29

  [testrepo]$ git status
  On branch test-branch
  Changes to be committed:
    (use "git restore --staged ..." to unstage)
          deleted:    a/.git/config

  [testrepo]$ git restore --staged a/.git/config
  error: invalid path 'a/.git/config'
  error: pathspec 'a/.git/config' did not match any file(s) known to git

  [testrepo]$ git reset --hard HEAD
  error: invalid path 'a/.git/config'
  fatal: Could not reset index file to revision 'HEAD'.
So it looks like even if you do try to check out a tree with an unexpected .git subdirectory it won't actually be created in the filesystem.

Re: Git security vulnerability announced

#297

Earlier quoted context omitted.

Hi! I can cheerfully confirm that I've absolutely never: - received a git repo as an archive from someone, and then - changed to root with "su" before unpacking it somewhere, such that - the chosen location was above the home directory layer of a multi-user system. - in such a way that one of the directories of the /path/to/home path has a .git/ subdirectory as a direct child, and not as an unpacked-tarball/.git gran…

Good for you. You are not everyone.

There are far more likely accidents that the superuser can perpetrate, that we do not compensate for with silly logic in applications.

Superuser could download some malware and put it into the system PATH. OK, so let's not execute anything in the PATH, unless it is owned by us.

/bin/ls? Not owned by me, don't trust it.

Re: Git security vulnerability announced

#298

Earlier quoted context omitted.

Good for you. You are not everyone.

There are far more likely accidents that the superuser can perpetrate, that we do not compensate for with silly logic in applications. Superuser could download some malware and put it into the system PATH. OK, so let's not execute anything in the PATH, unless it is owned by us. /bin/ls? Not owned by me, don't trust it.

Okay.

Re: Git security vulnerability announced

#299
post #290

If you can create a .git directory above a victim's home directory, then you're root. Or else, if you're not root, you're in messed up system. Whoever is root should go read some 40-year-old book on Unix about how it's supposed to be laid out. This is not a genuine security vulnerability; though of course, it's good to fix it. Here is how I would fix it. Forget about permissions and ownership entirely. There is a wea…

The issue isn't specific to home directories. /tmp, for example. Your suggestion may protect against accidents, but doesn't seem to me to do anything for deliberately malicious behavior.

Right, so someone could create a malicious /tmp/.git. You then go to /tmp/experiment to do something and run some git commands.

Easy fix: on boot, have the "rc" script create a root-owned /tmp/.git dummy file with r-------- permissions.

Someone can also create a /tmp/foo/.git; but to be susceptible to that, you have to be under /tmp/foo. That's another user's directory. What are you doing in there? Serves you right.

If /tmp/foo is your own, and someone planted a .git into it, that's your problem too: you're creating material in /tmp that is accessible to others, which is a security no-no.

Probably, this should be fixed in the kernel: the kernel should not allow a regular user to create a hidden directory (i.e. name starting with ".") in /tmp. Or probably any hidden object.

Such a fix is more general: it fixes the issue for any git-like program that walks up the tree looking for a special dot directory or file, including all such programs not yet written.

The rule could be general, such that creating a hidden object in a directory is only allowed to the directory's owner, not just to anyone who has write permissions to the directory.

In other words, if multiple users have write access to a directory, such as /tmp, but any other kind of directory, then they are not allowed to perpetrate hidden objects on each other (both because those things don't show up under "ls" without "-a" and because programs find those and react to them).

In fact, I would go one step further and enforce the kernel rule that writing to an existing dot file is denied to anyone other than the owner that file, regardless of its write permissions.

Post reply on HN