CVE-2023-40828: Pf4j Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-cj8w-v588-p8wx
CVSS 7.5
CWE-94 CWE-22
Published
Advisory Summary

CVE-2023-40828 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Pf4j libraries in the Maven ecosystem. The issue involves pf4j vulnerable to remote code execution via expandifzip method in the extract function. Remediation is available in the latest vendor maintenance releases.

CVE-2023-40828 at a Glance

CVE Identifier CVE-2023-40828
GHSA Identifier GHSA-cj8w-v588-p8wx
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Pf4j
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-40828

To remediate this vulnerability, upgrade all affected Pf4j dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.pf4j:pf4j fixed: Latest secure release
<dependency>
    <groupId>org.pf4j</groupId>
    <artifactId>pf4j</artifactId>
    <version>Latest secure release</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.pf4j

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2023-40828, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.pf4j

Analyze the terminal output to locate any version of Pf4j in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.pf4j command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Pf4j, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the expandIfZip method in the extract function.

CVE-2023-40828 Affected Pf4j Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
org.pf4j:pf4j
Maven
≤ 3.9.0

References

Frequently Asked Questions

What is CVE-2023-40828?
CVE-2023-40828 is a security vulnerability in Pf4j involving pf4j vulnerable to remote code execution via expandIfZip method in the extract function under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Pf4j versions are affected?
Affected versions include releases prior to current release patches across affected packages: org.pf4j:pf4j.
What version fixes CVE-2023-40828?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is pf4j affected?
Yes, org.pf4j:pf4j is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2023-40828?
CVE-2023-40828 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-40828?
CVE-2023-40828 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Maven dependencies for CVE-2023-40828?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.pf4j'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cj8w-v588-p8wx",
  "modified" : "2023-08-31T14:49:19Z",
  "published" : "2023-08-29T00:32:04Z",
  "aliases" : [ "CVE-2023-40828" ],
  "summary" : "pf4j vulnerable to remote code execution via expandIfZip method in the extract function",
  "details" : "An issue in pf4j pf4j v.3.9.0 and before allows a remote attacker to obtain sensitive information and execute arbitrary code via the expandIfZip method in the extract function.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.pf4j:pf4j"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40828"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pf4j/pf4j/pull/537"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pf4j/pf4j/pull/538"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pf4j/pf4j/commit/8e0aa198c4e652cfc1eb9e05ca9b64397f67cc72"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pf4j/pf4j"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-29T17:40:51Z",
    "nvd_published_at" : "2023-08-28T22:15:09Z"
  }
}