TestNG is vulnerable to Path Traversal
High severity
GitHub Reviewed
Published
Nov 19, 2022
to the GitHub Advisory Database
•
Updated Oct 20, 2023
Package
Affected versions
>= 6.13, < 7.5.1
>= 7.6.0, < 7.7.0
Patched versions
7.5.1
7.7.0
Description
Published by the National Vulnerability Database
Nov 19, 2022
Published to the GitHub Advisory Database
Nov 19, 2022
Reviewed
Dec 2, 2022
Last updated
Oct 20, 2023
Impact
Affected by this vulnerability is the function
testngXmlExistsInJar
of the filetestng-core/src/main/java/org/testng/JarFileUtils.java
of the componentXML File Parser
.The manipulation leads to path traversal only for
.xml
,.yaml
and.yml
files by default. The attack implies running an unsafe test JAR. However since that JAR can also contain executable code itself, the path traversal is unlikely to be the main attack.Patches
A patch is available in version 7.7.0 at commit 9150736cd2c123a6a3b60e6193630859f9f0422b. It is recommended to apply a patch to fix this issue. The patch was pushed into the master branch but no releases have yet been made with the patch included.
A backport of the fix is available in [version 7.5.1]((https://github.com/cbeust/testng/releases/tag/7.5.1) for Java 8 projects.
Workaround
References