CVE-2021-21430: Insecure Permissions in auto-generated Java, Scala code

Summary

11/05/2021
Yes i
Moderate
6.2

CVE-2021-21430: Creation of Temporary File in Directory with Insecure Permissions in auto-generated Java, Scala code. Affects org.openapitools:openapi-generator versions < 5.1.0. Fixed in 5.1.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The openapi-generator package is a tool that generates API client libraries, server stubs, and documentation from an OpenAPI Specification. It supports multiple programming languages, including Java and Scala. The vulnerability affects the generated code in these languages that deals with uploading or downloading binary data through API endpoints. The code uses the JDK method File.createTempFile, which creates temporary files with insecure permissions, leaving application and system data vulnerable to exposure.

Vulnerability Detail

The vulnerability arises from the use of File.createTempFile, which creates temporary files with default permissions (-rw-r--r-- for files and drwxr-xr-x for directories) on Unix-like systems. This means that any user on the system can read the contents of these files. Auto-generated clients that download files, such as PDFs, will first save them to insecure temporary files. This can lead to unauthorized access to sensitive data. The vulnerability has a CVSS score of 6.2, indicating a moderate severity.

How To Fix

Latest published version: 7.26.0 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.1.0

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating the package is not immediately feasible, a workaround is to manually modify the generated code to use the JDK method Files.createTempFile instead of File.createTempFile. This method allows specifying secure file permissions. The following code snippet demonstrates the modification for the okhttp-gson library:

// Before
File tempFile = File.createTempFile(prefix, suffix);

// After
File tempFile = Files.createTempFile(prefix, suffix).toFile();

Conclusion

The vulnerability in the openapi-generator package allows for the creation of temporary files with insecure permissions, potentially exposing sensitive data. Users should update to version 5.1.0 or later to fix the vulnerability. If immediate update is not possible, manually modifying the generated code to use Files.createTempFile can serve as a workaround. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for org.openapitools:openapi-generator →

Share this vulnerability

FAQ

The vulnerability allows any user on the system to read the contents of temporary files created by the auto-generated code. This can lead to unauthorized access to sensitive data.

Versions prior to 5.1.0 of the openapi-generator package are affected by this vulnerability.

There are no known exploits for this vulnerability at the time of this advisory. However, it is recommended to apply the fix as soon as possible to mitigate the risk.

Yes, the CVSS score for this vulnerability is 6.2, indicating a moderate severity.

Yes, you can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.

Related vulnerabilities

Recent vulnerabilities recorded for org.openapitools:openapi-generator.

How To Fix

Latest published version: 7.26.0 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.1.0

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback