CWE-363 – Race Condition Enabling Link Following

Read Time:41 Second

Description

The software checks the status of a file or directory before accessing it, which produces a race condition in which the file can be replaced with a link before the access is performed, causing the software to access the wrong file.

While developers might expect that there is a very narrow time window between the time of check and time of use, there is still a race condition. An attacker could cause the software to slow down (e.g. with memory consumption), causing the time window to become larger. Alternately, in some situations, the attacker could win the race by performing a large number of attacks.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-367
CWE-59

 

Consequences

Confidentiality, Integrity: Read Files or Directories, Modify Files or Directories

 

Potential Mitigations

CVE References

CWE-362 – Concurrent Execution using Shared Resource with Improper Synchronization (‘Race Condition’)

Read Time:4 Minute, 3 Second

Description

The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: Medium

 

Related Weaknesses

CWE-691

 

Consequences

Availability: DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Resource Consumption (Other)

When a race condition makes it possible to bypass a resource cleanup routine or trigger multiple initialization routines, it may lead to resource exhaustion (CWE-400).

Availability: DoS: Crash, Exit, or Restart, DoS: Instability

When a race condition allows multiple control flows to access a resource simultaneously, it might lead the program(s) into unexpected states, possibly resulting in a crash.

Confidentiality, Integrity: Read Files or Directories, Read Application Data

When a race condition is combined with predictable resource names and loose permissions, it may be possible for an attacker to overwrite or access confidential data (CWE-59).

 

Potential Mitigations

Phase: Architecture and Design

Description: 

In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.

Phase: Architecture and Design

Description: 

Use thread-safe capabilities such as the data access abstraction in Spring.

Phase: Architecture and Design

Description: 

Phase: Implementation

Description: 

When using multithreading and operating on shared variables, only use thread-safe functions.

Phase: Implementation

Description: 

Use atomic operations on shared variables. Be wary of innocent-looking constructs such as “x++”. This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write.

Phase: Implementation

Description: 

Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412.

Phase: Implementation

Description: 

Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization.

Phase: Implementation

Description: 

Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop.

Phase: Implementation

Description: 

Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help.

Phase: Architecture and Design, Operation

Description: 

Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

CVE References

  • CVE-2019-18827
    • chain: JTAG interface is not disabled (CWE-1191) during ROM code execution, introducing a race condition (CWE-362) to extract encryption keys
  • CVE-2014-8273
    • Chain: chipset has a race condition (CWE-362) between when an interrupt handler detects an attempt to write-enable the BIOS (in violation of the lock bit), and when the handler resets the write-enable bit back to 0, allowing attackers to issue BIOS writes during the timing window [REF-1237].
  • CVE-2008-5044
    • Race condition leading to a crash by calling a hook removal procedure while other activities are occurring at the same time.
  • CVE-2008-2958
    • chain: time-of-check time-of-use (TOCTOU) race condition in program allows bypass of protection mechanism that was designed to prevent symlink attacks.
  • CVE-2008-1570
    • chain: time-of-check time-of-use (TOCTOU) race condition in program allows bypass of protection mechanism that was designed to prevent symlink attacks.
  • CVE-2008-0058
    • Unsynchronized caching operation enables a race condition that causes messages to be sent to a deallocated object.
  • CVE-2008-0379
    • Race condition during initialization triggers a buffer overflow.
  • CVE-2007-6599
    • Daemon crash by quickly performing operations and undoing them, which eventually leads to an operation that does not acquire a lock.
  • CVE-2007-6180
    • chain: race condition triggers NULL pointer dereference
  • CVE-2007-5794
    • Race condition in library function could cause data to be sent to the wrong process.
  • CVE-2007-3970
    • Race condition in file parser leads to heap corruption.
  • CVE-2008-5021
    • chain: race condition allows attacker to access an object while it is still being initialized, causing software to access uninitialized memory.
  • CVE-2009-4895
    • chain: race condition for an argument value, possibly resulting in NULL dereference
  • CVE-2009-3547
    • chain: race condition might allow resource to be released before operating on it, leading to NULL dereference
  • CVE-2006-5051
    • Chain: Signal handler contains too much functionality (CWE-828), introducing a race condition (CWE-362) that leads to a double free (CWE-415).

CWE-360 – Trust of System Event Data

Read Time:54 Second

Description

Security based on event locations are insecure and can be spoofed.

Events are a messaging system which may provide control data to programs listening for events. Events often do not have any type of authentication framework to allow them to be verified from a trusted source. Any application, in Windows, on a given desktop can send a message to any window on the same desktop. There is no authentication framework for these messages. Therefore, any message can be used to manipulate any process on the desktop if the process does not check the validity and safeness of those messages.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-345

 

Consequences

Integrity, Confidentiality, Availability, Access Control: Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands

If one trusts the system-event information and executes commands based on it, one could potentially take actions based on a spoofed identity.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Never trust or rely any of the information in an Event for security.

CVE References

CWE-36 – Absolute Path Traversal

Read Time:2 Minute, 58 Second

Description

The software uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize absolute path sequences such as “/abs/path” that can resolve to a location that is outside of that directory.

This allows attackers to traverse the file system to access files or directories that are outside of the restricted directory.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-22
CWE-22
CWE-22

 

Consequences

Integrity, Confidentiality, Availability: Execute Unauthorized Code or Commands

The attacker may be able to create or overwrite critical files that are used to execute code, such as programs or libraries.

Integrity: Modify Files or Directories

The attacker may be able to overwrite or create critical files, such as programs, libraries, or important data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, appending a new account at the end of a password file may allow an attacker to bypass authentication.

Confidentiality: Read Files or Directories

The attacker may be able read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file, the attacker could conduct brute force password guessing attacks in order to break into an account on the system.

Availability: DoS: Crash, Exit, or Restart

The attacker may be able to overwrite, delete, or corrupt unexpected critical files such as programs, libraries, or important data. This may prevent the software from working at all and in the case of a protection mechanisms such as authentication, it has the potential to lockout every user of the software.

 

Potential Mitigations

CVE References

  • CVE-2002-1345
    • Multiple FTP clients write arbitrary files via absolute paths in server responses
  • CVE-2000-0614
    • Arbitrary files may be overwritten via compressed attachments that specify absolute path names for the decompressed output.
  • CVE-1999-1263
    • Mail client allows remote attackers to overwrite arbitrary files via an e-mail message containing a uuencoded attachment that specifies the full pathname for the file to be modified.
  • CVE-2003-0753
    • Remote attackers can read arbitrary files via a full pathname to the target file in config parameter.
  • CVE-2002-1525
    • Remote attackers can read arbitrary files via an absolute pathname.
  • CVE-2001-0038
    • Remote attackers can read arbitrary files by specifying the drive letter in the requested URL.
  • CVE-2001-0255
    • FTP server allows remote attackers to list arbitrary directories by using the “ls” command and including the drive letter name (e.g. C:) in the requested pathname.
  • CVE-2001-0933
    • FTP server allows remote attackers to list the contents of arbitrary drives via a ls command that includes the drive letter as an argument.
  • CVE-2002-0466
    • Server allows remote attackers to browse arbitrary directories via a full pathname in the arguments to certain dynamic pages.
  • CVE-2002-1483
    • Remote attackers can read arbitrary files via an HTTP request whose argument is a filename of the form “C:” (Drive letter), “//absolute/path”, or “..” .
  • CVE-2004-2488
    • FTP server read/access arbitrary files using “C:” filenames
  • CVE-2001-0687
    • FTP server allows a remote attacker to retrieve privileged web server system information by specifying arbitrary paths in the UNC format (\computernamesharename).

CWE-359 – Exposure of Private Personal Information to an Unauthorized Actor

Read Time:23 Second

Description

The product does not properly prevent a person’s private, personal information from being accessed by actors who either (1) are not explicitly authorized to access the information or (2) do not have the implicit consent of the person about whom the information is collected.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-200

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Requirements

Description: 

Phase: Architecture and Design

Description: 

CVE References

CWE-358 – Improperly Implemented Security Check for Standard

Read Time:1 Minute, 1 Second

Description

The software does not implement or incorrectly implements one or more security-relevant checks as specified by the design of a standardized algorithm, protocol, or technique.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-573
CWE-693
CWE-345
CWE-290

 

Consequences

Access Control: Bypass Protection Mechanism

 

Potential Mitigations

CVE References

  • CVE-2002-0862
    • Browser does not verify Basic Constraints of a certificate, even though it is required, allowing spoofing of trusted certificates.
  • CVE-2002-0970
    • Browser does not verify Basic Constraints of a certificate, even though it is required, allowing spoofing of trusted certificates.
  • CVE-2002-1407
    • Browser does not verify Basic Constraints of a certificate, even though it is required, allowing spoofing of trusted certificates.
  • CVE-2005-0198
    • Logic error prevents some required conditions from being enforced during Challenge-Response Authentication Mechanism with MD5 (CRAM-MD5).
  • CVE-2004-2163
    • Shared secret not verified in a RADIUS response packet, allowing authentication bypass by spoofing server replies.
  • CVE-2005-2181
    • Insufficient verification in VoIP implementation, in violation of standard, allows spoofed messages.
  • CVE-2005-2182
    • Insufficient verification in VoIP implementation, in violation of standard, allows spoofed messages.
  • CVE-2005-2298
    • Security check not applied to all components, allowing bypass.

CWE-357 – Insufficient UI Warning of Dangerous Operations

Read Time:18 Second

Description

The user interface provides a warning to a user regarding dangerous or sensitive operations, but the warning is not noticeable enough to warrant attention.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-693

 

Consequences

Non-Repudiation: Hide Activities

 

Potential Mitigations

CVE References

  • CVE-2007-1099
    • User not sufficiently warned if host key mismatch occurs

CWE-356 – Product UI does not Warn User of Unsafe Actions

Read Time:1 Minute, 6 Second

Description

The software’s user interface does not warn the user before undertaking an unsafe action on behalf of that user. This makes it easier for attackers to trick users into inflicting damage to their system.

Software systems should warn users that a potentially dangerous action may occur if the user proceeds. For example, if the user downloads a file from an unknown source and attempts to execute the file on their machine, then the application’s GUI can indicate that the file is unsafe.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation: Hide Activities

 

Potential Mitigations

CVE References

  • CVE-1999-1055
    • Product does not warn user when document contains certain dangerous functions or macros.
  • CVE-1999-0794
    • Product does not warn user when document contains certain dangerous functions or macros.
  • CVE-2000-0277
    • Product does not warn user when document contains certain dangerous functions or macros.
  • CVE-2000-0517
    • Product does not warn user about a certificate if it has already been accepted for a different site. Possibly resultant.
  • CVE-2005-0602
    • File extractor does not warn user it setuid/setgid files could be extracted. Overlaps privileges/permissions.
  • CVE-2000-0342
    • E-mail client allows bypass of warning for dangerous attachments via a Windows .LNK file that refers to the attachment.

CWE-354 – Improper Validation of Integrity Check Value

Read Time:1 Minute, 9 Second

Description

The software does not validate or incorrectly validates the integrity check values or “checksums” of a message. This may prevent it from detecting if the data has been modified or corrupted in transmission.

Improper validation of checksums before use results in an unnecessary risk that can easily be mitigated. The protocol specification describes the algorithm used for calculating the checksum. It is then a simple matter of implementing the calculation and verifying that the calculated checksum and the received checksum match. Improper verification of the calculated checksum and the received checksum can lead to far greater consequences.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: Medium

 

Related Weaknesses

CWE-345
CWE-345
CWE-754
CWE-353

 

Consequences

Integrity, Other: Modify Application Data, Other

Integrity checks usually use a secret key that helps authenticate the data origin. Skipping integrity checking generally opens up the possibility that new data from an invalid source can be injected.

Integrity, Other: Other

Data that is parsed and used may be corrupted.

Non-Repudiation, Other: Hide Activities, Other

Without a checksum check, it is impossible to determine if any changes have been made to the data after it was sent.

 

Potential Mitigations

Phase: Implementation

Description: 

Ensure that the checksums present in messages are properly checked in accordance with the protocol specification before they are parsed and used.

CVE References

CWE-353 – Missing Support for Integrity Check

Read Time:1 Minute, 15 Second

Description

The software uses a transmission protocol that does not include a mechanism for verifying the integrity of the data during transmission, such as a checksum.

If integrity check values or “checksums” are omitted from a protocol, there is no way of determining if data has been corrupted in transmission. The lack of checksum functionality in a protocol removes the first application-level check of data that can be used. The end-to-end philosophy of checks states that integrity checks should be performed at the lowest level that they can be completely implemented. Excluding further sanity checks and input validation performed by applications, the protocol’s checksum is the most important level of checksum, since it can be performed more completely than at any previous level and takes into account entire messages, as opposed to single packets.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: Medium

 

Related Weaknesses

CWE-345
CWE-354

 

Consequences

Integrity, Other: Other

Data that is parsed and used may be corrupted.

Non-Repudiation, Other: Hide Activities, Other

Without a checksum it is impossible to determine if any changes have been made to the data after it was sent.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Add an appropriately sized checksum to the protocol, ensuring that data received may be simply validated before it is parsed and used.

Phase: Implementation

Description: 

Ensure that the checksums present in the protocol design are properly implemented and added to each message before it is sent.

CVE References