{"schemaVersion":3,"id":"CVE-2026-40261","aliases":["UBUNTU-CVE-2026-40261","DEBIAN-CVE-2026-40261","CGA-5vj2-7rpg-5wwh","CGA-ph4f-23vf-gqqv"],"status":"published","duplicateOf":null,"title":null,"description":"Composer is a dependency manager for PHP. Versions 1.0 through 2.2.26 and 2.3 through 2.9.5 contain a command injection vulnerability in the Perforce::syncCodeBase() method, which appends the $sourceReference parameter to a shell command without proper escaping, and additionally in the Perforce::generateP4Command() method as in GHSA-wg36-wvj6-r67p / CVE-2026-40176, which interpolates user-supplied Perforce connection parameters (port, user, client) from the source url field without proper escaping. An attacker can inject arbitrary commands through crafted source reference or source url values containing shell metacharacters, even if Perforce is not installed. Unlike CVE-2026-40176, the source reference and url are provided as part of package metadata, meaning any compromised or malicious Composer repository can serve package metadata declaring perforce as a source type with malicious values. This vulnerability is exploitable when installing or updating dependencies from source, including the default behavior when installing dev-prefixed versions. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline). If developers are unable to immediately update, they can avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting, and only use trusted Composer repositories as a workaround.","dates":{"published":"2026-04-15T20:56:32.182Z","modified":"2026-07-15T01:01:10.106Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":8.8,"severity":"high","version":"3.1","versionLabel":"v3.1","source":"CVE.org","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Ubuntu","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":7.2,"impact":9.8,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Debian","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":7.2,"impact":9.8,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Wolfi","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":7.2,"impact":9.8,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Chainguard","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":7.2,"impact":9.8,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":8.8,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.01909,"percentile":0.7947,"severity":"low","asOf":"2026-10-19T00:00:00.000Z","change":{"pp":0.22100000000000003,"baselineDate":"2026-09-19T00:00:00.000Z","baselineScore":0.01688},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.01909,"percentile":0.7947}],"last30":[{"date":"2026-09-19T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.01688,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.01909,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.01909,"percentile":0.7947}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-20","name":"Improper Input Validation","description":"The product receives input or data, but it does\n        not validate or incorrectly validates that the input has the\n        properties that are required to process the data safely and\n        correctly.","type":"weakness","status":"Stable","abstraction":"Class","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/20.html"},{"id":"CWE-78","name":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')","description":"The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.","type":"weakness","status":"Stable","abstraction":"Base","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/78.html"}],"affected":[{"vendor":"chainguard","product":"composer","name":"composer","label":"composer","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/composer","purlType":"apk","versions":[{"text":"< 2.9.7-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.9.7-r0","eol":null,"hubHref":null},{"vendor":"wolfi","product":"composer","name":"composer","label":"composer","ecosystem":"Wolfi","cpePart":null,"purl":"pkg:apk/wolfi/composer","purlType":"apk","versions":[{"text":"< 2.9.7-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.9.7-r0","eol":null,"hubHref":null},{"vendor":"composer","product":"composer","name":"composer","label":"composer","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 2.3.0, < 2.9.6","noFixRecorded":false,"fixedIn":null},{"text":"≥ 1.0.0, < 2.2.27","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 2.3.0, < 2.9.6 | ≥ 1.0.0, < 2.2.27","eol":null,"hubHref":"/vendor/composer/composer"},{"vendor":"debian","product":"composer","name":"composer","label":"composer","ecosystem":"Debian","cpePart":null,"purl":"pkg:deb/debian/composer","purlType":"deb","versions":[{"text":"< 2.5.5-1+deb12u4","noFixRecorded":false,"fixedIn":null},{"text":"< 2.8.8-1+deb13u2","noFixRecorded":false,"fixedIn":null},{"text":"< 2.9.7-1","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.5.5-1+deb12u4 | < 2.8.8-1+deb13u2 | < 2.9.7-1","eol":null,"hubHref":null},{"vendor":"ubuntu","product":"composer","name":"composer","label":"composer","ecosystem":"Ubuntu","cpePart":null,"purl":"pkg:deb/ubuntu/composer","purlType":"deb","versions":[{"text":"All versions","noFixRecorded":true,"fixedIn":null}],"versionsText":"All versions (No fix recorded)","eol":null,"hubHref":null},{"vendor":"getcomposer","product":"composer","name":"composer","label":"composer","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 1.0.0, ≤ 2.2.26","noFixRecorded":false,"fixedIn":null},{"text":"≥ 2.3.0, ≤ 2.9.5","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 1.0.0, ≤ 2.2.26 | ≥ 2.3.0, ≤ 2.9.5","eol":{"isEol":null,"eolDate":null,"matchMethod":"cpe","cycle":null,"product":{"name":"composer","label":"Composer","category":"app"}},"hubHref":"/vendor/getcomposer/composer"}],"affectedCount":6,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/composer/composer/security/advisories/GHSA-gqw4-4w2p-838q","label":"github.com/composer/composer/security/advisories/GHSA-gqw4-4w2p-838q","hostname":"github.com","tags":["X Refsource CONFIRM","REPORT","Advisory","Vendor Advisory"]},{"url":"https://github.com/composer/composer/releases/tag/2.9.6","label":"github.com/composer/composer/releases/tag/2.9.6","hostname":"github.com","tags":["X Refsource MISC","WEB","Release Notes"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-40261","label":"access.redhat.com/security/cve/CVE-2026-40261","hostname":"access.redhat.com","tags":["VDB Entry","X Refsource REDHAT","Advisory"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2458841","label":"bugzilla.redhat.com/show_bug.cgi?id=2458841","hostname":"bugzilla.redhat.com","tags":["Issue Tracking","X Refsource REDHAT","REPORT"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40261.json","label":"security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40261.json","hostname":"security.access.redhat.com","tags":["X Sadp Csaf Vex","WEB"]},{"url":"https://access.redhat.com/errata/RHSA-2026:8165","label":"access.redhat.com/errata/RHSA-2026:8165","hostname":"access.redhat.com","tags":["Vendor Advisory","X Refsource REDHAT","Advisory"]},{"url":"https://ubuntu.com/security/CVE-2026-40261","label":"ubuntu.com/security/CVE-2026-40261","hostname":"ubuntu.com","tags":["REPORT"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-40261","label":"www.cve.org/CVERecord?id=CVE-2026-40261","hostname":"www.cve.org","tags":["REPORT"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-40261","label":"security-tracker.debian.org/tracker/CVE-2026-40261","hostname":"security-tracker.debian.org","tags":["Advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40261.json","label":"github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40261.json","hostname":"github.com","tags":["Advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40261","label":"nvd.nist.gov/vuln/detail/CVE-2026-40261","hostname":"nvd.nist.gov","tags":["Advisory"]}],"lineage":{"upstream":[],"downstream":["OPENSUSE-SU-2026:10643-1","OPENSUSE-SU-2026:21520-1","RHSA-2026:8165","SUSE-SU-2026:23116-1","SUSE-SU-2026:23138-1","SUSE-SU-2026:3105-1"],"duplicates":[],"related":["CGA-QC9G-M2CJ-3PM6","OPENSUSE-SU-2026:10643-1","OPENSUSE-SU-2026:21520-1","SUSE-SU-2026:23116-1","SUSE-SU-2026:23138-1","SUSE-SU-2026:3105-1"]},"timeline":[{"kind":"published","date":"2026-04-15T20:56:32.182Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2026-07-15T01:01:10.106Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"risk":{"score":36,"level":"medium","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-19T21:43:28.716Z","stale":false,"partial":false}}