Tag Archives: CVE-2019-15900

CWE-457 – Use of Uninitialized Variable

Read Time:2 Minute, 17 Second

Description

The code uses a variable that has not been initialized, leading to unpredictable or unintended results.

In some languages such as C and C++, stack variables are not initialized by default. They generally contain junk data with the contents of stack memory before the function was invoked. An attacker can sometimes control or read these contents. In other languages or conditions, a variable that is not explicitly initialized can be given a default value that has security implications, depending on the logic of the program. The presence of an uninitialized variable can sometimes indicate a typographic error in the code.

Modes of Introduction:

– Implementation

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-908
CWE-665
CWE-665

 

Consequences

Availability, Integrity, Other: Other

Initial variables usually contain junk, which can not be trusted for consistency. This can lead to denial of service conditions, or modify control flow in unexpected ways. In some cases, an attacker can “pre-initialize” the variable using previous actions, which might enable code execution. This can cause a race condition if a lock variable check passes when it should not.

Authorization, Other: Other

Strings that are not initialized are especially dangerous, since many functions expect a null at the end — and only at the end — of a string.

 

Potential Mitigations

Phase: Implementation

Description: 

Assign all variables to an initial value.

Phase: Build and Compilation

Description: 

Most compilers will complain about the use of uninitialized variables if warnings are turned on.

Phase: Implementation, Operation

Description: 

When using a language that does not require explicit declaration of variables, run or compile the software in a mode that reports undeclared or unknown variables. This may indicate the presence of a typographic error in the variable’s name.

Phase: Requirements

Description: 

The choice could be made to use a language that is not susceptible to these issues.

Phase: Architecture and Design

Description: 

Mitigating technologies such as safe string libraries and container abstractions could be introduced.

CVE References

  • CVE-2019-15900
    • Chain: sscanf() call is used to check if a username and group exists, but the return value of sscanf() call is not checked (CWE-252), causing an uninitialized variable to be checked (CWE-457), returning success to allow authorization bypass for executing a privileged (CWE-863).
  • CVE-2008-3688
    • Chain: A denial of service may be caused by an uninitialized variable (CWE-457) allowing an infinite loop (CWE-835) resulting from a connection to an unresponsive server.
  • CVE-2008-0081
    • Uninitialized variable leads to code execution in popular desktop application.
  • CVE-2007-4682
    • Crafted input triggers dereference of an uninitialized object pointer.
  • CVE-2007-3468
    • Crafted audio file triggers crash when an uninitialized variable is used.

CWE-863 – Incorrect Authorization

Read Time:3 Minute, 16 Second

Description

The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.

An access control list (ACL) represents who/what has permissions to a given object. Different operating systems implement (ACLs) in different ways. In UNIX, there are three types of permissions: read, write, and execute. Users are divided into three classes for file access: owner, group owner, and all other users where each class has a separate set of rights. In Windows NT, there are four basic types of permissions for files: “No access”, “Read access”, “Change access”, and “Full control”. Windows NT extends the concept of three types of users in UNIX to include a list of users and groups along with their associated permissions. A user can create an object (file) and assign specified permissions to that object.

Modes of Introduction:

– Architecture and Design

Likelihood of Exploit: High

 

Related Weaknesses

CWE-285
CWE-284

 

Consequences

Confidentiality: Read Application Data, Read Files or Directories

An attacker could read sensitive data, either by reading the data directly from a data store that is not correctly restricted, or by accessing insufficiently-protected, privileged functionality to read the data.

Integrity: Modify Application Data, Modify Files or Directories

An attacker could modify sensitive data, either by writing the data directly to a data store that is not correctly restricted, or by accessing insufficiently-protected, privileged functionality to write the data.

Access Control: Gain Privileges or Assume Identity, Bypass Protection Mechanism

An attacker could gain privileges by modifying or reading critical data directly, or by accessing privileged functionality.

 

Potential Mitigations

Phase: Architecture and Design

Effectiveness:

Description: 

Phase: Architecture and Design

Effectiveness:

Description: 

Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient’s doctor [REF-7].

Phase: Architecture and Design

Effectiveness:

Description: 

Phase: Architecture and Design

Effectiveness:

Description: 

Phase: System Configuration, Installation

Effectiveness:

Description: 

Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a “default deny” policy when defining these ACLs.

CVE References

 

  • CVE-2019-15900
    • Chain: sscanf() call is used to check if a username and group exists, but the return value of sscanf() call is not checked (CWE-252), causing an uninitialized variable to be checked (CWE-457), returning success to allow authorization bypass for executing a privileged (CWE-863).
  • CVE-2009-2213
    • Gateway uses default “Allow” configuration for its authorization settings.
  • CVE-2009-0034
    • Chain: product does not properly interpret a configuration option for a system group, allowing users to gain privileges.
  • CVE-2008-6123
    • Chain: SNMP product does not properly parse a configuration option for which hosts are allowed to connect, allowing unauthorized IP addresses to connect.
  • CVE-2008-7109
    • Chain: reliance on client-side security (CWE-602) allows attackers to bypass authorization using a custom client.
  • CVE-2008-3424
    • Chain: product does not properly handle wildcards in an authorization policy list, allowing unintended access.
  • CVE-2008-4577
    • ACL-based protection mechanism treats negative access rights as if they are positive, allowing bypass of intended restrictions.
  • CVE-2006-6679
    • Product relies on the X-Forwarded-For HTTP header for authorization, allowing unintended access by spoofing the header.
  • CVE-2005-2801
    • Chain: file-system code performs an incorrect comparison (CWE-697), preventing default ACLs from being properly applied.
  • CVE-2001-1155
    • Chain: product does not properly check the result of a reverse DNS lookup because of operator precedence (CWE-783), allowing bypass of DNS-based access restrictions.