git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-daemon is insecure? (was: [RFC] Secure central repositories)

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 28, 2008, 00:16 UTC
Message-ID
<20080128001655.GY24004@spearce.org>
In-Reply-To
<7vsl0ix4gh.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > This change allows any repository owner to setup a git-daemon
> > that other users on the same host can connect through to perform
> > upload-pack or receive-pack.
> 
> My reading of this is that it creates a backdoor for people who
[...]
Show 10 quoted lines
> In addition to having to worry about
> the in-repo data properly being protected from people outside
> the group, you now need to worry about the access through that
> backdoor does not extend outside of the repository.  E.g. the
> repository owner's $HOME that is outside the repository would be
> writable that owner, but is not meant to be accessible by
> project participants.  If you allow others to "run as" you, the
> only thing that forbids that process running as you from
> accessing $HOME is an additional audit of git-daemon and the
> programs it spawns.

So you are partially suggesting that git-daemon isn't thought to be secure, and that anything readable by the user that git-daemon is running as is fully exposed to the public Internet. So the access control attempts relating to --base-path or the check for git-daemon-export-ok shouldn't really be trusted or relied upon.

If that really is the case, perhaps git-daemon should be audited and hardened further. Last I checked, we encouraged people to run it to offer anonymous access to repositories, and the documentation suggests there are publishing access controls that actually work. If those controls cannot be trusted then we shouldn't encourage running git-daemon on untrusted networks.

With regards to this patch, yes, you can export your entire $HOME and maybe expose things you shouldn't or didn't want to. But even without git installed you could do this:

	cp /bin/bash /tmp/be-like-mike
	chown $USER /tmp/be-like-mike
	chmod 777 /tmp/be-like-mike
	chmod u+s /tmp/be-like-mike
	wall "try out /tmp/be-like-mike today"

but why would anyone do something that foolish? UNIX provides the tools to do this, because there are cases where it can be useful, but really, you have to be nuts to export all of $HOME.

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 16 in “[RFC] Secure central repositories by UNIX socket authentication”
  1. Shawn O. PearceJan 27, 2008
  2. Johannes SchindelinJan 27, 2008
  3. Shawn O. PearceJan 27, 2008
  4. Johannes SchindelinJan 27, 2008
  5. Shawn O. PearceJan 28, 2008
  6. Dmitry PotapovJan 28, 2008
  7. Junio C HamanoJan 27, 2008
  8. git-daemon is insecure? (was: [RFC] Secure central repositories)Shawn O. Pearce, Jan 28, 2008
  9. Junio C HamanoJan 28, 2008
  10. Shawn O. PearceJan 28, 2008
  11. Shawn O. PearceJan 28, 2008
  12. Junio C HamanoJan 28, 2008
  13. Shawn O. PearceJan 28, 2008
  14. Asheesh LaroiaJan 28, 2008
  15. Shawn O. PearceJan 29, 2008
  16. Shawn O. PearceJan 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.