CVE-2018-16461: Libnmap Command Injection Vulnerability
MODERATECVE-2018-16461 is a MODERATE command injection vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Libnmap libraries in the npm ecosystem. The issue involves command injection in libnmap. Remediation is available by upgrading affected packages to version 0.4.16.
CVE-2018-16461 at a Glance
How to Fix CVE-2018-16461
To remediate this vulnerability, upgrade all affected Libnmap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install libnmap@0.4.16
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls libnmap
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2018-16461, inspect your project dependencies using npm:
npm ls libnmap
Analyze the terminal output to locate any version of Libnmap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.16), your application is affected.
Note: The npm ls libnmap command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Libnmap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2018-16461 Affected Libnmap Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
libnmap
|
npm |
< 0.4.16
|
0.4.16
|
References
Frequently Asked Questions
What is CVE-2018-16461?
Which Libnmap versions are affected?
What version fixes CVE-2018-16461?
Is libnmap affected?
What CWE is associated with CVE-2018-16461?
How can I check npm dependencies for CVE-2018-16461?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7g2w-6r25-2j7p",
"modified" : "2023-09-07T18:15:41Z",
"published" : "2018-11-01T14:51:33Z",
"aliases" : [ "CVE-2018-16461" ],
"summary" : "Command Injection in libnmap",
"details" : "Versions of `libnmap` before 0.4.16 are vulnerable to command injection. \n\nProof of concept\n\n```js\nconst nmap = require('libnmap');\nconst opts = {\n range: [\n 'scanme.nmap.org',\n \"x.x.$(touch success.txt)\"\n ]\n};\nnmap.scan(opts, function(err, report) {\n if (err) throw new Error(err);\n\n for (let item in report) {\n console.log(JSON.stringify(report[item]));\n }\n});\n```\n\n\n## Recommendation\n\nUpdate to version 0.4.16 or later",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "libnmap"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.4.16"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-16461"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/390865"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-7g2w-6r25-2j7p"
}, {
"type" : "WEB",
"url" : "https://github.com/nodejs/security-wg/blob/master/vuln/npm/474.json"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/719"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:22:42Z",
"nvd_published_at" : null
}
}