Vulnerabilities in pkg:npm/@blakeembrey/template
PACKAGECVE-2024-45390 is a MODERATE (CVSS 7.3) @blakeembrey/template vulnerable to code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting @blakeembrey/template libraries in the npm ecosystem. The issue involves @blakeembrey/template vulnerable to code injection when attacker controls template input. Remediation is available by upgrading affected packages to version 1.2.0.
pkg:npm/@blakeembrey/template
Vulnerability advisories affecting package pkg:npm/@blakeembrey/template. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-q765-wm9j-66qj | CVE-2024-45390 | MODERATE | @blakeembrey/template vulnerable to code injection when attacker controls template input |
CVE-2024-45390 at a Glance
Security Impact
CVSS: 7.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2024-45390
To remediate this vulnerability, upgrade all affected @blakeembrey/template 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 @blakeembrey/template@1.2.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @blakeembrey/template
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-45390, inspect your project dependencies using npm:
npm ls @blakeembrey/template
Analyze the terminal output to locate any version of @blakeembrey/template in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.0), your application is affected.
Note: The npm ls @blakeembrey/template 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-94: Improper Control of Generation of Code ('Code Injection'), where 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. In @blakeembrey/template, 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-2024-45390 Affected @blakeembrey/template Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@blakeembrey/template
|
npm |
< 1.2.0
|
1.2.0
|
References
Frequently Asked Questions
What is CVE-2024-45390?
Which @blakeembrey/template versions are affected?
What version fixes CVE-2024-45390?
Is @blakeembrey/template affected?
What is the CVSS score of CVE-2024-45390?
What CWE is associated with CVE-2024-45390?
How can I check npm dependencies for CVE-2024-45390?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q765-wm9j-66qj",
"modified" : "2024-11-18T16:27:09Z",
"published" : "2024-09-03T19:42:25Z",
"aliases" : [ "CVE-2024-45390" ],
"summary" : "@blakeembrey/template vulnerable to code injection when attacker controls template input",
"details" : "### Impact\n\nIt is possible to inject and run code within the template if the attacker has access to write the template name.\n\n```js\nconst { template } = require('@blakeembrey/template');\n\ntemplate(\"Hello {{name}}!\", \"exploit() {} && ((()=>{ console.log('success'); })()) && function pwned\");\n```\n\n### Patches\n\nUpgrade to 1.2.0.\n\n### Workarounds\n\nDon't pass untrusted input as the template display name, or don't use the display name feature.\n\n### References\n\nFixed by removing in https://github.com/blakeembrey/js-template/commit/b8d9aa999e464816c6cfb14acd1ad0f5d1e335aa.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@blakeembrey/template"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/blakeembrey/js-template/security/advisories/GHSA-q765-wm9j-66qj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45390"
}, {
"type" : "WEB",
"url" : "https://github.com/blakeembrey/js-template/commit/b8d9aa999e464816c6cfb14acd1ad0f5d1e335aa"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/blakeembrey/js-template"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-03T19:42:25Z",
"nvd_published_at" : "2024-09-03T20:15:08Z"
}
}