Skip to content
Misconfiguration Write-up Advanced

Git Arbitrary Configuration Injection (CVE-2023-29007)

Git's configuration file handling had a logic error where long configuration values were misinterpreted as new sections when renaming or deleting sections. An attacker could inject arbitrary configuration into a user's .git/config, potentially leading to code execution via settings like core.pager or core.editor.

André Baptista Follow

Published on blog.ethiack.com

Git’s implementation used to rename or delete sections of a configuration file contained a logic error that resulted in improperly treating configuration values longer than a fixed length as containing new sections.

Ethiack, on blog.ethiack.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

This could lead to arbitrary code execution via configuration values that specify executables, but exploiting it requires user interaction via legitimate git commands.

What the attacker needed

User runs git submodule init or deinit; malicious .gitmodules file

The fix

Git project released new versions with the patch.

How it was found

  1. Create a .gitmodules file with an overly long submodule URL that contains a '[' character after spaces.
  2. Run git submodule init or deinit to trigger the vulnerable function.
  3. The .git/config file will have a new section created from the submodule URL.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Git stores settings in a file called .git/config. A bug in how Git edited this file meant that a very long value, like a submodule URL, could be mistaken for a new setting. An attacker could use this to add harmful settings that run commands when the user performs certain Git actions.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.