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

- Severity: Medium 6.2 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.40%, higher than 36% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2021-05-10T19:25:12.000Z
- Modified: 2026-07-08T06:28:34.537Z
- Also known as: GHSA-cqxr-xf2w-943w
- Weaknesses: CWE-269, CWE-377, CWE-378, CWE-379, CWE-668
- Assigned by: GitHub_M

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

(As written by CVE List.)

## Affected

- OpenAPITools openapi-generator: < 5.1.0
- org.openapitools:openapi-generator (Maven): before 5.1.0
- openapi-generator openapi_generator: before 5.1.1

## Every score

- GitHub_M: CVSS:3.1 6.2 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- GitHub: CVSS:3.1 6.2 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- NVD: CVSS:3.1 5.5 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N`
- NVD: CVSS:2.0 2.1 Low `AV:L/AC:L/Au:N/C:P/I:N/A:N`

## References

- <https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-cqxr-xf2w-943w> (exploit, third-party-advisory, web)
- <https://github.com/OpenAPITools/openapi-generator/pull/8791> (patch, third-party-advisory, web)
- <https://github.com/OpenAPITools/openapi-generator/pull/8787> (patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-21430> (advisory)
- <https://github.com/OpenAPITools/openapi-generator/pull/9348> (web)
- <https://github.com/OpenAPITools/openapi-generator> (package)

## Sources

- CVE List: [CVE-2021-21430](https://www.cve.org/CVERecord?id=CVE-2021-21430), CVE Terms of Use, modified 2024-08-03
- GitHub Advisory Database: [GHSA-cqxr-xf2w-943w](https://github.com/advisories/GHSA-cqxr-xf2w-943w), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-21430](https://nvd.nist.gov/vuln/detail/CVE-2021-21430), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-21430 · Whole record: https://cve.day/CVE-2021-21430.json · Rebuilt by cve.day 2026-11-25T22:58:01.262Z
