PostHog / PostHog/warlock

New rule: detect git remote set-url / git remote add (remote hijacking)

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Context

From Piccirello's review on PR #13 — if someone changes where origin points with git remote set-url origin <evil-url>, then a normal git push origin silently sends code to the attacker.

What to catch

  • git remote set-url origin <url>
  • git remote add origin <url> (or any remote name)
  • .git/config modifications that change remote URLs

Considerations

  • Changing a remote URL is sometimes legitimate (switching from HTTPS to SSH, updating a fork URL).
  • Severity should probably be high + warn since there are legit use cases, but it's a real exfil vector.
  • Related to the existing exfiltration_git_push_non_origin rule — could be a new pattern in that rule or a standalone.

Origin

PR #13 review comment by @Piccirello

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing exfiltration_git_push_non_origin rule and the context from PR #13. Trace how command patterns and .git/config changes are represented, then define tests for git remote set-url, git remote add, and remote URL modifications; done means these cases are detected without treating ordinary remote changes as unconditionally malicious.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.