{"schemaVersion":4,"id":"CVE-2026-118905","aliases":[],"status":"published","duplicateOf":null,"title":"nvm_ls lets an untrusted version string inject sed commands, executing arbitrary commands with GNU sed","description":"Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.31.2 through 0.40.5, `nvm_ls` filters installed versions with a sed program that embeds the requested version pattern in a `\\#...#` address, escaping `.` (and, since 0.40.4, `#`) but not backslash. A version string containing `#` (or `\\#`) therefore closes the address early, and the rest of it is parsed as sed commands: with GNU sed, the `e` command runs a shell command as the user; with BSD sed, the `w` and `r` commands write and read files. This is reachable whenever an attacker-influenced version string is passed to `nvm use`, `nvm which`, `nvm ls`, `nvm version`, `nvm run`, or `nvm exec`, or to `nvm-exec` via `NODE_VERSION`, and at least one version is installed. nvm's own `.nvmrc` parser strips comments, so a bare `nvm use` is not affected; however, the bash `cdnvm` and zsh `load-nvmrc` auto-switch hooks documented in the README read `.nvmrc` as-is and pass it to `nvm ls` and `nvm version`, so a user with one of those hooks installed runs the attacker's command just by changing into a directory under a malicious `.nvmrc`; scripts that run `nvm use \"$(cat .nvmrc)\"` are affected the same way. Version 0.40.6 passes any version pattern containing `#` or a newline through the `.nvmrc` content parser first, so no `#` reaches the sed program.","dates":{"published":"2026-10-29T05:22:35.156Z","modified":"2026-11-05T20:46:27.890Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":7.1,"severity":"high","version":"4.0","versionLabel":"v4.0","source":"CVE.org","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","computed":false,"selection":"backend-summary"},"metrics":[{"version":"4.0","versionLabel":"v4.0","source":"CVE.org","score":7.1,"severity":"high","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":7,"severity":"high","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false},{"version":"4.0","versionLabel":"v4.0","source":"NVD","score":7.1,"severity":"high","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":7,"severity":"high","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.0018,"percentile":0.07901,"severity":"low","asOf":"2026-12-04T00:00:00.000Z","change":{"pp":0.041,"baselineDate":"2026-11-04T00:00:00.000Z","baselineScore":0.00139},"history":[{"date":"2026-10-29T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-10-30T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-10-31T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-01T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-02T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-03T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-04T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.0018,"percentile":0.07901}],"last30":[{"date":"2026-11-04T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.00139,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.00202,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.0018,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.0018,"percentile":0.07901}]},"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-78","name":"Improper Neutralization of Special Elements used in an OS Command","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 before it is sent to a downstream component.","type":"weakness","status":"Stable","abstraction":"Base","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/78.html"},{"id":"CWE-94","name":"Improper Control of Generation of Code","description":"The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.","type":"weakness","status":"Draft","abstraction":"Base","likelihoodOfExploit":"Medium","url":"https://cwe.mitre.org/data/definitions/94.html"}],"affected":[{"vendor":"nvm-sh","product":"nvm","name":"nvm","label":"nvm","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 0.31.2, < 0.40.6","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"0.31.2","startInclusive":true,"end":"0.40.6","endInclusive":false}}],"versionsText":"≥ 0.31.2, < 0.40.6","eol":{"isEol":null,"eolDate":null,"matchMethod":"name_exact","cycle":null,"product":{"name":"nvm","label":"nvm","category":"app"}},"hubHref":"/vendor/nvm-sh/nvm"}],"affectedCount":1,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/nvm-sh/nvm/security/advisories/GHSA-vgqf-vc3m-4wv3","label":"github.com/nvm-sh/nvm/security/advisories/GHSA-vgqf-vc3m-4wv3","hostname":"github.com","tags":["Vendor Advisory"]},{"url":"https://github.com/nvm-sh/nvm/commit/82315e2b189528a006da6701eac30e8c364ffd22","label":"github.com/nvm-sh/nvm/commit/82315e2b189528a006da6701eac30e8c364ffd22","hostname":"github.com","tags":["Patch"]},{"url":"https://github.com/nvm-sh/nvm/pull/3854","label":"github.com/nvm-sh/nvm/pull/3854","hostname":"github.com","tags":["Patch"]},{"url":"https://github.com/nvm-sh/nvm/releases/tag/v0.40.6","label":"github.com/nvm-sh/nvm/releases/tag/v0.40.6","hostname":"github.com","tags":["Release Notes"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2026-10-29T05:22:35.156Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2026-11-05T20:46:27.890Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"priority":{"label":"routine","tag":null,"reason":"Not severe (CVSS 7.1, local access); no exploitation reported by the 5 checked sources","nextStep":"Fix in the normal cadence","rank":[0,0,0,0,0,71],"checkedSources":["cisa","enisa","circl","shadowserver","cisa-adp"],"evidence":[{"type":"epss","source":"FIRST","date":"2026-12-04T00:00:00.000Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"value":0.0018,"stale":false,"promoted":null},{"type":"cvss","source":"cve.org","date":"2026-11-05T20:46:27.890Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7.1,"vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","version":"4.0","headline":true},{"type":"cvss","source":"cve.org","date":"2026-11-05T20:46:27.890Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7,"vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","version":"3.1"},{"type":"cvss","source":"nvd","date":"2026-11-05T20:46:27.890Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7.1,"vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","version":"4.0"},{"type":"cvss","source":"nvd","date":"2026-11-05T20:46:27.890Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7,"vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","version":"3.1"},{"type":"adp","source":"cisa-adp","date":"2026-11-05T20:45:44.034Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"exploitation":"none"}],"epss":{"value":0.0018,"date":"2026-12-04T00:00:00.000Z","stale":false,"promoted":null},"sources":[{"id":"cisa","lastSuccessfulSync":"2026-12-05T07:02:00.704Z","state":"fresh"},{"id":"enisa","lastSuccessfulSync":"2026-12-05T07:02:01.187Z","state":"fresh"},{"id":"circl","lastSuccessfulSync":"2026-12-05T07:02:01.389Z","state":"fresh"},{"id":"shadowserver","lastSuccessfulSync":null,"state":"unavailable"},{"id":"cisa-adp","lastSuccessfulSync":"2026-12-05T07:01:05.155Z","state":"fresh"},{"id":"epss","lastSuccessfulSync":"2026-12-05T07:01:59.185Z","state":"fresh"},{"id":"osv","lastSuccessfulSync":"2026-12-05T07:01:58.234Z","state":"fresh"}],"feedEvent":null},"meta":{"dataAsOf":"2026-12-05T07:21:34.756Z","stale":false,"partial":false}}