# 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

- **Severity:** MEDIUM 6.3
- **CVSS:** 6.3 (v4.0, CNA) `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Attack requirements: Present; Privileges required: None; User interaction: None; Confidentiality impact: None; Integrity impact: Low; Availability impact: None; Confidentiality impact on other systems: Low; Integrity impact on other systems: Low; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **CWE:** CWE-88
- **Published:** 2026-12-02T19:18:50.070Z
- **Modified:** 2026-12-02T22:18:35.580Z

> **AI summary (AI-generated, claude-haiku-5-5):** An attacker who controls a branch name passed to add-and-commit can inject git options, forcing checkout and push that overwrite remote branch history.

## Who should check

- Anyone running EndBug add-and-commit \>= 5.0.0, \< 11.0.0

## Description

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.

## Affected and fixed versions

- EndBug add-and-commit: \>= 5.0.0, \< 11.0.0 (cvelist)

## Technologies

GitHub Actions (AI-matched)

## Mitigation

- Upgrade add-and-commit to 11.0.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-142541. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-142541.md
Affected: EndBug add-and-commit >= 5.0.0, < 11.0.0
Fixed in: EndBug add-and-commit 11.0.0

Steps:
1. Search this machine and project for EndBug add-and-commit: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-142541 being exploited?

There is no confirmed exploitation: CVE-2026-142541 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is CVE-2026-142541?

Medium: CVSS 6.3 (v4.0, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2026-142541?

EndBug add-and-commit \>= 5.0.0, \< 11.0.0.

### Is there a fix for CVE-2026-142541?

Yes. Fixed in EndBug add-and-commit 11.0.0. Upgrade add-and-commit to 11.0.0 or later.

### How do I check if I'm affected by CVE-2026-142541?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://github.com/EndBug/add-and-commit/commit/b4a0134716b4bf226c6b957f03ee862e961afd8d>
- patch: <https://github.com/EndBug/add-and-commit/pull/755>
- article: <https://secur0.com/en/cna/cve-list/cve-2026-142541-add-and-commit-git-argument-injection>
- other: <https://github.com/EndBug/add-and-commit/releases/tag/v11.0.0>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-142541>

HTML: <https://flawdb.com/CVE-2026-142541> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-142541>
