Creation of Temporary File in Directory with Incorrect PermissionsID: 379 | Date: (C)2012-05-14 (M)2022-10-10 |
Type: weakness | Status: INCOMPLETE |
Abstraction Type: Base |
Description
The software creates a temporary file in a directory whose
permissions allow unintended actors to determine the file's existence or
otherwise access that file.
Extended DescriptionOn 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.
Likelihood of Exploit: Low
Applicable PlatformsLanguage Class: All
Time Of Introduction
- Architecture and Design
- Implementation
Common Consequences
Scope | Technical Impact | Notes |
---|
Confidentiality | 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. |
Detection MethodsNone
Potential Mitigations
Phase | Strategy | Description | Effectiveness | Notes |
---|
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. | | |
Relationships
Related CWE | Type | View | Chain |
---|
CWE-379 ChildOf CWE-895 | Category | CWE-888 | |
Demonstrative Examples (Details)
- In the following code examples a temporary file is created and
written to and after using the temporary file the file is closed and deleted
from the file system. (Demonstrative Example Id DX-101)
White Box Definitions None
Black Box Definitions None
Taxynomy Mappings
Taxynomy | Id | Name | Fit |
---|
CLASP | | Guessed or visible temporary file | |
CERT C Secure Coding | FIO15-C | Ensure that file operations are performed in a secure
directory | |
CERT C Secure Coding | FIO43-C | Do not create temporary files in shared
directories | |
CERT C++ Secure Coding | FIO15-CPP | Ensure that file operations are performed in a secure
directory | |
CERT C++ Secure Coding | FIO43-CPP | Do not create temporary files in shared
directories | |
References:
- Mark Dowd John McDonald Justin Schuh .The Art of Software Security Assessment 1st Edition. Addison Wesley. Section:'Chapter 9, "Temporary Files", Page 538.'. Published on 2006.