[Forgot Password]
Login  Register Subscribe

30479

 
 

423868

 
 

248392

 
 

909

 
 

195452

 
 

282

Paid content will be excluded from the download.


Download | Alert*
CWE
view XML

Creation of Temporary File in Directory with Incorrect Permissions

ID: 379Date: (C)2012-05-14   (M)2022-10-10
Type: weaknessStatus: 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 Description

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.

Likelihood of Exploit: Low

Applicable Platforms
Language Class: All

Time Of Introduction

  • Architecture and Design
  • Implementation

Common Consequences

ScopeTechnical ImpactNotes
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 Methods
None

Potential Mitigations

PhaseStrategyDescriptionEffectivenessNotes
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 CWETypeViewChain
CWE-379 ChildOf CWE-895 Category CWE-888  

Demonstrative Examples   (Details)

  1. 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

TaxynomyIdNameFit
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:

  1. 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.
CVE    10
CVE-2021-21068
CVE-2021-21100
CVE-2021-28597
CVE-2021-28623
...

© SecPod Technologies