GHSA-rc2q-x9mf-w3vf

Suggest an improvement
Source
https://github.com/advisories/GHSA-rc2q-x9mf-w3vf
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/11/GHSA-rc2q-x9mf-w3vf/GHSA-rc2q-x9mf-w3vf.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-rc2q-x9mf-w3vf
Aliases
Published
2022-11-19T21:30:25Z
Modified
2023-11-08T04:10:24.506184Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H CVSS Calculator
Summary
TestNG is vulnerable to Path Traversal
Details

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.
Database specific
{
    "nvd_published_at": "2022-11-19T19:15:00Z",
    "cwe_ids": [
        "CWE-22"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2022-12-02T22:31:06Z"
}
References

Affected packages

Maven / org.testng:testng

Package

Name
org.testng:testng
View open source insights on deps.dev
Purl
pkg:maven/org.testng/testng

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.13
Fixed
7.5.1

Affected versions

6.*

6.13
6.13.1
6.14.2
6.14.3

7.*

7.0.0-beta1
7.0.0-beta2
7.0.0-beta3
7.0.0-beta4
7.0.0-beta7
7.0.0
7.1.0
7.3.0
7.4.0
7.5

Maven / org.testng:testng

Package

Name
org.testng:testng
View open source insights on deps.dev
Purl
pkg:maven/org.testng/testng

Affected ranges

Type
ECOSYSTEM
Events
Introduced
7.6.0
Fixed
7.7.0

Affected versions

7.*

7.6.0
7.6.1