CVE-2024-45390
JSON

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 packageVersionsReported by
blakeembrey js-template< 1.2.0, before 1.2.0CVE List
@blakeembrey/template (npm)before 1.2.0GitHub Advisory Database
blakeembrey templatebefore 1.2.0NVD

All scores

GitHub_M7.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
GitHub7.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-94

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

SourceRecordLicence
CVE ListCVE-2024-45390 changed 2024-09-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-q765-wm9j-66qj changed 2024-11-18CC-BY-4.0
NVDCVE-2024-45390 changed 2026-06-17Public domain