43 vulnerabilities classified as CWE-379 (在具有不安全权限的目录中创建临时文件). AI Chinese analysis included.
CWE-379 represents a critical input validation weakness where applications create temporary files in directories with overly permissive access controls. This flaw allows unintended actors to detect the file’s existence or manipulate its contents, potentially revealing sensitive application logic or user data. Attackers typically exploit this by monitoring the directory for new files, then employing race conditions or symbolic link attacks to redirect the application’s write operations to malicious targets. To mitigate this risk, developers must enforce strict file permissions, ensuring that only the creating process can access the temporary file. Utilizing secure system calls that automatically set restrictive permissions upon creation, such as O_CREAT with mode 0600, is essential. Additionally, storing temporary files in isolated, private directories further reduces the attack surface and prevents unauthorized visibility or interference.
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();try { File temp = File.createTempFile("pattern", ".suffix"); temp.deleteOnExit(); BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write("aString"); out.close(); } catch (IOException e) { }Vulnerabilities classified as CWE-379 (在具有不安全权限的目录中创建临时文件) represent 43 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.