7.3high
@blakeembrey/template vulnerable to code injection when attacker controls template input
- Severity
- 7.3high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.43% (higher than 39% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-q765-wm9j-66qj
Description
@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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| blakeembrey js-template | < 1.2.0, before 1.2.0 | CVE List |
| @blakeembrey/template (npm) | before 1.2.0 | GitHub Advisory Database |
| blakeembrey template | before 1.2.0 | NVD |
All scores
| GitHub_M | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| GitHub | 7.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| GitHub | medium CVSS:4.0 | 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 |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
@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.
GitHub Advisory Database
Impact
It is possible to inject and run code within the template if the attacker has access to write the template name.
const { template } = require('@blakeembrey/template');
template("Hello {{name}}!", "exploit() {} && ((()=>{ console.log('success'); })()) && function pwned");
Patches
Upgrade to 1.2.0.
Workarounds
Don't pass untrusted input as the template display name, or don't use the display name feature.
References
Fixed by removing in https://github.com/blakeembrey/js-template/commit/b8d9aa999e464816c6cfb14acd1ad0f5d1e335aa.
NVD (es)
@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.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-45390 changed 2024-09-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-q765-wm9j-66qj changed 2024-11-18 | CC-BY-4.0 |
| NVD | CVE-2024-45390 changed 2026-06-17 | Public domain |