CVE-2021-21429: Openapi generator maven plugin Creation Of Temporary File Vulnerability
MODERATECVE-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.
CVE-2021-21429 at a Glance
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).
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.
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
</dependency>
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
CVE-2021-21429 Affected Openapi generator maven plugin Versions
1 component(s)| 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?
Which Openapi generator maven plugin versions are affected?
What version fixes CVE-2021-21429?
Is openapi-generator-maven-plugin affected?
What is the CVSS score of CVE-2021-21429?
What CWE is associated with CVE-2021-21429?
How can I check Maven dependencies for CVE-2021-21429?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}