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

Re: Can Git repos be hacked or otherwise manipulated?

From
Jeff King <peff@peff.net>
Date
Jan 14, 2020, 22:08 UTC
Message-ID
<20200114220826.GB3957260@coredump.intra.peff.net>
In-Reply-To
<fOv65WlolaWZ638trkwZ6nnWIaRu14wx8bYkLdqzidlHPvhYpg1f6TSa_Z7w7iFEsXSLkMzQ6EYTwo3ggF3oXrDh5U4LM_i2Rzx0BkMh7zI=@protonmail.com>
On Tue, Jan 14, 2020 at 02:48:05PM +0000, 1234dev wrote:
Show 6 quoted lines
> Let's say you're working with a team of elite hackers, passing a
> tarball of a Git repo back and forth as you complete your mission. Now
> let's say one of them has malicious intent. What are the possibilities
> that he or she can, for instance, hide changes made to a script or
> binary that does something malicious if executed? Or perhaps maybe
> there are other such scenarios one should be made aware of?

It is absolutely not safe to run Git commands from a tarball of an untrusted repo. There are many ways to execute arbitrary code specified by a config option, and you'd be getting recipients .git/config. Likewise for hooks.

And while we would consider it a bug if you can trigger a memory error by reading a corrupted or malicious on-disk file, that's gotten _way_ less auditing than the code paths which take in objects from a remote. So e.g., I would not be surprised if there are vulnerabilities that could cause out-of-bounds reads of a corrupted .git/index.

-Peff
Previous: 1234devNext: 1234dev
Message 2 of 6 in “Can Git repos be hacked or otherwise manipulated?”
  1. 1234devJan 14, 2020
  2. Jeff KingJan 14, 2020
  3. 1234devJan 15, 2020
  4. Jonathan NiederJan 15, 2020
  5. Jeff KingJan 15, 2020
  6. Junio C HamanoJan 16, 2020

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.