TLDR Tech / InfoSec
Phantom Patch
Researcher Egor Kovetskiy demonstrated that GitHub's .patch URL export embeds the full commit message inline with the real diff, so when an unsuspecting user runs the common wget patch workflow, GNU patch parses diff-shaped text smuggled into the commit message and applies it as if it were part of the legitimate change — in his public reproducer, creating an out-of-scope SHOULD_NOT_BE_HERE.md that GitHub's UI never shows. Local testing escalated the impact: GNU patch accepted writes to .git/hooks/post-applypatch (silent code execution on the next git am), while git apply and git am rejected the .git/... traversal but still applied injected diffs to ordinary working-tree files. Only git cherry-pick, which operates on Git objects, was unaffected. Defenders should stop piping .patch URLs straight into patch -p1, prefer git am or git cherry-pick from a trusted local clone, inspect commit messages for embedded diff --git markers before applying, and audit CI and bot pipelines that auto-fetch GitHub .patch files for this injection vector.
Read the full story