CWE-44 – Path Equivalence: ‘file.name’ (Internal Dot)

Read Time:20 Second

Description

A software system that accepts path input in the form of internal dot (‘file.ordir’) without appropriate validation can lead to ambiguous path resolution and allow an attacker to traverse the file system to unintended locations or access arbitrary files.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-41

 

Consequences

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

 

Potential Mitigations

CVE References

CWE-439 – Behavioral Change in New Version or Environment

Read Time:43 Second

Description

A’s behavior or functionality changes with a new version of A, or a new environment, which is not known (or manageable) by B.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-435

 

Consequences

Other: Quality Degradation, Varies by Context

 

Potential Mitigations

CVE References

  • CVE-2002-1976
    • Linux kernel 2.2 and above allow promiscuous mode using a different method than previous versions, and ifconfig is not aware of the new method (alternate path property).
  • CVE-2005-1711
    • Product uses defunct method from another product that does not return an error code and allows detection avoidance.
  • CVE-2003-0411
    • chain: Code was ported from a case-sensitive Unix platform to a case-insensitive Windows platform where filetype handlers treat .jsp and .JSP as different extensions. JSP source code may be read because .JSP defaults to the filetype “text”.

CWE-437 – Incomplete Model of Endpoint Features

Read Time:20 Second

Description

A product acts as an intermediary or monitor between two or more endpoints, but it does not have a complete model of an endpoint’s features, behaviors, or state, potentially causing the product to perform incorrect actions based on this incomplete model.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-436

 

Consequences

Integrity, Other: Unexpected State, Varies by Context

 

Potential Mitigations

CVE References

CWE-436 – Interpretation Conflict

Read Time:1 Minute, 29 Second

Description

Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B’s state.

This is generally found in proxies, firewalls, anti-virus software, and other intermediary devices that monitor, allow, deny, or modify traffic based on how the client or server is expected to behave.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-435

 

Consequences

Integrity, Other: Unexpected State, Varies by Context

 

Potential Mitigations

CVE References

  • CVE-2005-1215
    • Bypass filters or poison web cache using requests with multiple Content-Length headers, a non-standard behavior.
  • CVE-2002-0485
    • Anti-virus product allows bypass via Content-Type and Content-Disposition headers that are mixed case, which are still processed by some clients.
  • CVE-2002-1978
    • FTP clients sending a command with “PASV” in the argument can cause firewalls to misinterpret the server’s error as a valid response, allowing filter bypass.
  • CVE-2002-1979
    • FTP clients sending a command with “PASV” in the argument can cause firewalls to misinterpret the server’s error as a valid response, allowing filter bypass.
  • CVE-2002-0637
    • Virus product bypass with spaces between MIME header fields and the “:” separator, a non-standard message that is accepted by some clients.
  • CVE-2002-1777
    • AV product detection bypass using inconsistency manipulation (file extension in MIME Content-Type vs. Content-Disposition field).
  • CVE-2005-3310
    • CMS system allows uploads of files with GIF/JPG extensions, but if they contain HTML, Internet Explorer renders them as HTML instead of images.
  • CVE-2005-4260
    • Interpretation conflict allows XSS via invalid “” is expected, which is treated as “>” by many web browsers.
  • CVE-2005-4080
    • Interpretation conflict (non-standard behavior) enables XSS because browser ignores invalid characters in the middle of tags.

CWE-435 – Improper Interaction Between Multiple Correctly-Behaving Entities

Read Time:31 Second

Description

An interaction error occurs when two entities have correct behavior when running independently of each other, but when they are integrated as components in a larger system or process, they introduce incorrect behaviors that may cause resultant weaknesses.

When a system or process combines multiple independent components, this often produces new, emergent behaviors at the system level. However, if the interactions between these components are not fully accounted for, some of the emergent behaviors can be incorrect or even insecure.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

 

Consequences

Integrity: Unexpected State, Varies by Context

 

Potential Mitigations

CVE References

CWE-434 – Unrestricted Upload of File with Dangerous Type

Read Time:3 Minute, 48 Second

Description

The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product’s environment.

Modes of Introduction:

– Implementation

 

Likelihood of Exploit: Medium

 

Related Weaknesses

CWE-669
CWE-669
CWE-351
CWE-436
CWE-430

 

Consequences

Integrity, Confidentiality, Availability: Execute Unauthorized Code or Commands

Arbitrary code execution is possible if an uploaded file is interpreted and executed as code by the recipient. This is especially true for .asp and .php extensions uploaded to web servers because these file types are often treated as automatically executable, even when file system permissions do not specify execution. For example, in Unix environments, programs typically cannot run unless the execute bit is set, but PHP programs may be executed by the web server without directly invoking them on the operating system.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.[REF-422] [REF-423]

Phase: Architecture and Design

Description: 

When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.

Phase: Architecture and Design

Description: 

Consider storing the uploaded files outside of the web document root entirely. Then, use other mechanisms to deliver the files dynamically. [REF-423]

Phase: Implementation

Description: 

Phase: Architecture and Design

Description: 

Define a very limited set of allowable extensions and only generate filenames that end in these extensions. Consider the possibility of XSS (CWE-79) before allowing .html or .htm file types.

Phase: Implementation

Description: 

Ensure that only one extension is used in the filename. Some web servers, including some versions of Apache, may process files based on inner extensions so that “filename.php.gif” is fed to the PHP interpreter.[REF-422] [REF-423]

Phase: Implementation

Description: 

When running on a web server that supports case-insensitive filenames, perform case-insensitive evaluations of the extensions that are provided.

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: 

Do not rely exclusively on sanity checks of file contents to ensure that the file is of the expected type and size. It may be possible for an attacker to hide code in some file segments that will still be executed by the server. For example, GIF images may contain a free-form comments field.

Phase: Implementation

Description: 

Do not rely exclusively on the MIME content type or filename attribute when determining how to render a file. Validating the MIME content type and ensuring that it matches the extension is only a partial solution.

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, 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.

CVE References

  • CVE-2001-0901
    • Web-based mail product stores “.shtml” attachments that could contain SSI
  • CVE-2006-4558
    • Double “php” extension leaves an active php extension in the generated filename.
  • CVE-2006-6994
    • ASP program allows upload of .asp files by bypassing client-side checks

CWE-433 – Unparsed Raw Web Content Delivery

Read Time:1 Minute, 11 Second

Description

The software stores raw content or supporting code under the web document root with an extension that is not specifically handled by the server.

If code is stored in a file with an extension such as “.inc” or “.pl”, and the web server does not have a handler for that extension, then the server will likely send the contents of the file directly to the requester without the pre-processing that was expected. When that file contains sensitive information such as database credentials, this may allow the attacker to compromise the application or associated components.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-219

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Perform a type check before interpreting files.

Phase: Architecture and Design

Description: 

Do not store sensitive information in files which may be misinterpreted.

CVE References

  • CVE-2002-1886
    • “.inc” file stored under web document root and returned unparsed by the server
  • CVE-2002-2065
    • “.inc” file stored under web document root and returned unparsed by the server
  • CVE-2005-2029
    • “.inc” file stored under web document root and returned unparsed by the server
  • CVE-2007-3365
    • Chain: uppercase file extensions causes web server to return script source code instead of executing the script.

CWE-432 – Dangerous Signal Handler not Disabled During Sensitive Operations

Read Time:35 Second

Description

The application uses a signal handler that shares state with other signal handlers, but it does not properly mask or prevent those signal handlers from being invoked while the original signal handler is still running.

During the execution of a signal handler, it can be interrupted by another handler when a different signal is sent. If the two handlers share state – such as global variables – then an attacker can corrupt the state by sending another signal before the first handler has completed execution.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-364

 

Consequences

Integrity: Modify Application Data

 

Potential Mitigations

Phase: Implementation

Description: 

Turn off dangerous handlers when performing sensitive operations.

CVE References

CWE-431 – Missing Handler

Read Time:26 Second

Description

A handler is not available or implemented.

When an exception is thrown and not caught, the process has given up an opportunity to decide if a given failure or event is worth a change in execution.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-691
CWE-433

 

Consequences

Other: Varies by Context

 

Potential Mitigations

Phase: Implementation

Description: 

Handle all possible situations (e.g. error condition).

Phase: Implementation

Description: 

If an operation can throw an Exception, implement a handler for that specific exception.

CVE References

CWE-430 – Deployment of Wrong Handler

Read Time:54 Second

Description

The wrong “handler” is assigned to process an object.

An example of deploying the wrong handler would be calling a servlet to reveal source code of a .JSP file, or automatically “determining” type of the object even if it is contradictory to an explicitly specified type.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-691
CWE-433
CWE-434

 

Consequences

Integrity, Other: Varies by Context, Unexpected State

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Perform a type check before interpreting an object.

Phase: Architecture and Design

Description: 

Reject any inconsistent types, such as a file with a .GIF extension that appears to consist of PHP code.

CVE References

  • CVE-2001-0004
    • Source code disclosure via manipulated file extension that causes parsing by wrong DLL.
  • CVE-2002-0025
    • Web browser does not properly handle the Content-Type header field, causing a different application to process the document.
  • CVE-2000-1052
    • Source code disclosure by directly invoking a servlet.
  • CVE-2002-1742
    • Arbitrary Perl functions can be loaded by calling a non-existent function that activates a handler.