# 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

Status: published. Published: 2026-12-02. Updated: 2026-12-02.

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.

## Remediation

- fix: Upgrade to add-and-commit 11.0.0 or later, which validates new_branch with assertValidBranchName() before using it. On an affected version, do not derive new_branch from a value an outside contributor controls, such as a head branch name; where it has to be dynamic, reject any value beginning with a hyphen in a preceding step. (source: CNA: Secur0)
- fix: The reporting source identifies this reference as a patch. Check the advisory for affected versions and supported release branches. (source: CNA: Secur0) — https://github.com/EndBug/add-and-commit/commit/b4a0134716b4bf226c6b957f03ee862e961afd8d
- fix: The reporting source identifies this reference as a patch. Check the advisory for affected versions and supported release branches. (source: CNA: Secur0) — https://github.com/EndBug/add-and-commit/pull/755

## Affected products and versions

- EndBug / add-and-commit (endbug/add-and-commit): ≥ 5.0.0; < 11.0.0 (affected, semver). Source: CNA: Secur0

## Severity and prioritization

- CVSS 4.0: 6.3 (medium); 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; source: CNA: Secur0

- CISA KEV: No listing in collected sources

- EPSS: Not available

- SSVC: exploitation none; automatable yes; technical impact partial; source ADP: CISA-ADP

- Weaknesses: CWE-88

## Exploit evidence

No exploit evidence in collected sources. This is not proof of no exploitation.

## References

- https://github.com/EndBug/add-and-commit/commit/b4a0134716b4bf226c6b957f03ee862e961afd8d (CNA: Secur0; patch)

- https://github.com/EndBug/add-and-commit/pull/755 (CNA: Secur0; patch)

- https://github.com/EndBug/add-and-commit/releases/tag/v11.0.0 (CNA: Secur0; release-notes)

- https://secur0.com/en/cna/cve-list/cve-2026-142541-add-and-commit-git-argument-injection (CNA: Secur0; third-party-advisory, technical-description)

## Provenance

- CNA: Secur0: https://www.cve.org/CVERecord?id=CVE-2026-142541; retrieved 2026-12-02; source updated 2026-12-02

Revision: 3dcfeaa0796191165fd14f2a4ac8ef93e5f255665c60b9e73b02d9e634f99b30

Canonical: https://y2.dev/cve/CVE-2026-142541

## Agent and API access

Public CVE pages, Markdown, and JSON are free to read without an account or API key.

- Public catalog: https://y2.dev/cve/index.json. Follow nextCursor with the same search, filters, sort, and limit (1–100). A null cursor marks the end.

- WebMCP: search_cve_disclosures, get_cve_disclosure, get_cve_page_markdown, get_y2_cve_access. Available in compatible browsers.

- Cyber API: https://api.y2.dev/api/v2/cyber/cves and https://api.y2.dev/api/v2/cyber/cves/{cveId}.

- Y2 Pro or Elite: create a workspace API key with the intel:cyber scope and send Authorization: Bearer <Y2_API_KEY>. Setup: https://y2.dev/docs/api/create-key.

- x402: Pay per request without an account or API key. Omit Authorization, read the HTTP 402 PAYMENT-REQUIRED challenge, validate its current requirements, and retry with PAYMENT-SIGNATURE through an authorized payment client. These browser tools never make payments. Guide: https://y2.dev/docs/api/x402.

- OpenAPI: https://y2.dev/api/openapi.yaml. Agent access metadata: https://y2.dev/cve/agent.json.

Collected public records only. Check source status for coverage and freshness.