CVE-2021-21316
JSON

6.3medium

Arbitrary code execution in less-openui5

Severity
6.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.00% (higher than 63% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-3crj-w4f5-gwh4

Description

less-openui5 is an npm package which enables building OpenUI5 themes with Less.js. In less-openui5 before version 0.10., when processing theming resources (i.e. `*.less` files) with less-openui5 that originate from an untrusted source, those resources might contain JavaScript code which will be executed in the context of the build process. While this is a feature of the Less.js library it is an unexpected behavior in the context of OpenUI5 and SAPUI5 development. Especially in the context of UI5 Tooling which relies on less-openui5. An attacker might create a library or theme-library containing a custom control or theme, hiding malicious JavaScript code in one of the .less files. Refer to the referenced GHSA-3crj-w4f5-gwh4 for examples. Starting with Less.js version 3.0.0, the Inline JavaScript feature is disabled by default. less-openui5 however currently uses a fork of Less.js v1.6.3. Note that disabling the Inline JavaScript feature in Less.js versions 1.x, still evaluates code has additional double codes around it. We decided to remove the inline JavaScript evaluation feature completely from the code of our Less.js fork. This fix is available in less-openui5 version 0.10.0.

Affected

Product or packageVersionsReported by
SAP less-openui5< 0.10.0CVE List
less-openui5 (npm)before 0.10.0GitHub Advisory Database
less-openui5_project less-openui5before 0.10.0NVD

All scores

GitHub_M6.3medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N
GitHub6.3high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NVD6.8medium CVSS:2.0AV:N/AC:M/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

less-openui5 is an npm package which enables building OpenUI5 themes with Less.js. In less-openui5 before version 0.10., when processing theming resources (i.e. `*.less` files) with less-openui5 that originate from an untrusted source, those resources might contain JavaScript code which will be executed in the context of the build process. While this is a feature of the Less.js library it is an unexpected behavior in the context of OpenUI5 and SAPUI5 development. Especially in the context of UI5 Tooling which relies on less-openui5. An attacker might create a library or theme-library containing a custom control or theme, hiding malicious JavaScript code in one of the .less files. Refer to the referenced GHSA-3crj-w4f5-gwh4 for examples. Starting with Less.js version 3.0.0, the Inline JavaScript feature is disabled by default. less-openui5 however currently uses a fork of Less.js v1.6.3. Note that disabling the Inline JavaScript feature in Less.js versions 1.x, still evaluates code has additional double codes around it. We decided to remove the inline JavaScript evaluation feature completely from the code of our Less.js fork. This fix is available in less-openui5 version 0.10.0.

GitHub Advisory Database
Impact

When processing theming resources (i.e. *.less files) with less-openui5 that originate from an untrusted source, those resources might contain JavaScript code which will be executed in the context of the build process.

While this is a feature of the Less.js library, it is an unexpected behavior in the context of OpenUI5 and SAPUI5 development.

Especially in the context of UI5 Tooling, which relies on less-openui5, this poses a security threat:

An attacker might create a library or theme-library containing a custom control or theme, hiding malicious JavaScript code in one of the .less files.

This is an example of inline JavaScript in a Less file:

.rule {
	@var: `(function(){console.log('Hello from JavaScript'); process.exit(1);})()`;
	color: @var;
}

Starting with Less.js version 3.0.0, the Inline JavaScript feature is disabled by default. less-openui5 however currently uses a fork of Less.js v1.6.3.

Note that disabling the Inline JavaScript feature in Less.js versions 1.x, still evaluates code has additional double codes around it:

.rule {
	@var: "`(function(){console.log('Hello from JavaScript'); process.exit(1);})()`";
	color: @var;
}
Patches

We decided to remove the inline JavaScript evaluation feature completely from the code of our Less.js fork.

This fix is available in less-openui5 version v0.10.0

Workarounds

Only process trusted theming resources.

For more information

If you have any questions or comments about this advisory:

NVD (es)

less-openui5 es un paquete npm que permite construir temas de OpenUI5 con Less.js. En less-openui5 versiones anteriores a 0.10., cuando se procesan recursos de tematización (es decir, archivos "*.less") con less-openui5 que se originan desde una fuente no confiable, esos recursos podrían contener código JavaScript que se ejecutará en el contexto del proceso de compilación. Aunque esta es una funcionalidad de la biblioteca Less.js, es un comportamiento inesperado en el contexto del desarrollo de OpenUI5 y SAPUI5. Especialmente en el contexto de UI5 Tooling que depende de less-openui5. Un atacante podría crear una biblioteca o biblioteca de tema que contenga un control o tema personalizado, ocultando código JavaScript malicioso en uno de los archivos .less. Consulte la referencia GHSA-3crj-w4f5-gwh4 para visualizar ejemplos. A partir de Less.js versión 3.0.0, la función Inline JavaScript está deshabilitada por defecto. Sin embargo, less-openui5 usa actualmente un derivación de Less.js versión v1.6.3. Note que al deshabilitar la funcionalidad Inline JavaScript en las versiones 1.x de Less.js, se sigue evaluando el código con códigos dobles adicionales a su alrededor. Hemos decidido eliminar completamente la funcionalidad de evaluación de JavaScript en línea del código de nuestra derivación de Less.js. Esta corrección está disponible en less-openui5 versión 0.10.0

References

Sources

SourceRecordLicence
CVE ListCVE-2021-21316 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-3crj-w4f5-gwh4 changed 2026-07-08CC-BY-4.0
NVDCVE-2021-21316 changed 2026-06-17Public domain