Skip to content

add-and-commit

A branch name beginning with a hyphen is parsed as a git option by add-and-commit, allowing a forced overwrite of remote history

CVE-2026-142541Published 2 Dec 2026, 19:18 UTC

Real-world risk

1.1/ 10Low

Routine

If the vulnerable configuration applies to you: 2.6

PreliminaryFrom the CVSS vector only · confidence low

CVSS

6.3

scored by the vendor (CNA), CVSS 4.0

In plain words

No plain-language summary yet. The original description is below.

Original description (from Secur0)

Improper Neutralization of Argument Delimiters in a Command (CWE-88) in add-and-commit from 5.0.0 before 11.0.0 allows a party who controls the branch name a workflow passes to the action to run git checkout and git push with an option of their choosing. The new_branch input, called branch before 8.0.0, is used as a single positional value and is never passed through matchGitArgs() or validated, unlike the inputs the README documents as taking raw git arguments. src/main.ts hands it to simple-git's checkout(), which builds the argument vector ['checkout', value], and on the default push path to push(), which builds ['push', 'origin', value, '--set-upstream']. git parses every element of its argument vector for a leading hyphen wherever it appears, so a value of --force is taken as the option and not as a branch name. The two commands become git checkout --force, which discards the staged changes the action was about to commit, and git push origin --force --set-upstream, which overwrites the remote branch with the runner's local state and removes from its history any commits pushed since that checkout. git's reference name rules permit a leading hyphen, so a branch named --force can be created and pushed to a fork with git push origin HEAD:refs/heads/--force, although the git branch porcelain refuses such a name; a workflow that derives new_branch from a head branch name therefore takes the value from whoever opened the pull request. The action reports committed and pushed as true and logs that the branch already existed.

Am I affected?

ProductAffected versions (from the sources)Fixed in
add-and-commitNiche>= 5.0.0, < 11.0.011.0.0

What to do

Update to a fixed version: 11.0.0.

Why this score

FactorValueEvidence×
ImpactMinorReflected XSS, CSRF with low effect, open redirect, minor leakFrom the CVSS vector0.30
Attacker positionInternetAnyone on the Internet can reach a typical deploymentFrom the CVSS vector1.00
Privileges neededNoneNo accountFrom the CVSS vector1.00
Victim interactionNoneNothingFrom the CVSS vector1.00
ConfigurationUncommonNeeds a non-default feature that a minority enablesFrom the CVSS vector0.45
ReliabilityReliableDeterministic: injection, logic bug, path traversalFrom the CVSS vector1.00

Threat level T1: Nothing known (× 0.85)

The default for a new disclosure

The arithmetic
  1. Prerequisites multiplied together0.450
  2. Threat T1: Nothing known0.850
  3. 10 × impact 0.3 × prerequisites 0.45 × threat 0.851.147
  4. Rounded to one decimal between 0.1 and 101.1

How the score works

Exploitation and evidence timeline

  1. 2 Dec 2026 Published
  2. 2 Dec 2026 Risk 1.1 (cvss fallback)

Weakness

CWE-88

References

Get alerts for add-and-commit

Free email or text alerts when a vulnerability in add-and-commit reaches risk 8 or higher. Nothing else.