CWE-379: Creation of Temporary File in Directory with Insecure Permissions
The product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.
How it's found
Creation of Temporary File in Directory with Insecure Permissions is typically found by tracing untrusted input from where it enters the system to the point where it is used without the check or neutralization this weakness describes, combining manual code review with dynamic testing.
On some operating systems, the fact that the temporary file exists may be apparent to any user with sufficient privileges to access that directory. Since the file is visible, the application that is using the temporary file could be known. If one has access to list the processes on the system, the attacker has gained information about what the user is doing at that time. By correlating this with the applications the user is running, an attacker could potentially discover what a user's actions are. From this, higher levels of security could be breached.
Consequences
- Read Application Data: Since the file is visible and the application which is using the temp file could be known, the attacker has gained information about what the user is doing at that time.
Mitigations
- Requirements: Many contemporary languages have functions which properly handle this condition. Older C temp file functions are especially susceptible.
- Implementation: Try to store sensitive tempfiles in a directory which is not world readable -- i.e., per-user directories.
- Implementation: Avoid using vulnerable temp file functions.
Where this fits in a TurboPentest engagement
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Frequently asked questions
What is CWE-379?
The product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.
How do you find Creation of Temporary File in Directory with Insecure Permissions?
Creation of Temporary File in Directory with Insecure Permissions is typically found by tracing untrusted input from where it enters the system to the point where it is used without the check or neutralization this weakness describes, combining manual code review with dynamic testing.
What is the impact of CWE-379?
Read Application Data: Since the file is visible and the application which is using the temp file could be known, the attacker has gained information about what the user is doing at that time.
Does TurboPentest test for Creation of Temporary File in Directory with Insecure Permissions?
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Related CWEs
Written and reviewed by
Michel Chamberland - Founder & CEO, IntegSec
CISSP, OSCP, OSCE, CEH, GIAC, CCSK · 20+ years in offensive security
Michel has spent 20+ years on offensive security teams including IBM X-Force Red and Trustwave SpiderLabs, leading penetration tests, red team engagements, and breach response for Fortune 500 customers. He is the founder of IntegSec and the architect of TurboPentest.
Find these issues before an attacker does
TurboPentest runs an agentic AI pentest against your target and reports findings with proof, from $99 per target.
Start a pentest