{"id":"CVE-2024-45390","aliases":["CVE-2024-45390","GHSA-q765-wm9j-66qj"],"related":[],"kind":"vulnerability","state":"published","title":"@blakeembrey/template vulnerable to code injection when attacker controls template input","summary":"@blakeembrey/template is a string template library. Prior to version 1.2.0, it is possible to inject and run code within the template if the attacker has access to write the template name. Version 1.2.0 contains a patch. As a workaround, don't pass untrusted input as the template display name, or don't use the display name feature.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"@blakeembrey/template is a string template library. Prior to version 1.2.0, it is possible to inject and run code within the template if the attacker has access to write the template name. Version 1.2.0 contains a patch. As a workaround, don't pass untrusted input as the template display name, or don't use the display name feature.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"@blakeembrey/template es una librería de plantillas de cadenas. Antes de la versión 1.2.0, era posible inyectar y ejecutar código dentro de la plantilla si el atacante tenía acceso para escribir el nombre de la plantilla. La versión 1.2.0 contiene un parche. Como workaround, no pase una entrada que no sea de confianza como nombre para mostrar de la plantilla o no use la función de nombre para mostrar.","source":"nvd"}],"published":"2024-09-03T19:37:31.763Z","modified":"2026-06-17T07:54:07.320Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","score":7.3,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","score":7.3,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","score":7.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 1.2.0","status":"affected"}],"vendor":"blakeembrey","product":"js-template","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","fixed":"1.2.0","status":"affected"}],"vendor":"blakeembrey","product":"js-template","cpe":"cpe:2.3:a:blakeembrey:js-template:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.2.0"}],"ecosystem":"npm","package":"@blakeembrey/template","purl":"pkg:npm/%40blakeembrey/template","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.2.0"}],"vendor":"blakeembrey","product":"template","cpe":"cpe:2.3:a:blakeembrey:template:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/blakeembrey/js-template/security/advisories/GHSA-q765-wm9j-66qj","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/blakeembrey/js-template/commit/b8d9aa999e464816c6cfb14acd1ad0f5d1e335aa","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45390","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/blakeembrey/js-template","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2024-09-03T19:59:11.259Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-45390","url":"https://www.cve.org/CVERecord?id=CVE-2024-45390","licence":"CVE Terms of Use","modified":"2024-09-03T20:01:40.797Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q765-wm9j-66qj","url":"https://github.com/advisories/GHSA-q765-wm9j-66qj","licence":"CC-BY-4.0","modified":"2024-11-18T16:27:09.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-45390","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45390","licence":"Public domain","modified":"2026-06-17T07:54:07.320Z"}],"updatedAt":"2026-11-25T22:58:45.022Z","epss":{"score":0.00433,"percentile":0.39423,"date":"2026-12-01T12:00:22.000Z"}}