Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1yYzJxLXg5bWYtdzN2Zs4AAv9U
TestNG is vulnerable to Path Traversal
Impact
Affected by this vulnerability is the function testngXmlExistsInJar
of the file testng-core/src/main/java/org/testng/JarFileUtils.java
of the component XML 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
- Specify which tests to run when invoking TestNG by configuring them on the CLI or in the build tool controlling the run.
- Do not run tests with untrusted JARs on the classpath, this includes pull requests on open source projects.
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yYzJxLXg5bWYtdzN2Zs4AAv9U
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: over 1 year ago
Updated: 7 months ago
CVSS Score: 7.8
CVSS vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Identifiers: GHSA-rc2q-x9mf-w3vf, CVE-2022-4065
References:
- https://nvd.nist.gov/vuln/detail/CVE-2022-4065
- https://github.com/cbeust/testng/pull/2806
- https://github.com/cbeust/testng/commit/9150736cd2c123a6a3b60e6193630859f9f0422b
- https://vuldb.com/?id.214027
- https://github.com/cbeust/testng/releases/tag/7.7.0
- https://github.com/cbeust/testng/pull/1596
- https://github.com/cbeust/testng/releases/tag/7.7.1
- https://vuldb.com/?ctiid.214027
- https://github.com/testng-team/testng/pull/2899
- https://github.com/testng-team/testng/releases/tag/7.5.1
- https://github.com/advisories/GHSA-rc2q-x9mf-w3vf
Blast Radius: 39.4
Affected Packages
maven:org.testng:testng
Dependent packages: 10,062Dependent repositories: 112,338
Downloads:
Affected Version Ranges: >= 7.6.0, < 7.7.0, >= 6.13, < 7.5.1
Fixed in: 7.7.0, 7.5.1
All affected versions: 6.13.1, 6.14.2, 6.14.3, 7.0.0, 7.1.0, 7.3.0, 7.4.0, 7.6.0, 7.6.1
All unaffected versions: 4.4.7, 4.6.1, 5.0.1, 5.0.2, 5.12.1, 5.13.1, 5.14.1, 5.14.2, 5.14.3, 5.14.4, 5.14.5, 5.14.6, 5.14.7, 5.14.9, 5.14.10, 6.0.1, 6.1.1, 6.2.1, 6.3.1, 6.5.1, 6.5.2, 6.8.1, 6.8.3, 6.8.5, 6.8.7, 6.8.8, 6.8.13, 6.8.14, 6.8.15, 6.8.17, 6.8.21, 6.9.4, 6.9.5, 6.9.6, 6.9.7, 6.9.8, 6.9.9, 6.9.10, 7.5.1, 7.7.0, 7.7.1, 7.8.0, 7.9.0, 7.10.0, 7.10.1, 7.10.2