{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-142541","assignerOrgId":"4daa8cea-433a-44bd-9456-53b127fc289a","state":"PUBLISHED","assignerShortName":"Secur0","dateReserved":"2026-12-02T19:01:36.224Z","datePublished":"2026-12-02T19:18:50.070Z","dateUpdated":"2026-12-02T21:24:36.208Z"},"containers":{"cna":{"providerMetadata":{"orgId":"4daa8cea-433a-44bd-9456-53b127fc289a","shortName":"Secur0","dateUpdated":"2026-12-02T19:18:50.070Z"},"title":"A branch name beginning with a hyphen is parsed as a git option by add-and-commit, allowing a forced overwrite of remote history","problemTypes":[{"descriptions":[{"lang":"en","cweId":"CWE-88","description":"CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')","type":"CWE"}]}],"affected":[{"vendor":"EndBug","product":"add-and-commit","repo":"https://github.com/EndBug/add-and-commit","programFiles":["src/main.ts","src/util.ts"],"versions":[{"status":"affected","version":"5.0.0","lessThan":"11.0.0","versionType":"semver"}],"defaultStatus":"unaffected","cpes":["cpe:2.3:a:endbug:add-and-commit:*:*:*:*:*:*:*:*"],"packageURL":"pkg:github/endbug/add-and-commit"}],"cpeApplicability":[{"operator":"OR","nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:a:endbug:add-and-commit:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0.0","versionEndExcluding":"11.0.0"}]}]}],"descriptions":[{"lang":"en","value":"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.","supportingMedia":[{"type":"text/html","base64":false,"value":"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 <code>git checkout</code> and <code>git push</code> with an option of their choosing. The <code>new_branch</code> input, called <code>branch</code> before 8.0.0, is used as a single positional value and is never passed through <code>matchGitArgs()</code> or validated, unlike the inputs the README documents as taking raw git arguments. <code>src/main.ts</code> hands it to simple-git's <code>checkout()</code>, which builds the argument vector <code>['checkout', value]</code>, and on the default push path to <code>push()</code>, which builds <code>['push', 'origin', value, '--set-upstream']</code>. git parses every element of its argument vector for a leading hyphen wherever it appears, so a value of <code>--force</code> is taken as the option and not as a branch name. The two commands become <code>git checkout --force</code>, which discards the staged changes the action was about to commit, and <code>git push origin --force --set-upstream</code>, 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 <code>--force</code> can be created and pushed to a fork with <code>git push origin HEAD:refs/heads/--force</code>, although the <code>git branch</code> porcelain refuses such a name; a workflow that derives <code>new_branch</code> from a head branch name therefore takes the value from whoever opened the pull request. The action reports <code>committed</code> and <code>pushed</code> as true and logs that the branch already existed."}]}],"tags":["x_open-source"],"references":[{"url":"https://github.com/EndBug/add-and-commit/commit/b4a0134716b4bf226c6b957f03ee862e961afd8d","tags":["patch"]},{"url":"https://github.com/EndBug/add-and-commit/pull/755","tags":["patch"]},{"url":"https://github.com/EndBug/add-and-commit/releases/tag/v11.0.0","tags":["release-notes"]},{"url":"https://secur0.com/en/cna/cve-list/cve-2026-142541-add-and-commit-git-argument-injection","tags":["third-party-advisory","technical-description"]}],"metrics":[{"format":"CVSS","scenarios":[{"lang":"en","value":"GENERAL"}],"cvssV4_0":{"attackVector":"NETWORK","attackComplexity":"LOW","attackRequirements":"PRESENT","privilegesRequired":"NONE","userInteraction":"NONE","vulnConfidentialityImpact":"NONE","subConfidentialityImpact":"LOW","vulnIntegrityImpact":"LOW","subIntegrityImpact":"LOW","vulnAvailabilityImpact":"NONE","subAvailabilityImpact":"NONE","exploitMaturity":"NOT_DEFINED","Safety":"NOT_DEFINED","Automatable":"NOT_DEFINED","Recovery":"NOT_DEFINED","valueDensity":"NOT_DEFINED","vulnerabilityResponseEffort":"NOT_DEFINED","providerUrgency":"NOT_DEFINED","version":"4.0","baseSeverity":"MEDIUM","baseScore":6.3,"vectorString":"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"}}],"solutions":[{"lang":"en","value":"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.","supportingMedia":[{"type":"text/html","base64":false,"value":"Upgrade to add-and-commit 11.0.0 or later, which validates <code>new_branch</code> with <code>assertValidBranchName()</code> before using it. On an affected version, do not derive <code>new_branch</code> 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."}]}],"credits":[{"lang":"en","value":"Lois del Río Somoza","type":"finder"},{"lang":"en","value":"Xoán M. Otero Jorge","type":"analyst"},{"lang":"en","value":"Darío Rivas","type":"analyst"},{"lang":"en","value":"Secur0 CNA","type":"coordinator"},{"lang":"en","value":"Federico Grandi @EndBug","type":"remediation developer"}],"source":{"discovery":"EXTERNAL"},"x_generator":{"engine":"Vulnogram 1.0.5"}},"adp":[{"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-12-02T21:24:27.135201Z","id":"CVE-2026-142541","options":[{"Exploitation":"none"},{"Automatable":"yes"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2026-12-02T21:24:36.208Z"}}]}}