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

Published Dec 2, 2026
·
Updated

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 newbranch 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 newbranch 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.

Affected Software

1 affected component
EndBug add-and-commit>=5.0.0<11.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade add-and-commit to a version that resolves this vulnerability.

    Fixed in 11.0.0
  2. Compensating control

    On affected versions, do not derive new_branch (called branch before 8.0.0) from a value controlled by an outside contributor; if it must be dynamic, reject values beginning with a hyphen in a preceding workflow step.

Event History

Dec 2, 2026
CVE Published
via MITRE·07:18 PM
Data Sourced
via MITRE·07:18 PM
RemedyDescriptionWeakness
Data Sourced
via OSV·07:18 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:20 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which versions need attention?

Versions from 5.0.0 before 11.0.0 are affected. Upgrade to 11.0.0 or later.

2

What must an attacker control to exploit this?

The attacker must be able to control the branch name supplied to the action’s new_branch input, called branch before version 8.0.0. A leading-hyphen value such as --force is interpreted by Git as an option rather than a branch name.

3

Is the normal push behavior affected?

Yes. The default push path constructs a Git push command that places the supplied branch value after origin, where Git still parses a leading-hyphen value as an option. This can turn the push into a forced update.

4

What is the practical impact of a successful exploit?

The checkout can discard the staged changes the action was preparing to commit. The subsequent forced push can overwrite the remote branch with the runner’s local state and remove commits pushed since the checkout from that branch’s history.

5

How can teams identify potentially exposed workflows?

Review workflows using affected versions for cases where new_branch, or branch in versions before 8.0.0, is derived from a party-controlled branch name. Workflows that pass only fixed, trusted branch values are not described as having the required attacker-controlled input.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203