Vulnerabilities in pkg:maven/org.openapitools/openapi-generator-maven-plugin

PACKAGE
Advisory Identifier: GHSA-867q-77cc-98mv
Advisory Summary

CVE-2021-21429 is a MODERATE (CVSS 4.0) creation of temporary file vulnerability (CWE-379: Creation of Temporary File in Directory with Insecure Permissions) affecting Openapi generator maven plugin libraries in the Maven ecosystem. The issue involves creation of temporary file in directory with insecure permissions in the openapi generator maven plugin. Remediation is available by upgrading affected packages to version 5.1.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.openapitools/openapi-generator-maven-plugin

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.openapitools/openapi-generator-maven-plugin. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-867q-77cc-98mv CVE-2021-21429 MODERATE Creation of Temporary File in Directory with Insecure Permissions in the OpenAPI Generator Maven plugin

CVE-2021-21429 at a Glance

CVE Identifier CVE-2021-21429
GHSA Identifier GHSA-867q-77cc-98mv
Severity MODERATE
CVSS v3.1 Base Score 4.0
CWE Classification CWE-379: Creation of Temporary File in Directory with Insecure Permissions
Affected Product Openapi generator maven plugin
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 4.0

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

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

How to Fix CVE-2021-21429

To remediate this vulnerability, upgrade all affected Openapi generator maven plugin 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.openapitools:openapi-generator-maven-plugin fixed: 5.1.0
<dependency>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>5.1.0</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.openapitools

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.openapitools

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

Note: The mvn dependency:tree -Dincludes=org.openapitools 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-379: Creation of Temporary File in Directory with Insecure Permissions, where the product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file. In Openapi generator maven plugin, 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

### Impact Using `File.createTempFile` in JDK will result in creating and using insecure temporary files that can leave application and system data vulnerable to attacks. This vulnerability only impacts unix-like systems where the local system temporary directory is shared between all users. This vulnerability does not impact Windows or modern versions of MacOS. OpenAPI Generator Maven plug-in creates insecure temporary files during the code generation process. It creates insecure temporary files to store the OpenAPI specification files provided by the users and these temporary files can be read by any users in the system. The impact of this vulnerability is information disclosure of the contents of the specification file to other local users. ### Patches The issue has been patched with `Files.createTempFile` and released in the v5.1.0 stable version. ### For more information If you have any questions or comments about this advisory: * Open an issue in [OpenAPI Generator Github repo](https://github.com/openAPITools/openapi-generator/) * Email us at [security@openapitools.org](mailto:security@openapitools.org)

CVE-2021-21429 Affected Openapi generator maven plugin Versions

1 component(s)
Fixed Versions:
5.1.0
Product / Package Ecosystem Affected Versions Fixed Version
org.openapitools:openapi-generator-maven-plugin
Maven
< 5.1.0
5.1.0

References

Frequently Asked Questions

What is CVE-2021-21429?
CVE-2021-21429 is a security vulnerability in Openapi generator maven plugin involving Creation of Temporary File in Directory with Insecure Permissions in the OpenAPI Generator Maven plugin under CWE-379: Creation of Temporary File in Directory with Insecure Permissions.
Which Openapi generator maven plugin versions are affected?
Affected versions include releases prior to 5.1.0 across affected packages: org.openapitools:openapi-generator-maven-plugin.
What version fixes CVE-2021-21429?
Upgrading to 5.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openapi-generator-maven-plugin affected?
Yes, org.openapitools:openapi-generator-maven-plugin is affected in releases prior to 5.1.0. Upgrade your dependency to 5.1.0 or later.
What is the CVSS score of CVE-2021-21429?
CVE-2021-21429 has a CVSS v3.1 base score of 4.0 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-21429?
CVE-2021-21429 is classified under CWE-379: Creation of Temporary File in Directory with Insecure Permissions (The product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.).
How can I check Maven dependencies for CVE-2021-21429?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.openapitools'. 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-867q-77cc-98mv",
  "modified" : "2021-05-10T19:29:52Z",
  "published" : "2021-04-29T21:51:37Z",
  "aliases" : [ "CVE-2021-21429" ],
  "summary" : "Creation of Temporary File in Directory with Insecure Permissions in the OpenAPI Generator Maven plugin",
  "details" : "### Impact\n\nUsing `File.createTempFile` in JDK will result in creating and using insecure temporary files that can leave application and system data vulnerable to attacks. This vulnerability only impacts unix-like systems where the local system temporary directory is shared between all users. This vulnerability does not impact Windows or modern versions of MacOS.\n\nOpenAPI Generator Maven plug-in creates insecure temporary files during the code generation process. It creates insecure temporary files to store the OpenAPI specification files provided by the users and these temporary files can be read by any users in the system.\n\nThe impact of this vulnerability is information disclosure of the contents of the specification file to other local users.\n\n### Patches\nThe issue has been patched with `Files.createTempFile` and released in the v5.1.0 stable version.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [OpenAPI Generator Github repo](https://github.com/openAPITools/openapi-generator/)\n* Email us at [security@openapitools.org](mailto:security@openapitools.org)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.openapitools:openapi-generator-maven-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-867q-77cc-98mv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21429"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/OpenAPITools/openapi-generator/pull/8795"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/OpenAPITools/openapi-generator/blob/06ad7a51eff04393203cfa715e54e1fb59d984fe/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java#L782-L799"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-377", "CWE-378", "CWE-379", "CWE-552" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-27T19:58:51Z",
    "nvd_published_at" : "2021-04-27T20:15:00Z"
  }
}