What’s Vulnerable › Vulnerabilities
CVE-2021-21430: Creation of Temporary File in Directory with Insecure Permissions in auto-generated Java, Scala code
- Severity: medium (CVSS 5.5 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.4% probability of exploitation in the next 30 days
- Public exploit or detection template: yes
- Published: 2021-05-10 · updated 2026-06-17
- Weakness: CWE-269
Description
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec. Using `File.createTempFile` in JDK will result in creating and using insecure temporary files that can leave application and system data vulnerable to attacks. Auto-generated code (Java, Scala) that deals with uploading or downloading binary data through API endpoints will create insecure temporary files during the process. Affected generators: `java` (jersey2, okhttp-gson (default library)), `scala-finch`. The issue has been patched with `Files.createTempFile` and released in the v5.1.0 stable version.
Affected products
- OpenAPITools openapi-generator: before 5.1.1 — fixed in 5.1.1
How to fix
Upgrade to a fixed version: OpenAPITools openapi-generator 5.1.1. Check the vendor advisory for mitigations.
References
- https://github.com/OpenAPITools/openapi-generator/pull/8787
- https://github.com/OpenAPITools/openapi-generator/pull/8791
- https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-cqxr-xf2w-943w
- https://github.com/OpenAPITools/openapi-generator/pull/8787
- https://github.com/OpenAPITools/openapi-generator/pull/8791
- https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-cqxr-xf2w-943w
Get alerted when CVE-2021-21430 or the next vulnerability affects your stack