CVE-2022-4065: cbeust testng XML File Parser JarFileUtils.java testngXmlExistsInJar path traversal

Published Nov 19, 2022
·
Updated

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 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.

Other sources

A vulnerability was found in cbeust testng 7.5.0/7.6.0/7.6.1/7.7.0. It has been declared as critical. 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. The attack can be launched remotely. Upgrading to version 7.5.1 and 7.7.1 is able to address this issue. The patch is named 9150736cd2c123a6a3b60e6193630859f9f0422b. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-214027.

Affected Software

3 affected componentsFixes available
maven/org.testng:testng>=7.6.0<7.7.0
7.7.0
maven/org.testng:testng>=6.13<7.5.1
7.5.1
Testng Project Testng

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade maven/org.testng:testng to a version that resolves this vulnerability.

    Fixed in 7.7.0
  2. Upgrade

    Upgrade maven/org.testng:testng to a version that resolves this vulnerability.

    Fixed in 7.5.1
  3. Upgrade

    Upgrade cbeust/testng (XML File Parser) to a version that resolves this vulnerability.

    Fixed in 7.5.1
  4. Upgrade

    Upgrade cbeust/testng (XML File Parser) to a version that resolves this vulnerability.

    Fixed in 7.7.1
  5. Upgrade

    Upgrade cbeust/testng (XML File Parser) to a version that resolves this vulnerability.

    Patch 9150736cd2c123a6a3b60e6193630859f9f0422b
  6. Configuration

    Specify which tests to run when invoking TestNG by configuring them on the CLI or in the build tool controlling the run.

    TestNG Which tests to run (CLI/build tool configuration) = configured tests (explicit list)
  7. Compensating control

    Do not run TestNG tests with untrusted JARs on the classpath (this includes pull requests on open source projects).

Event History

Nov 19, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
09:30 PM
Aug 17, 2025
Exploit Published
via GitHub·05:12 PM

Frequently Asked Questions

1

What is the severity of CVE-2022-4065?

CVE-2022-4065 has been categorized with a medium severity due to its potential for path traversal attacks affecting XML file processing.

2

How do I fix CVE-2022-4065?

To fix CVE-2022-4065, update to TestNG version 7.7.0 or later.

3

What type of files are impacted by CVE-2022-4065?

CVE-2022-4065 specifically affects XML, YAML, and YML files during processing.

4

What is the impact of the vulnerability CVE-2022-4065?

The impact of CVE-2022-4065 allows attackers to exploit path traversal vulnerabilities in affected TestNG versions.

5

Which versions of TestNG are affected by CVE-2022-4065?

CVE-2022-4065 affects TestNG versions between 6.13 and 7.5.1, and includes 7.6.0 through 7.7.0.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203