This rule is Obsolete | |
Synopsis: | Using an insecure temporary file creation function |
Language: | C++ |
Severity Level: | 3 |
Category: | Security |
Description: |
This rule is about cases where a temporary file is created in an insecure manner. When that happens in a program that runs with elevated privileges, the program is vulnerable to race condition attacks and can be used to subvert system security. Many programs create temporary files in shared directories such as
If the name of a temporary file is easily guessed, or the filename is used unsafely after temp file creation, or the umask is not safely set before calling a safe routine, an attacker can take control of a vulnerable application and system. Avoid using insecure temporary file creation routines. Instead, use
The following example generates a defect
because
void secure_temp_example() { char *tmp, *tmp2, *tmp3; char buffer[1024]; tmp = mktemp(buffer); } |