CWE-378: Creation of Temporary File With Insecure Permissions
Opening temporary files without appropriate measures or controls can leave the file, its contents and any function that it impacts vulnerable to attack.
Last updated
Opening temporary files without appropriate measures or controls can leave the file, its contents and any function that it impacts vulnerable to attack.
Last updated
44 recorded CVEs are caused by CWE-378 (Creation of Temporary File With Insecure Permissions). The highest-severity and most recent are shown first. 9 new CWE-378 CVEs have been recorded so far in 2026 (9 in 2025).
Creation of Temporary File With Insecure Permissions in Siemens Remote Connect Server
Creation of Temporary File with Insecure Permissions in Qualcomm Software Center
Local privilege escalation in make-initrd-ng
Gradle vulnerable to local privilege escalation through system temporary directory
JumpCloud Remote Assist < 0.317.0 Arbitrary File Write/Delete via Insecure Temp Directory
Point B Ltd Getscreen Agent MSI Installer getscreen.msi temp file
Incomplete Fix for CVE-2025-10279: Insecure Temporary Directory Permissions in mlflow/mlflow
Avaya Aura Device Services Arbitrary Code Execution Vulnerability
Showing 12 of 44 recorded CWE-378 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-378 is exploited.
Read Application Data
Affects: Confidentiality
If the temporary file can be read by the attacker, sensitive information may be in that file which could be revealed.
Other
Affects: Authorization, Other
If that file can be written to by the attacker, the file might be moved into a place to which the attacker does not have access. This will allow the attacker to gain selective resource access-control privileges.
Other
Affects: Integrity, Other
Depending on the data stored in the temporary file, there is the potential for an attacker to gain an additional input vector which is trusted as non-malicious. It may be possible to make arbitrary changes to data structures, user information, or even process ownership.
Typically introduced during these phases of the software lifecycle.
Practical mitigations for CWE-378, grouped by where in the lifecycle they apply.
Many contemporary languages have functions which properly handle this condition. Older C temp file functions are especially susceptible.
Ensure that you use proper file permissions. This can be achieved by using a safe temp file function. Temporary files should be writable and readable only by the process that owns the file.
Randomize temporary file names. This can also be achieved by using a safe temp-file function. This will ensure that temporary files will not be created in predictable places.
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
MITRE examples of the weakness in code.
In the following code examples a temporary file is created and written to. After using the temporary file, the file is closed and deleted from the file system.
Vulnerable example
FILE *stream;
if( (stream = tmpfile()) == NULL ) {
perror("Could not open new temporary file\n");
return (-1);
}
// write data to tmp file
...
// remove tmp file
rmtmp();Vulnerable example
try {
File temp = File.createTempFile("pattern", ".suffix");
temp.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(temp));
out.write("aString");
out.close();
}
catch (IOException e) {
}Real CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-378.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-378 CVE affects your products, with AI-written analysis and remediation steps.