Common examples occur in file archive extraction, in which the product begins the extraction with insecure default permissions, then only sets the final permissions (as specified in the archive) once the copy is complete. The larger the archive, the larger the timing window for the race condition.
This weakness has also occurred in some operating system utilities that perform copies of deeply nested directories containing a large number of files.
This weakness can occur in any type of functionality that involves copying objects or resources in a multi-user environment, including at the application level. For example, a document management system might allow a user to copy a private document, but if it does not set the new copy to be private as soon as the copy begins, then other users might be able to view the document while the copy is still taking place.
Scope | Impact | Likelihood |
---|---|---|
Confidentiality Integrity | Read Application Data, Modify Application Data |
Reference | Description |
---|---|
Archive extractor decompresses files with world-readable permissions, then later sets permissions to what the archive specified. | |
Product inserts a new object into database before setting the object's permissions, introducing a race condition. | |
Error file has weak permissions before a chmod is performed. | |
Archive permissions issue using hard link. | |
Database product creates files world-writable before initializing the setuid bits, leading to modification of executables. |
CAPEC-ID | Attack Pattern Name |
---|---|
CAPEC-26 | Leveraging Race Conditions The adversary targets a race condition occurring when multiple processes access and manipulate the same resource concurrently, and the outcome of the execution depends on the particular order in which the access takes place. The adversary can leverage a race condition by "running the race", modifying the resource and modifying the normal execution flow. For instance, a race condition can occur while accessing a file: the adversary can trick the system by replacing the original file with their version and cause the system to read the malicious file. |
CAPEC-27 | Leveraging Race Conditions via Symbolic Links This attack leverages the use of symbolic links (Symlinks) in order to write to sensitive files. An attacker can create a Symlink link to a target file not otherwise accessible to them. When the privileged program tries to create a temporary file with the same name as the Symlink link, it will actually write to the target file pointed to by the attackers' Symlink link. If the attacker can insert malicious content in the temporary file they will be writing to the sensitive file by using the Symlink. The race occurs because the system checks if the temporary file exists, then creates the file. The attacker would typically create the Symlink during the interval between the check and the creation of the temporary file. |
Name | Organization | Date | Date Release | Version |
---|---|---|---|---|
CWE Content Team | MITRE | Draft 9 |
Name | Organization | Date | Comment |
---|---|---|---|
CWE Content Team | MITRE | updated Applicable_Platforms, Relationships, Other_Notes, Weakness_Ordinalities | |
CWE Content Team | MITRE | updated Related_Attack_Patterns | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Common_Consequences | |
CWE Content Team | MITRE | updated References | |
CWE Content Team | MITRE | updated Modes_of_Introduction, Other_Notes | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Mapping_Notes |