CVE-2025-57285
Description
codeceptjs 3.7.3 contains a command injection vulnerability in the emptyFolder function (lib/utils.js). The execSync command directly concatenates the user-controlled directoryPath parameter without sanitization or escaping, allowing attackers to execute arbitrary commands.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
CodeceptJS 3.7.3 is vulnerable to command injection in the emptyFolder function, allowing arbitrary command execution via unsanitized user input.
The vulnerability exists in the emptyFolder function within lib/utils.js of CodeceptJS version 3.7.3 [1]. The function uses execSync to remove a directory, but it directly concatenates the user-controlled directoryPath parameter into the shell command without any sanitization or escaping [3]. This allows an attacker to inject arbitrary operating system commands.
Exploitation requires control over the output configuration parameter, which is passed to emptyFolder when the emptyOutputFolder option is enabled. The PoC provided by the discoverer demonstrates that setting output to a string like /test/ ; touch Dremig486; # results in the execution of touch Dremig486 after the intended removal command [4]. No authentication or special network position is required if the attacker can influence the configuration.
A successful attack enables arbitrary command execution with the privileges of the Node.js process running CodeceptJS. This could lead to data exfiltration, system compromise, or lateral movement within the testing environment. The impact is limited to the context of the user running the tests.
As of now, no official fix has been released for this vulnerability. Users are advised to avoid using untrusted input in the output path and to disable the emptyOutputFolder feature if not necessary. Until a patch is available, sanitization of the output directory path should be implemented manually; a pull request exists that may address the issue [2].
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
codeceptjsnpm | >= 3.5.0, < 3.7.5 | 3.7.5 |
Affected products
2- codeceptjs/codeceptjsdescription
- Range: =3.7.3
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6News mentions
0No linked articles in our index yet.