CWE-226 – Sensitive Information in Resource Not Removed Before Reuse

Read Time:1 Minute, 48 Second

Description

The product releases a resource such as memory or a file so that it can be made available for reuse, but it does not clear or “zeroize” the information contained in the resource before the product performs a critical state transition or makes the resource available for reuse by other entities.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-459
CWE-212
CWE-201

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Architecture and Design, Implementation

Effectiveness: High

Description: 

During critical state transitions, information not needed in the next state should be removed or overwritten with fixed patterns (such as all 0’s) or random data, before the transition to the next state.

Phase: Architecture and Design, Implementation

Effectiveness: High

Description: 

When releasing, de-allocating, or deleting a resource, overwrite its data and relevant metadata with fixed patterns or random data. Be cautious about complex resource types whose underlying representation might be non-contiguous or change at a low level, such as how a file might be split into different chunks on a file system, even though “logical” file positions are contiguous at the application layer. Such resource types might require invocation of special modes or APIs to tell the underlying operating system to perform the necessary clearing, such as SDelete (Secure Delete) on Windows, although the appropriate functionality might not be available at the application layer.

CVE References

  • CVE-2003-0001
    • Ethernet NIC drivers do not pad frames with null bytes, leading to infoleak from malformed packets.
  • CVE-2003-0291
    • router does not clear information from DHCP packets that have been previously used
  • CVE-2005-1406
    • Products do not fully clear memory buffers when less data is stored into the buffer than previous.
  • CVE-2005-1858
    • Products do not fully clear memory buffers when less data is stored into the buffer than previous.
  • CVE-2005-3180
    • Products do not fully clear memory buffers when less data is stored into the buffer than previous.
  • CVE-2005-3276
    • Product does not clear a data structure before writing to part of it, yielding information leak of previously used memory.

CWE-224 – Obscured Security-relevant Information by Alternate Name

Read Time:21 Second

Description

The software records security-relevant information according to an alternate name of the affected entity, instead of the canonical name.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation, Access Control: Hide Activities, Gain Privileges or Assume Identity

 

Potential Mitigations

CVE References

  • CVE-2002-0725
    • Attacker performs malicious actions on a hard link to a file, obscuring the real target file.

CWE-223 – Omission of Security-relevant Information

Read Time:34 Second

Description

The application does not record or display information that would be important for identifying the source or nature of an attack, or determining if an action is safe.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation: Hide Activities

The source of an attack will be difficult or impossible to determine. This can allow attacks to the system to continue without notice.

 

Potential Mitigations

CVE References

  • CVE-1999-1029
    • Login attempts not recorded if user disconnects before maximum number of tries.
  • CVE-2002-1839
    • Sender’s IP address not recorded in outgoing e-mail.
  • CVE-2000-0542
    • Failed authentication attempt not recorded if later attempt succeeds.

CWE-222 – Truncation of Security-relevant Information

Read Time:35 Second

Description

The application truncates the display, recording, or processing of security-relevant information in a way that can obscure the source or nature of an attack.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation: Hide Activities

The source of an attack will be difficult or impossible to determine. This can allow attacks to the system to continue without notice.

 

Potential Mitigations

CVE References

  • CVE-2005-0585
    • Web browser truncates long sub-domains or paths, facilitating phishing.
  • CVE-2004-2032
    • Bypass URL filter via a long URL with a large number of trailing hex-encoded space characters.
  • CVE-2003-0412
    • Does not log complete URI of a long request (truncation).

CWE-221 – Information Loss or Omission

Read Time:19 Second

Description

The software does not record, or improperly records, security-relevant information that leads to an incorrect decision or hampers later analysis.

This can be resultant, e.g. a buffer overflow might trigger a crash before the product can log the event.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-664

 

Consequences

Non-Repudiation: Hide Activities

 

Potential Mitigations

CVE References

CWE-220 – Storage of File With Sensitive Data Under FTP Root

Read Time:30 Second

Description

The application stores sensitive data under the FTP server root with insufficient access control, which might make it accessible to untrusted parties.

Various Unix FTP servers require a password file that is under the FTP root, due to use of chroot.

Modes of Introduction:

– Operation

 

 

Related Weaknesses

CWE-552

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Implementation, System Configuration

Description: 

Avoid storing information under the FTP root directory.

Phase: System Configuration

Description: 

Access control permissions should be set to prevent reading/writing of sensitive files inside/outside of the FTP directory.

CVE References

CWE-22 – Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Read Time:4 Minute, 31 Second

Description

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-706
CWE-706
CWE-668

 

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

Phase: Implementation

Description: 

Phase: Architecture and Design

Description: 

For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

Phase: Implementation

Description: 

Phase: Architecture and Design

Description: 

Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

Phase: Operation

Effectiveness: Moderate

Description: 

Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth.

An application firewall might not cover all possible input vectors. In addition, attack techniques might be available to bypass the protection mechanism, such as using malformed inputs that can still be processed by the component that receives those inputs. Depending on functionality, an application firewall might inadvertently reject or modify legitimate requests. Finally, some manual effort may be required for customization.

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.

Phase: Architecture and Design

Description: 

Phase: Architecture and Design, Operation

Effectiveness: Limited

Description: 

The effectiveness of this mitigation depends on the prevention capabilities of the specific sandbox or jail being used and might only help to reduce the scope of an attack, such as restricting the attacker to certain system calls or limiting the portion of the file system that can be accessed.

Phase: Architecture and Design, Operation

Description: 

Phase: Implementation

Description: 

Phase: Operation, Implementation

Description: 

When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.

CVE References

  • CVE-2010-0467
    • Newsletter module allows reading arbitrary files using “../” sequences.
  • CVE-2009-4194
    • FTP server allows deletion of arbitrary files using “..” in the DELE command.
  • CVE-2009-4053
    • FTP server allows creation of arbitrary directories using “..” in the MKD command.
  • CVE-2009-0244
    • FTP service for a Bluetooth device allows listing of directories, and creation or reading of files using “..” sequences.
  • CVE-2009-4013
    • Software package maintenance program allows overwriting arbitrary files using “../” sequences.
  • CVE-2009-4449
    • Bulletin board allows attackers to determine the existence of files using the avatar.
  • CVE-2009-4581
    • PHP program allows arbitrary code execution using “..” in filenames that are fed to the include() function.
  • CVE-2010-0013
    • Chat program allows overwriting files using a custom smiley request.
  • CVE-2008-5748
    • Chain: external control of values for user’s desired language and theme enables path traversal.
  • CVE-2009-1936
    • Chain: library file sends a redirect if it is directly requested but continues to execute, allowing remote file inclusion and path traversal.

CWE-219 – Storage of File with Sensitive Data Under Web Root

Read Time:53 Second

Description

The application stores sensitive data under the web document root with insufficient access control, which might make it accessible to untrusted parties.

Besides public-facing web pages and code, applications may store sensitive data, code that is not directly invoked, or other files under the web document root of the web server. If the server is not configured or otherwise used to prevent direct access to those files, then attackers may obtain this sensitive data.

Modes of Introduction:

– Operation

 

 

Related Weaknesses

CWE-552

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Implementation, System Configuration

Description: 

Avoid storing information under the web root directory.

Phase: System Configuration

Description: 

Access control permissions should be set to prevent reading/writing of sensitive files inside/outside of the web directory.

CVE References