CAPEC - Common Attack Pattern Enumeration and Classification (A Community of Knowledge Resource for Building Secure Software)
Home > CAPEC List > VIEW SLICE: CAPEC-284: Detailed Abstractions (Release 1.4)  

CAPEC-284: Detailed Abstractions

 
Detailed Abstractions
Definition in a New Window Definition in a New Window
View ID: 284 (View: Implicit Slice)Status: Draft
+ View Data

View Structure: Implicit_Slice

View Objective

This view (slice) covers detailed abstraction attack patterns.

Filter Used: .//@Pattern_Abstraction='Detailed'

CAPECs in this viewTotal CAPECs
Total80out of310
Views0out of5
Categories0out of18
Attack Patterns87out of287
View Components
View Components
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
 
Accessing/Intercepting/Modifying HTTP Cookies
Definition in a New Window Definition in a New Window
Attack Pattern ID: 31 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This attack relies on the use of HTTP Cookies to store credentials, state information and other critical data on client systems.

The first form of this attack involves accessing HTTP Cookies to mine for potentially sensitive data contained therein.

The second form of this attack involves intercepting this data as it is transmitted from client to server. This intercepted information is then used by the attacker to impersonate the remote user/session.

The third form is when the cookie's content is modified by the attacker before it is sent back to the server. Here the attacker seeks to convince the target server to operate on this falsified information.

Attack Execution Flow

Explore
  1. Obtain copy of cookie:

    The attacker first needs to obtain a copy of the cookie. The attacker may be a legitimate end user wanting to escalate privilege, or could be somebody sniffing on a network to get a copy of HTTP cookies.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Obtain cookie from local filesystem (e.g. C:\Documents and Settings\*\Cookies and C:\Documents and Settings\*\Application Data\Mozilla\Firefox\Profiles\*\cookies.txt in Windows)

    env-Web
    2

    Sniff cookie using a network sniffer such as Wireshark

    env-Web
    3

    Obtain cookie from local memory or filesystem using a utility such as the Firefox Cookie Manager or AnEC Cookie Editor.

    env-Web
    4

    Steal cookie via a cross-site scripting attack.

    env-Web
    5

    Guess cookie contents if it contains predictable information.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Cookies used in web application.

    env-Web
    2Negative

    Cookies not used in web application.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    Cookie captured by attacker.
    2Failure
    Cookie cannot be captured by attacker.

    Security Controls

    IDtypeSecurity Control Description
    1Preventative
    To prevent network sniffing, cookies should be transmitted over HTTPS and not plain HTTP. To enforce this on the client side, the "secure" flag should be set on cookies (javax.servlet.http.Cookie.setSecure() in Java, secure flag in setcookie() function in php, etc.).
Experiment
  1. Obtain sensitive information from cookie:

    The attacker may be able to get sensitive information from the cookie. The web application developers may have assumed that cookies are not accessible by end users, and thus, may have put potentially sensitive information in them.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    If cookie shows any signs of being encoded using a standard scheme such as base64, decode it.

    env-Web
    2

    Analyze the cookie's contents to determine whether it contains any sensitive information.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Negative

    Cookie only contains a random session ID (e.g. ASPSESSIONID, JSESSIONID, etc.)

    env-Web
    2Positive

    Cookie contains sensitive information (e.g. "ACCTNO=0234234", or "DBIP=0xaf112a22" -- database server's IP address).

    env-Web
    3Inconclusive

    Cookie's contents cannot be deciphered.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    Cookie contains sensitive information that developer did not intent the end user to see.
    2Failure
    Cookie does not contain any sensitive information.

    Security Controls

    IDtypeSecurity Control Description
    3Preventative
    Do not store sensitive information in cookies unless they are encrypted such that only the server can decrypt them.
  2. Modify cookie to subvert security controls.:

    The attacker may be able to modify or replace cookies to bypass security controls in the application.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Modify logical parts of cookie and send it back to server to observe the effects.

    env-Web
    2

    Modify numeric parts of cookie arithmetically and send it back to server to observe the effects.

    env-Web
    3

    Modify cookie bitwise and send it back to server to observe the effects.

    env-Web
    4

    Replace cookie with an older legitimate cookie and send it back to server to observe the effects. This technique would be helpful in cases where the cookie contains a "points balance" for a given user where the points have some value. The user may spend his points and then replace his cookie with an older one to restore his balance.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    Subversion of security controls on server
    2Failure
    Cookie reset by server

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Web server logs contain many messages indicating that invalid cookies were received from client.
    2Preventative
    Cookies should not contain any information that the user is not allowed to modify, unless that information is never expected to change. In the latter case, the integrity of the cookie should be protected using a digital signature or a message authentication code.
+ Attack Prerequisites

    Target server software must be a HTTP daemon that relies on cookies.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Modification of Resources
  • API Abuse
  • Protocol Manipulation
  • Time and State
+ Examples-Instances

Description

There are two main attack vectors for exploiting poorly protected session variables like cookies. One is the local machine itself which can be exploited directly at the physical level or indirectly through XSS and phising. In addition, the man in the middle attack relies on a network sniffer, proxy, or other intermediary to intercept the subject's credentials and use them to impersonate the digital subject on the host. The issue is that once the credentials are intercepted, impersonation is trivial for the attacker to accomplish if no other protection mechanisms are in place.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To overwrite session cookie data, and submit targeted attacks via HTTP

High: Exploiting a remote buffer overflow generated by attack

+ Resources Required

Ability to send HTTP request containing cookie to server

+ Solutions and Mitigations

Design: Use input validation for cookies

Design: Generate and validate MAC for cookies

Implementation: Use SSL/TLS to protect cookie in transit

Implementation: Ensure the web server implements all relevant security patches, many exploitable buffer overflows are fixed in patches issued for the software.

+ Attack Motivation-Consequences
  • Information Leakage
  • Data Modification
  • Privilege Escalation
+ Injection Vector

HTTP cookie

+ Payload

Malicious input delivered through cookie in HTTP Request.

+ Activation Zone

Client software, such as a browser and its component libraries, or an intermediary

+ Payload Activation Impact

1. Enables attacker to leverage state stored in cookie

2. Enables attacker a vector to attack web server and platform

+ Purposes
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: Low
+ Technical Context
Architectural Paradigms
Client-Server
n-Tier
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateComments
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name and Description
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Amit SethiCigital, Inc.2007-10-29Added extended Attack Execution Flow
 
Analog In-band Switching Signals (aka Blue Boxing)
Definition in a New Window Definition in a New Window
Attack Pattern ID: 5 (Detailed Attack Pattern Completeness: Complete)Typical Severity: Very HighStatus: Draft
+ Description

Summary

This attack against older telephone switches and trunks has been around for decades. The signal is sent by the attacker to impersonate a supervisor signal. This has the effect of rerouting or usurping command of the line and call. While the US infrastructure proper may not contain widespread vulnerabilities to this type of attack, many companies are connected globally through call centers and business process outsourcing. These international systems may be operated in countries which have not upgraded telco infrastructure and so are vulnerable to Blue boxing.

Blue boxing is a result of failure on the part of the system to enforce strong authentication for administrative functions. While the infrastructure is different than standard current applications like web applications, there are hisotrical lessons to be learned to upgrade the access control for administrative functions.

+ Attack Prerequisites

    System must use weak authentication mechanisms for administrative functions.

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Injection
  • Protocol Manipulation
+ Examples-Instances

Description

Attacker identifies a vulnerable CCITT-5 phone line, and sends a combination tone to the switch in order to request administrative access. Based on tone and timing parameters the request is verified for access to the switch. Once the attacker has gained control of the switch launching calls, routing calls, and a whole host of opportunities are available.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

Given a vulnerable phone system, the attacker's technical vector relies on attacks that are well documented in cracker 'zines and have been around for decades.

+ Resources Required

CCITT-5 or other vulnerable lines, with the ability to send tones such as combined 2,400 Hz and 2,600 Hz tones to the switch

+ Solutions and Mitigations

Implementation: Upgrade phone lines. Note this may be prohibitively expensive

Use strong access control such as two factor access control for adminsitrative access to the switch

+ Attack Motivation-Consequences
  • Denial of Service
  • Privilege Escalation
+ Injection Vector

Payload delivered through standard communication protocols.

+ Payload

Command(s) executed directly on host

+ Activation Zone

Client machine and client network

+ Payload Activation Impact

Enables calls to be rerouted.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: LowIntegrity Impact: MediumAvailability Impact: Medium
+ Technical Context
Architectural Paradigms
Other
Frameworks
Other
Platforms
Other
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateComments
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
 
Blind SQL Injection
Definition in a New Window Definition in a New Window
Attack Pattern ID: 7 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

Blind SQL Injection results from an insufficient mitigation for SQL Injection. Although suppressing database error messages are considered best practice, the suppression alone is not sufficient to prevent SQL Injection. Blind SQL Injection is a form of SQL Injection that overcomes the lack of error messages. Without the error messages that facilitate SQL Injection, the attacker constructs input strings that probe the target through simple Boolean SQL expressions. The attacker can determine if the syntax and structure of the injection was successful based on whether the query was executed or not. Applied iteratively, the attacker determines how and where the target is vulnerable to SQL Injection.

For example, an attacker may try entering something like "username' AND 1=1; --" in an input field. If the result is the same as when the attacker entered "username" in the field, then the attacker knows that the application is vulnerable to SQL Injection. The attacker can then ask yes/no questions from the database server to extract information from it. For example, the attacker can extract table names from a database using the following types of queries:

"username' AND ascii(lower(substring((SELECT TOP 1 name FROM sysobjects WHERE xtype='U'), 1, 1))) > 108".
If the above query executes properly, then the attacker knows that the first character in a table name in the database is a letter between m and z. If it doesn't, then the attacker knows that the character must be between a and l (assuming of course that table names only contain alphabetic characters). By performing a binary search on all character positions, the attacker can determine all table names in the database. Subsequently, the attacker may execute an actual attack and send something like:
"username'; DROP TABLE trades; --

Attack Execution Flow

Explore
  1. Hypothesize SQL queries in application:

    Generated hypotheses regarding the SQL queries in an application. For example, the attacker may hypothesize that his input is passed directly into a query that looks like:

    "SELECT * FROM orders WHERE ordernum = _____"
    or
    "SELECT * FROM orders WHERE ordernum IN (_____)"
    or
    "SELECT * FROM orders WHERE ordernum in (_____) ORDER BY _____"

    Of course, there are many other possibilities.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Research types of SQL queries and determine which ones could be used at various places in an application.

    env-All
  2. Determine how to inject information into the queries:

    Determine how to inject information into the queries from the previous step such that the injection does not impact their logic. For example, the following are possible injections for those queries:

    "5' OR 1=1; --"
    and
    "5) OR 1=1; --"
    and
    "ordernum DESC; --"

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Add clauses to the SQL queries such that the query logic does not change.

    env-All
    2

    Add delays to the SQL queries in case server does not provide clear error messages (e.g. WAITFOR DELAY '0:0:10' in SQL Server or BENCHMARK(1000000000,MD5(1) in MySQL). If these can be injected into the queries, then the length of time that the server takes to respond reveals whether the query is injectable or not.

    env-All

    Outcomes

    IDtypeOutcome Description
    1Success
    At least one way to complete a hypothesized SQL query that would violate the application developer's assumptions.
Experiment
  1. Determine user-controllable input susceptible to injection:

    Determine the user-controllable input susceptible to injection. For each user-controllable input that the attacker suspects is vulnerable to SQL injection, attempt to inject the values determined in the previous step. If an error does not occur, then the attacker knows that the SQL injection was successful.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use web browser to inject input through text fields or through HTTP GET parameters.

    env-Web
    2

    Use a web application debugging tool such as Tamper Data, TamperIE, WebScarab,etc. to modify HTTP POST parameters, hidden fields, non-freeform fields, etc.

    env-Web
    3

    Use network-level packet injection tools such as netcat to inject input

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    4

    Use modified client (modified by reverse engineering) to inject input.

    env-ClientServer env-Peer2Peer env-CommProtocol

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Attacker receives normal response from server.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    2Positive

    Response takes expected amount of time after delay is injected.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    3Negative

    Server sends a specific error message that indicates programmatic parsing of the input data (e.g. NumberFormatException)

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Outcomes

    IDtypeOutcome Description
    1Success
    At least one user-controllable input susceptible to injection found.
    2Failure
    No user-controllable input susceptible to injection found.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Unusual queries such as the ones described in the previous step, in application logs. Log files may contain unusual messages such as "User bob' OR 1=1; -- logged in". Operators should be alerted when such SQL commands appear in the logs.
    2Preventative
    Input validation of user-controlled data before including it in a SQL query
    3Preventative
    Use APIs that help mitigate SQL injection (such as PreparedStatement in Java)
  2. Determine database type:

    Determines the type of the database, such as MS SQL Server or Oracle or MySQL, using logical conditions as part of the injected queries

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Try injecting a string containing char(0x31)=char(0x31) (this evaluates to 1=1 in SQL Server only)

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    2

    Try injecting a string containing 0x313D31 (this evaluates to 1=1 in MySQL only)

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    3

    Inject other database-specific commands into input fields susceptible to SQL Injection. The attacker can determine the type of database that is running by checking whether the query executed successfully or not (i.e. wheter the attacker received a normal response from the server or not).

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Success outcome in previous step

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    2Negative

    Failure outcome in previous step

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Outcomes

    IDtypeOutcome Description
    1Success
    Database platform in use discovered.
    2Failure
    Database platform in use not discovered.
Exploit
  1. Extract information about database schema:

    Extract information about database schema by getting the database to answer yes/no questions about the schema.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Automatically extract database schema using a tool such as Absinthe.

    env-Web
    2

    Manually perform the blind SQL Injection to extract desired information about the database schema.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Success outcome in previous step.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    2Negative

    Failure outcome in previous step.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Outcomes

    IDtypeOutcome Description
    1Success
    Desired information about database schema extracted.
    2Failure
    Desired information about database schema could not be extracted.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Large number of unusual queries in database logs.
  2. Exploit SQL Injection vulnerability:

    Use the information obtained in the previous steps to successfully inject the database in order to bypass checks or modify, add, retrieve or delete data from the database

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use information about how to inject commands into SQL queries as well as information about the database schema to execute attacks such as dropping tables, inserting records, etc.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Success outcome in previous step.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    2Negative

    Failure outcome in previous step.

    env-Web env-ClientServer env-Peer2Peer env-CommProtocol

    Outcomes

    IDtypeOutcome Description
    1Success
    Attacker achieves goal of unauthorized system access, denial of service, etc.
    2Failure
    Attacker cannot exploit the information gathered by blind SQL Injection
+ Attack Prerequisites

    SQL queries used by the application to store, retrieve or modify data.

    User-controllable input that is not properly validated by the application as part of SQL queries.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Analysis
+ Examples-Instances

Description

In the PHP application TimeSheet 1.1, an attacker can successfully retrieve username and password hashes from the database using Blind SQL Injection. If the attacker is aware of the local path structure, the attacker can also remotely execute arbitrary code and write the output of the injected queries to the local path. Blind SQL Injection is possible since the application does not properly sanitize the $_POST['username'] variable in the login.php file.

Related Vulnerabilities

CVE-2006-4705

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Medium

Determining the database type and version, as well as the right number and type of parameters to the query being injected in the absence of error messages requires greater skill than reverse-engineering database error messages.

+ Resources Required

None

+ Probing Techniques

In order to determine the right syntax for the query to inject, the attacker tries to determine the right number of parameters to the query and their types. This is achieved by formulating conditions that result in a true/false answer from the database. If the logical condition is true, the database will execute the rest of the query. If not, a custom error page or a default page is returned. Another approach is to ask such true/false questions of the database and note the response times to a query with a logically true condition and one with a false condition.

+ Indicators-Warnings of Attack

The only indicators of successful Blind SQL Injection are the application or database logs that show similar queries with slightly differing logical conditions that increase in complexity over time. However, this requires extensive logging as well as knowledge of the queries that can be used to perform such injection and return meaningful information from the database.

+ Solutions and Mitigations

Security by Obscurity is not a solution to preventing SQL Injection. Rather than suppress error messages and exceptions, the application must handle them gracefully, returning either a custom error page or redirecting the user to a default page, without revealing any information about the database or the application internals.

Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as SQL content. Keywords such as UNION, SELECT or INSERT must be filtered in addition to characters such as a single-quote(') or SQL-comments (--) based on the context in which they appear.

+ Attack Motivation-Consequences
  • Data Modification
  • Information Leakage
  • Run Arbitrary Code
+ Injection Vector

User-controllable input to the application

+ Payload

SQL statements intended to bypass checks or retrieve information about the database

+ Activation Zone

Back-end database

+ Payload Activation Impact

The injected SQL statements are such that they result in a true/false query to the database. If the database evaluates a statement to be logically true, it responds with the requested data. If the condition is evaluated to be logically false, an error is returned. The attacker modifies the boolean condition each time to gain information from the database.

+ Relevant Security Requirements

Custom error pages must be used to handle exceptions such that they do not reveal any information about the architecture of the application or the database.

Special characters in user-controllable input must be escaped before use by the application.

Employ application-level safeguards to filter data and handle exceptions gracefully.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References

CWE - Input Validation

CWE - Improper Error Handling

+ Content History
Submissions
SubmitterDateComments
Chiradeep B Chhaya2007-02-22Third Draft - Revised to schema v1.4
Modifications
ModifierOrganizationDateComments
Malik HamroCigital, Inc2007-02-27Reformat to new schema and review
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Description, Attack Prerequisites and Related Attack Patterns
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Amit SethiCigital, Inc.2007-10-29Added extended Attack Execution Flow
 
Buffer Overflow in an API Call
Definition in a New Window Definition in a New Window
Attack Pattern ID: 8 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This attack targets libraries or shared code modules which are vulnerable to buffer overflow attacks. An attacker who has access to an API may try to embed malicious code in the API function call and exploit a buffer overflow vulnerability in the function's implementation. All clients that make use of the code library thus become vulnerable by association. This has a very broad effect on security across a system, usually affecting more than one software process.

Attack Execution Flow

  1. An attacker can call an API exposed by the target host.

  2. On the probing stage, the attacker injects malicious code using the API call and observes the results. The attacker's goal is to uncover a buffer overflow vulnerability.

  3. The attacker finds a buffer overflow vulnerability, crafts malicious code and injects it through an API call. The attacker can at worst execute remote code on the target host.

+ Attack Prerequisites

    The target host exposes an API to the user.

    One or more API functions exposed by the target host has a buffer overflow vulnerability.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • API Abuse
  • Injection
+ Examples-Instances

Description

A buffer overflow in the FreeBSD utility setlocale (found in the libc module) puts many programs at risk all at once.

Description

A buffer overflow in the Xt library of the X windowing system allows local users to execute commands with root privileges.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.

High : Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.

+ Solutions and Mitigations

Use a language or compiler that performs automatic bounds checking.

Use secure functions not vulnerable to buffer overflow.

If you have to use dangerous functions, make sure that you do boundary checking.

Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.

Use OS-level preventative functionality. Not a complete solution.

+ Attack Motivation-Consequences
  • Denial of Service
  • Run Arbitrary Code
  • Information Leakage
  • Data Modification
+ Injection Vector

The user supplied data.

+ Payload

The buffer overrun by the attacker.

+ Activation Zone

When the function returns control to the main program, it jumps to the return address portion of the stack frame. Unfortunately that return address may have been overwritten by the overflowed buffer and the address may contain a call to a privileged command or to a malicious code.

+ Payload Activation Impact

The most common is remote code execution.

+ Relevant Security Requirements

Bound checking should be performed when copying data to a buffer.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eric DalciCigital, Inc2007-02-13Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Description
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Buffer Overflow in Local Command-Line Utilities
Definition in a New Window Definition in a New Window
Attack Pattern ID: 9 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This attack targets command-line utilities available in a number of shells. An attacker can leverage a vulnerability found in a command-line utility to escalate privilege to root.

Attack Execution Flow

  1. Attacker identifies command utilities exposed by the target host.

  2. On the probing stage, the attacker interacts with the command utility and observes the results of its input. The attacker's goal is to uncover a buffer oveflow in the command utility. For instance the attacker may find that input data are not properly validated.

  3. The attacker finds a buffer overflow vulnerability in the command utility and tries to exploit it. He crafts malicious code and injects it using the command utility. The attacker can at worst execute remote code on the target host.

+ Attack Prerequisites

    The target host exposes a command-line utility to the user.

    The command-line utility exposed by the target host has a buffer overflow vulnerability that can be exploited.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • API Abuse
+ Examples-Instances

Description

A buffer overflow in the HPUX passwd command allows local users to gain root privileges via a command-line option.

A buffer overflow in Solaris's getopt command (found in libc) allows local users to gain root privileges via a long argv[0].

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.

High : Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.

+ Probing Techniques

The attacker can probe for services available on the target host. Many services may expose a command utility. For instance Telnet is a service which can be invoked through a command shell.

+ Solutions and Mitigations

Carefully review the service's implementation before making it available to user. For instance you can use manual or automated code review to uncover vulnerabilities such as buffer overflow.

Use a language or compiler that performs automatic bounds checking.

Use an abstraction library to abstract away risky APIs. Not a complete solution.

Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.

Operational: Use OS-level preventative functionality. Not a complete solution.

Apply the latest patches to your user exposed services. This may not be a complete solution, specially against zero day attack.

Do not unnecessarily expose services.

+ Attack Motivation-Consequences
  • Privilege Escalation
  • Run Arbitrary Code
  • Data Modification
  • Denial of Service
  • Information Leakage
+ Injection Vector

The user supplied data.

+ Payload

The buffer overrun by the attacker.

+ Activation Zone

When the function returns control to the main program, it jumps to the return address portion of the stack frame. Unfortunately that return address may have been overwritten by the overflowed buffer and the address may contain a call to a privileged command or to a malicious code.

+ Payload Activation Impact

The most common is remote code execution.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eric DalciCigital, Inc2007-02-13Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Attack Execution Flow, Probing Techniques and Method of Attack
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Buffer Overflow via Environment Variables
Definition in a New Window Definition in a New Window
Attack Pattern ID: 10 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.

Attack Execution Flow

  1. The attacker tries to find an environment variable which can be overwritten for instance by gathering information about the target host (error pages, software's version number, etc.).

  2. The attacker manipulates the environment variable to contain excessive-length content to cause a buffer overflow.

  3. The attacker potentially leverages the buffer overflow to inject maliciously crafted code in an attempt to execute privileged command on the target environment.

+ Attack Prerequisites

    The application uses environment variables.

    An environment variable exposed to the user is vulnerable to a buffer overflow.

    The vulnerable environment variable uses untrusted data.

    Tainted data used in the environment variables is not properly validated. For instance boundary checking is not done before copying the input data to a buffer.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
+ Examples-Instances

Description

A buffer overflow in sccw allows local users to gain root access via the $HOME environmental variable.

Related Vulnerabilities

CVE-1999-0906

Description

A buffer overflow in the rlogin program involves its consumption of the TERM environmental variable.

Related Vulnerabilities

CVE-1999-0046

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.

High : Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.

+ Probing Techniques

While interacting with a system an attacker would typically investigate for environment variables that can be overwritten. The more a user knows about a system the more likely she will find a vulnerable environment variable.

On a web environment, the attacker can read the client side code and search for environment variables that can be overwritten.

There are tools such as Sharefuzz (http://sharefuzz.sourceforge.net/) which is an environment variable fuzzer for Unix that support loading a shared library. Attackers can use such tools to uncover a buffer overflow in an environment variable.

+ Indicators-Warnings of Attack

If the application does bound checking, it should fail when the data source is larger than the size of the destination buffer. If the application's code is well written, that failure should triger an alert.

+ Solutions and Mitigations

Do not expose environment variable to the user.

Do not use untrusted data in your environment variables.

Use a language or compiler that performs automatic bounds checking

There are tools such as Sharefuzz (http://sharefuzz.sourceforge.net/) which is an environment variable fuzzer for Unixes that support loading a shared library. You can use Sharefuzz to determine if you are exposing an environment variable vulnerable to buffer overflow.

+ Attack Motivation-Consequences
  • Denial of Service
  • Run Arbitrary Code
  • Information Leakage
  • Data Modification
  • Privilege Escalation
+ Injection Vector

The user modifiable environment variable.

+ Payload

User supplied data potentially containing malicious code.

+ Activation Zone

When the subroutine which uses the environment variable returns control to the main program, it jumps to the return address portion of the stack frame. Unfortunately that return address may have been overwritten by the overflowed buffer and the address may contain a call to a privileged command or to a malicious code.

+ Payload Activation Impact

The most common is remote code execution.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eric DalciCigital, Inc2007-02-13Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Buffer Overflow via Parameter Expansion
Definition in a New Window Definition in a New Window
Attack Pattern ID: 47 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

In this attack, the target software is given input that the attacker knows will be modified and expanded in size during processing. This attack relies on the target software failing to anticipate that the expanded data may exceed some internal limit, thereby creating a buffer overflow.

Attack Execution Flow

  1. Consider parts of the program where user supplied data may be expanded by the program. Use a disassembler and other reverse engineering tools to guide the search.

  2. Find a place where a buffer overflow occurs due to the fact that the new expanded size of the string is not correctly accounted for by the program. This may happen perhaps when the string is copied to another buffer that is big enough to hold the original, but not the expanded string. This may create an opportunity for planting the payload and redirecting program execution to the shellcode.

  3. Write the buffer overflow exploit. To be exploitable, the "spill over" amount (e.g. the difference between the expanded string length and the original string length before it was expanded) needs to be sufficient to allow the overflow of the stack return pointer (in the case of a stack overflow), without causing a stack corruption that would crash the program before it gets to execute the shellcode. Heap overflow will be more difficult and will require the attacker to get more lucky, by perhaps getting a chance to overwrite some of the accounting information stored as part of using malloc().

+ Attack Prerequisites

    The program expands one of the parameters passed to a function with input controlled by the user, but a later function making use of the expanded parameter erroneously considers the original, not the expanded size of the parameter.

    The expanded parameter is used in the context where buffer overflow may becomes possible due to the incorrect understanding of the parameter size (i.e. thinking that it is smaller than it really is).

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Injection
+ Examples-Instances

Description

Attack Example: FTP glob()

The glob() function in FTP servers has been susceptible to attack as a result of incorrect resizing. This is an ftpd glob() Expansion LIST Heap Overflow Vulnerability. ftp daemon contains a heap-based buffer overflow condition. The overflow occurs when the LIST command is issued with an argument that expands into an oversized string after being processed by glob().

This buffer overflow occurs in memory that is dynamically allocated. It may be possible for attackers to exploit this vulnerability and execute arbitrary code on the affected host.

To exploit this, the attacker must be able to create directories on the target host.

The glob() function is used to expand short-hand notation into complete file names. By sending to the FTP server a request containing a tilde (~) and other wildcard characters in the pathname string, a remote attacker can overflow a buffer and execute arbitrary code on the FTP server to gain root privileges. Once the request is processed, the glob() function expands the user input, which could exceed the expected length. In order to exploit this vulnerability, the attacker must be able to create directories on the FTP server.

From G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.

Related Vulnerabilities

CVE-2001-0249

Description

Buffer overflow in the glob implementation in libc in NetBSD-current before 20050914, and NetBSD 2.* and 3.* before 20061203, as used by the FTP daemon, allows remote authenticated users to execute arbitrary code via a long pathname that results from path expansion.

The limit computation of an internal buffer was done incorrectly. The size of the buffer in byte was used as element count, even though the elements of the buffer are 2 bytes long. Long expanded path names would therefore overflow the buffer.

Related Vulnerabilities

CVE-2006-6652

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: High

Finding this particular buffer overflow may not be trivial. Also, stack and especially heap based buffer overflows require a lot of knowledge if the intended goal is aribtrary code execution. Not only that the attacker needs to write the shell code to accomplish his or her goals, but the attacker also needs to find a way to get the program execution to jump to the planted shellcode. There also needs to be sufficient room for the payload. So not every buffer overflow will be exploitable, even by a skilled attacker.

+ Resources Required

Access to the program source or binary. If the program is only available in binary then a disassembler and other reverse engineering tools will be helpful.

+ Solutions and Mitigations

Ensure that when parameter expansion happens in the code that the assumptions used to determine the resulting size of the parameter are accurate and that the new size of the parameter is visible to the whole system

+ Attack Motivation-Consequences
  • Privilege Escalation
  • Privilege Escalation
  • Denial of Service
  • Data Modification
+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
C
C++
+ References

G. Hoglund and G. McGraw. Exploiting Software: How to Break Code.

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eugene LebanidzeCigital, Inc2007-02-26Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name, Description and Related Attack Patterns
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Buffer Overflow via Symbolic Links
Definition in a New Window Definition in a New Window
Attack Pattern ID: 45 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This type of attack leverages the use of symbolic links to cause buffer overflows. An attacker can try to create or manipulate a symbolic link file such that its contents result in out of bounds data. When the target software processes the symbolic link file, it could potentially overflow internal buffers with insufficient bounds checking.

Attack Execution Flow

  1. The attacker creates or modifies a symbolic link pointing to a resources (e.g., file, directory). The content of the symbolic link file includes out-of-bounds (e.g. excessive length) data.

  2. The target host consumes the data pointed to by the symbolic link file. The target host may either intentionally expect to read a symbolic link or it may be fooled by the replacement of the original resource and read the attacker's symbolic link.

  3. While consuming the data, the target host does not check for buffer boundary which can lead to a buffer overflow. If the content of the data is controlled by the attacker, this is an avenue for remote code execution.

+ Attack Prerequisites

    The attacker can create symbolic link on the target host.

    The target host does not perform correct boundary checking while consuming data from a ressources.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Modification of Resources
+ Examples-Instances

Description

The EFTP server has a buffer overflow that can be exploited if an attacker uploads a .lnk (link) file that contains more than 1,744 bytes. This is a classic example of an indirect buffer overflow. First the attacker uploads some content (the link file) and then the attacker causes the client consuming the data to be exploited. In this example, the ls command is exploited to compromise the server software.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.

Skill or Knowledge Level: High

Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.

+ Probing Techniques

The attacker will look for temporary files in the world readable directories. Those temporary files are often created and read by the system.

The attacker will look for Symbolic link or link target file that she can overide.

+ Indicators-Warnings of Attack

An attacker creating or modifying Symbolic links is a potential signal of attack in progress.

An attacker deleting temporary files can also be a sign that the attacker is trying to replace legitimate resources with malicious ones.

+ Solutions and Mitigations

Pay attention to the fact that the ressource you read from can be a replaced by a Symbolic link. You can do a Symlink check before reading the file and decide that this is not a legitimate way of accessing the resource.

Because Symlink can be modified by an attacker, make sure that the ones you read are located in protected directories.

Pay attention to the resource pointed to by your symlink links (See attack pattern named "Forced Symlink race"), they can be replaced by malicious resources.

Always check the size of the input data before copying to a buffer.

Use a language or compiler that performs automatic bounds checking.

Use an abstraction library to abstract away risky APIs. Not a complete solution.

Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.

Use OS-level preventative functionality. Not a complete solution.

+ Attack Motivation-Consequences
  • Denial of Service
  • Run Arbitrary Code
  • Information Leakage
  • Data Modification
+ Injection Vector

The resource pointed to by the Symbolic link (e.g., file, directory, etc.)

+ Payload

The buffer overrun by the attacker.

+ Activation Zone

When the function returns control to the main program, it jumps to the return address portion of the stack frame. Unfortunately that return address may have been overwritten by the overflowed buffer and the address may contain a call to a privileged command or to a malicious code.

+ Payload Activation Impact

The most common is remote code execution.

+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
C
C++
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eric DalciCigital, Inc2007-02-13Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name and Description
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Calling signed code from another language within a sandbox that allows this
Definition in a New Window Definition in a New Window
Attack Pattern ID: 237 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Catching exception throw/signal from privileged block
Definition in a New Window Definition in a New Window
Attack Pattern ID: 236 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Client Network Footprinting (using AJAX/XSS)
Definition in a New Window Definition in a New Window
Attack Pattern ID: 85 (Detailed Attack Pattern Completeness: Complete)Typical Severity: Very HighStatus: Draft
+ Description

Summary

This attack utilizes the frequent client-server roundtrips in Ajax conversation to scan a system. While Ajax does not open up new vulnerabilities per se, it does optimize them from an attacker point of view. In many XSS attacks the attacker must get a "hole in one" and successfully exploit the vulnerability on the victim side the first time, once the client is redirected the attacker has many chances to engage in follow on probes, but their is only one first chance. In a widely used web application this is not a major problem because 1 in a 1,000 is good enough in a widely used application.

A common first step for an attacker is to footprint the environment to understand what attacks will work. Since footprinting relies on enumeration, the conversational pattern of rapid, multiple requests and responses that are typical in Ajax applications enable an attacker to look for many vulnerabilities, well known ports, network locations and so on.

+ Attack Prerequisites

    The user must allow Javscript to execute in their browser

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Protocol Manipulation
  • Injection
  • Brute Force
+ Examples-Instances

Description

Footprinting can be executed over almost any protocol including HTTP, TCP, UDP, and ICMP, with the general goal of gaining further information about a host environment to launch further attacks. By appending a malicious script to an otherwise normal looking URL, the attacker can probe the sysem for banners, vulnerabilities, filenames, available services, and in short anything the host process has access to. The results of the probe are either used to execute additional javascript (for example, if the attacker's footprint script identifies a vulnerability in a firewall permission, then the client side script executes a javascript to change client firewall settings, or an attacker may simply echo the results of the scan back out to a remote host for targeting future attacks).

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Medium

To land and launch a script on victim's machine with appropriate footprinting logic for enumerating services and vulnerabilities in Javascript

+ Solutions and Mitigations

Design: Use browser technologies that do not allow client side scripting.

Design: Utilize strict type, character, and encoding enforcement

Implementation: Ensure all content that is delivered to client is sanitized against an acceptable content specification.

Implementation: Perform input validation for all remote content.

Implementation: Perform output validation for all remote content.

Implementation: Disable scripting languages such as Javascript in browser

Implementation: Patching software. There are many attack vectors for XSS on the client side and the server side. Many vulnerabilities are fixed in service packs for browser, web servers, and plug in technologies, staying current on patch release that deal with XSS countermeasures mitigates this.

+ Attack Motivation-Consequences
  • Information Leakage
+ Injection Vector

Payload delivered through standard communication protocols, such as Ajax application.

+ Payload

Command(s) executed directly on host

+ Activation Zone

Client machine and client network

+ Payload Activation Impact

Enables attacker to execute probes against client system.

+ Purposes
  • Reconnaissance
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: LowAvailability Impact: Low
+ Technical Context
Architectural Paradigms
Client-Server
SOA
Frameworks
All
Platforms
All
Languages
AJAX
+ References

Shreeraj Shah, "Ajax footprinting for Web 2.0 applications", http://www.net-security.org/dl/articles/Ajax_fingerprinting.pdf

+ Content History
Submissions
SubmitterDateComments
Gunnar Peterson2007-02-28
Modifications
ModifierOrganizationDateComments
Sean BarnumCigital, Inc2007-03-07Review and revise
 
Client-side Injection-induced Buffer Overflow
Definition in a New Window Definition in a New Window
Attack Pattern ID: 14 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This type of attack exploits a buffer overflow vulnerability in targeted client software through injection of malicious content from a custom-built hostile service.

Attack Execution Flow

  1. The attacker creates a custom hostile service

  2. The attacker acquires information about the kind of client attaching to her hostile service to determine if it contains an exploitable buffer overflow vulnerability.

  3. The attacker intentionally feeds malicious data to the client to exploit the buffer overflow vulnerability that she has uncovered.

  4. The attacker leverages the exploit to execute arbitrary code or to cause a denial of service.

+ Attack Prerequisites

    The targeted client software communicates with an external server.

    The targeted client software has a buffer oveflow vulnerability.

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • API Abuse
  • Injection
+ Examples-Instances

Description

Authors often use <EMBED> tags in HTML documents. For example

<EMBED TYPE="audio/midi" SRC="/path/file.mid" AUTOSTART="true">

If an attacker supplies an overly long path in the SRC= directive, the mshtml.dll component will suffer a buffer overflow. This is a standard example of content in a Web page being directed to exploit a faulty module in the system. There are potentially thousands of different ways data can propagate into a given system, thus these kinds of attacks will continue to be found in the wild.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To achieve a denial of service, an attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector.

High : Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap requires a more in-depth knowledge and higher skill level.

+ Probing Techniques

The server may look like a valid server, but in reality it may be a hostile server aimed at fooling the client software. For instance the server can use honey pots and get the client to download malicious code.

Once engaged with the client, the hostile server may attempt to scan the client's host for open ports and potential vulnerabilities in the client software.

The hostile server may also attempt to install and run malicious code on the client software. That malicious code can be used to scan the client software for buffer overflow.

+ Indicators-Warnings of Attack

An example of indicator is when the client software crashes after executing code downloaded from a hostile server.

+ Solutions and Mitigations

The client software should not install untrusted code from a non authenticated server.

The client software should have the latest patches and should be audited for vulnerabilities before being used to communicate with potentially hostile servers.

Perform input validation for length of buffer inputs.

Use a language or compiler that performs automatic bounds checking.

Use an abstraction library to abstract away risky APIs. Not a complete solution.

Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.

Ensure all buffer uses are consistently bounds-checked.

Use OS-level preventative functionality. Not a complete solution.

+ Attack Motivation-Consequences
  • Denial of Service
  • Run Arbitrary Code
+ Payload

Attacker-supplied data potentially containing malicious code.

+ Activation Zone

When the function returns control to the main program, it jumps to the return address portion of the stack frame. Unfortunately that return address may have been overwritten by the overflowed buffer and the address may contain a call to a privileged command or to malicious code.

+ Payload Activation Impact

The most common are remote code execution or denial of service.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
Client-Server
Other
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eric DalciCigital, Inc2007-02-13Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Related Attack Patterns
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Cross-Site Scripting in Attributes
Definition in a New Window Definition in a New Window
Attack Pattern ID: 243 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Cross-Site Scripting Using Doubled Characters, e.g. %3C%3Cscript
Definition in a New Window Definition in a New Window
Attack Pattern ID: 245 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Cross-Site Scripting via Encoded URI Schemes
Definition in a New Window Definition in a New Window
Attack Pattern ID: 244 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Cross-Site Scripting with Masking through Invalid Characters in Identifiers
Definition in a New Window Definition in a New Window
Attack Pattern ID: 247 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Dictionary-based Password Attack
Definition in a New Window Definition in a New Window
Attack Pattern ID: 16 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

An attacker tries each of the words in a dictionary as passwords to gain access to the system via some user's account. If the password chosen by the user was a word within the dictionary, this attack will be successful (in the absence of other mitigations). This is a specific instance of the password brute forcing attack pattern.

Attack Execution Flow

Explore
  1. Determine application's/system's password policy:

    Determine the password policies of the target application/system.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Determine minimum and maximum allowed password lengths.

    env-All
    2

    Determine format of allowed passwords (whether they are required or allowed to contain numbers, special characters, etc., or whether they are allowed to contain words from the dictionary).

    env-All
    3

    Determine account lockout policy (a strict account lockout policy will prevent brute force attacks).

    env-All

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Passwords are used in the application/system

    env-All
    2Negative

    Passwords are not used in the application/system.

    env-All
  2. Select dictionaries:

    Pick the dictionaries to be used in the attack (e.g. different languages, specific terminology, etc.)

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Select dictionary based on particular users' preferred languages.

    env-All
    2

    Select dictionary based on the application/system's supported languages.

    env-All
  3. Determine username(s) to target:

    Determine username(s) whose passwords to crack.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Obtain username(s) by sniffing network packets.

    env-CommProtocol env-Peer2Peer env-ClientServer
    2

    Obtain username(s) by querying application/system (e.g. if upon a failed login attempt, the system indicates whether the entered username was valid or not)

    env-All
    3

    Obtain usernames from filesystem (e.g. list of directories in C:\Documents and Settings\ in Windows, and list in /etc/passwd in UNIX-like systems)

    env-Embedded env-Local

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Negative

    Remote application or system provides no indication regarding whether a given username is valid or not.

    env-ClientServer env-Peer2Peer env-Web env-CommProtocol

    Outcomes

    IDtypeOutcome Description
    1Success
    At least one valid username found.
    2Failure
    Presence of any valid usernames could not be established.

    Security Controls

    IDtypeSecurity Control Description
    1Preventative
    Do not reveal information regarding validity of particular usernames to users.
    2Corrective
    Lock out accounts whose usernames are suspected to have been compromised.
Exploit
  1. Use dictionary to crack passwords.:

    Use a password cracking tool that will leverage the dictionary to feed passwords to the system and see if they work.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Try all words in the dictionary, as well as common misspellings of the words as passwords for the chosen username(s).

    env-All
    2

    Try common combinations of words in the dictionary, as well as common misspellings of the combinations as passwords for the chosen username(s).

    env-All

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Negative

    Application/system does not use password authentication.

    env-All

    Outcomes

    IDtypeOutcome Description
    1Success
    Attacker determines correct password for a user ID and obtains access to application or system.
    2Failure
    Attacker is unable to determine correct password for a user ID and obtain access to application or system.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Large number of authentication failures in logs.
    2Preventative
    Enforce strict account lockout policies.
    3Preventative
    Enforce strong passwords (having sufficient length and containing mix of lower case and upper case letters, numbers, and special characters)
+ Attack Prerequisites

    The system uses one factor password based authentication.

    The system does not have a sound password policy that is being enforced.

    The system does not implement an effective password throttling mechanism.

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Brute Force
+ Examples-Instances

Description

A system user selects the word "treacherous" as their passwords believing that it would be very difficult to guess. The password-based dictionary attack is used to crack this password and gain access to the account.

Description

The Cisco LEAP challenge/response authentication mechanism uses passwords in a way that is susceptible to dictionary attacks, which makes it easier for remote attackers to gain privileges via brute force password guessing attacks.

Cisco LEAP is a mutual authentication algorithm that supports dynamic derivation of session keys. With Cisco LEAP, mutual authentication relies on a shared secret, the user's logon password—which is known by the client and the network, and is used to respond to challenges between the user and the Remote Authentication Dial-In User Service (RADIUS) server.

Methods exist for someone to write a tool to launch an offline dictionary attack on password-based authentications that leverage Microsoft MS-CHAP, such as Cisco LEAP. The tool leverages large password lists to efficiently launch offline dictionary attacks against LEAP user accounts, collected through passive sniffing or active techniques.

Related Vulnerabilities

CVE-2003-1096

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

A variety of password cracking tools and dictionaries are available to launch this type of an attack.

+ Resources Required

A machine with sufficient resources for the job (e.g. CPU, RAM, HD). Applicable dictionaries are required. Also a password cracking tool or a custom script that leverages the dictionary database to launch the attack.

+ Indicators-Warnings of Attack

Many invalid login attempts are coming from the same machine (same IP address) or for the same log in name. The login attempts use passwords that are dictionary words.

+ Obfuscation Techniques

Employ IP spoofing to make it seem like login attempts are coming from different machines.

+ Solutions and Mitigations

Create a strong password policy and ensure that your system enforces this policy.

Implement an intelligent password throttling mechanism. Care must be taken to assure that these mechanisms do not excessively enable account lockout attacks such as CAPEC-02.

+ Attack Motivation-Consequences
  • Privilege Escalation
+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: MediumAvailability Impact: Low
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ Content History
Submissions
SubmitterOrganizationDate
Eugene LebanidzeCigital, Inc2007-02-26
Modifications
ModifierOrganizationDateComments
Sean BarnumCigital, Inc2007-03-01Review and revision of content
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Solutions
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Amit SethiCigital, Inc.2007-10-29Added extended Attack Execution Flow
 
DNS Rebinding
Definition in a New Window Definition in a New Window
Attack Pattern ID: 275 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
DTD Injection in a SOAP Message
Definition in a New Window Definition in a New Window
Attack Pattern ID: 254 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Embedding NULL Bytes
Definition in a New Window Definition in a New Window
Attack Pattern ID: 52 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

An attacker embeds one or more null bytes in input to the target software. This attack relies on the usage of a null-valued byte as a string terminator in many environments. The goal is for certain components of the target software to stop processing the input when it encounters the null byte(s).

Attack Execution Flow

  1. Identify a place in the program where user input may be used to escalate privileges by for instance accessing unauthorized file system resources through directory browsing.

  2. An attacker realizes that there is a postfix data that gets in the way of getting to the desired resources

  3. An attacker then ads a postfix NULL terminator to the supplied input in order to "swallow" the postfixed data when the insertion is taking place. With the postfix data that got in the way of the attack gone, the doors are opened for accessing the desired resources.

+ Attack Prerequisites

    The program does not properly handle postfix NULL terminators

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Modification of Resources
  • API Abuse
+ Examples-Instances

Description

Directory Browsing

Assume a Web application allows a user to access a set of reports. The path to the reports directory may be something like web/username/reports. If the username is supplied via a hidden field, an attacker could insert a bogus username such as ../../../../../WINDOWS. If the attacker needs to remove the trailing string /reports, then he can simply insert enough characters so the string is truncated. Alternatively the attacker might apply the postfix NULL character (%00) to determine whether this terminates the string.

Different forms of NULL to think about include

PATH%00
PATH[0x00]
PATH[alternate representation of NULL character]
<script></script>%00

Description

Exploitation of a buffer overflow vulnerability in the ActiveX component packaged with Adobe Systems Inc.'s Acrobat/Acrobat Reader allows remote attackers to execute arbitrary code.

The problem specifically exists upon retrieving a link of the following form:

GET /any_existing_dir/any_existing_pdf.pdf%00[long string] HTTP/1.1

Where [long string] is a malicious crafted long string containing acceptable URI characters. The request must be made to a web server that truncates the request at the null byte (%00), otherwise an invalid file name is specified and a "file not found" page will be returned. Example web servers that truncate the requested URI include Microsoft IIS and Netscape Enterprise. Though the requested URI is truncated for the purposes of locating the file the long string is still passed to the Adobe ActiveX component responsible for rendering the page. This in turn triggers a buffer overflow within RTLHeapFree() allowing for an attacker to overwrite an arbitrary word in memory. The responsible instructions from RTLHeapFree() are shown here:

0x77F83AE5 MOV EAX,[EDI+8]
0x77F83AE8 MOV ECX,[EDI+C]
...
0x77F83AED MOV [ECX],EAX

The register EDI contains a pointer to a user-supplied string. The attacker therefore has control over both the ECX and EAX registers used in the shown MOV instruction.

Successful exploitation allows remote attackers to utilize the arbitrary word overwrite to redirect the flow of control and eventually take control of the affected system. Code execution will occur under the context of the user that instantiated the vulnerable version of Adobe Acrobat.

An attacker does not need to establish a malicious web site as exploitation can occur by adding malicious content to the end of any embedded link and referencing any Microsoft IIS or Netscape Enterprise web server. Clicking on a direct malicious link is also not required as it may be embedded within an IMAGE tag, an IFRAME or an auto-loading script.

Successful exploitation requires that a payload be written such that certain areas of the input are URI acceptable. This includes initial injected instructions as well as certain overwritten addresses. This increases the complexity of successful exploitation. While not trivial, exploitation is definitely plausible [iDefense].

Related Vulnerabilities

CVE-2004-0629

Description

Consider the following PHP script:

$whatever = addslashes($_REQUEST['whatever']);
include("/path/to/program/" . $whatever . "/header.htm");

A malicious attacker might open the following URL, disclosing the boot.ini file:

http://localhost/phpscript.php?whatever=../../../../boot.ini%00
+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Medium

Directory traversal

Skill or Knowledge Level: High

Execution of arbitrary code

+ Solutions and Mitigations

Properly handle the NULL characters supplied as part of user input prior to doing anything with the data.

+ Attack Motivation-Consequences
  • Data Modification
  • Information Leakage
  • Privilege Escalation
  • Run Arbitrary Code
+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
"Adobe Acrobat/Acrobat Reader ActiveX Control Buffer Overflow Vulnerability". iDefense Labs Public Advisory. . <http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=126>.

Bugtraq mailing list archive: PHP Input Validation Vulnerabilities

Available at: http://msgs.securepoint.com/bugtraq/

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eugene LebanidzeCigital, Inc2007-02-26Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name, Description and Context Description
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
 
Embedding Script (XSS ) in HTTP Headers
Definition in a New Window Definition in a New Window
Attack Pattern ID: 86 (Detailed Attack Pattern Completeness: Complete)Typical Severity: Very HighStatus: Draft
+ Description

Summary

An attack of this type exploits web applications that generate web content, such as links in a HTML page, based on unvalidated or improperly validated data submitted by other actors. XSS in HTTP Headers attacks target the HTTP headers which are hidden from most users and may not be validated by web applications.

Attack Execution Flow

Explore
  1. Spider:

    Using a browser or an automated tool, an attacker follows all public links on a web site. He records all the entry points (input) that becomes part of generated HTTP header (not only GET/POST/COOKIE, but also Content-Type, etc.)

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters used in the HTTP headers.

    env-Web
    2

    Look for HTML meta tags that could be injectable

    env-Web
    3

    Use a proxy tool to record all links visited during a manual traversal of the web application.

    env-Web
    4

    Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Web content is generated by the application and served to the browser based on user-controllable inputs.

    env-Web
    2Positive

    HTTP header variables are used by the application or the browser (DOM)

    env-Web
    3Inconclusive

    No HTTP variables appear to be used on the current page. Even though none appear, the web application may still use them if they are provided.

    env-Web
    4Negative

    Applications that have only static pages or that simply present information without accepting input are unlikely to be susceptible.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    A list of URLs, with their corresponding HTTP variables is created by the attacker.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).
    2Detective
    Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.
    3Preventative
    Use CAPTCHA to prevent the use of the application by an automated tool.
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be automated.
Experiment
  1. Probe identified potential entry points for XSS vulnerability:

    The attacker uses the entry points gathered in the "Explore" phase as a target list and injects various common script payloads to determine if an entry point actually represents a vulnerability and to characterize the extent to which the vulnerability can be exploited. He records all the responses from the server that include unmodified versions of his script.

    The attacker tries also to inject extra-parameter to the HTTP request to see if they are reflected back in the web page or in the HTTP response.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Manually inject various script payloads into each identified entry point using a list of common script injection probes and observe system behavior to determine if script was executed.

    env-Web
    2

    Use an automated injection attack tool to inject various script payloads into each identified entry point using a list of common script injection probes and observe system behavior to determine if script was executed.

    env-Web
    3

    Use a proxy tool to record results of manual input of XSS probes in known URLs.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    User-controllable input is embedded as part of generated HTTP headers

    env-Web
    2Positive

    Input parameters become part of the web page (even in meta tags)

    env-Web
    3Positive

    Output to the browser is not encoded to remove executable scripting syntax.

    env-Web
    4Inconclusive

    Nothing is returned to the web page. It may be a stored XSS. The unique identifier from the probe helps to trace the flow of the possible XSS.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker's cross-site scripting string is repeated back verbatim at some point in the web site (if not on the same page). Note that sometimes, the payload might be well encoded in the page, but wouldn't be encoded at all in some other section of the same web page (title, script, etc.)
    2Failure
    All HTML-sensitive characters are consistently re-encoded before being sent to the web browser.
    3Inconclusive
    Some sensitive characters are consistently encoded, but others are not.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor input to web servers (not only GET, but all in the inputs), application servers, and other HTTP infrastructure (e.g., load balancers). Alert on standard XSS probes. The majority of attackers use well known strings to check for vulnerabilities. Use the same vulnerability catalogs that hackers use.
    2Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    3Preventative
    Do not embed user-controllable input generated HTTP headers
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
Exploit
  1. Steal session IDs, credentials, page content, etc.:

    As the attacker succeeds in exploiting the vulnerability, he can choose to steal user's credentials in order to reuse or to analyze them later on.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and sends document information to the attacker.

    env-Web
    2

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute appropriately.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker gets the user's cookies or other session identifiers.
    2Success
    The attacker gets the content of the page the user is viewing.
    3Success
    The attacker causes the user's browser to visit a page with malicious content.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    2Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    3Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    4Preventative
    Appropriately encode all browser output to avoid scripting syntax
    5Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
  2. Forceful browsing:

    When the attacker targets the current application or another one (through CSRF vulnerabilities), the user will then be the one who perform the attacks without being aware of it. These attacks are mostly targeting application logic flaws, but it can also be used to create a widespread attack against a particular website on the user's current network (Internet or not).

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and performs actions on the same web site

    env-Web
    2

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute request to other web sites (especially the web applications that have CSRF vulnerabilities).

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker indirectly controls the user's browser and makes it performing actions exploiting CSRF.
    2Success
    The attacker manipulates the browser through the steps that he designed in his attack. The user, identified on a website, is now performing actions he is not aware of.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    2Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    3Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    4Preventative
    Appropriately encode all browser output to avoid scripting syntax
    5Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
  3. Content spoofing:

    By manipulating the content, the attacker targets the information that the user would like to get from the website.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and exposes attacker-modified invalid information to the user on the current web page.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The user sees a page containing wrong information

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    2Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    3Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    4Preventative
    Appropriately encode all browser output to avoid scripting syntax
    5Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
+ Attack Prerequisites

    Target software must be a client that allows scripting communication from remote hosts, and attacker must control a remote site of some sort to redirect client and data to.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Modification of Resources
  • Protocol Manipulation
+ Examples-Instances

Description

Utilize a remote style sheet set in the HTTP header for XSS attack. When the attacker is able to point to a remote stylesheet, any of the variables set in that stylesheet are controllable on the client side by the remote attacker. Like most XSS attacks, results vary depending on browser that is used.

(source:http://ha.ckers.org/xss.html)

<META HTTP-EQUIV="Link" Content="<http://ha.ckers.org/xss.css>; REL=stylesheet">

Description

Google's 404 redirection script was found vulnerable to this attack vector.

Google's 404 file not found page read

* Response headers: "Content-Type: text/html; charset=[encoding]".

* Response body: <META http-equiv="Content-Type" (...) charset=[encoding]/>

If the response sends an unexpected encoding type such as UTF-7, then no enforcement is done on the payload and arbitrary XSS code will be transported along with the standard HTTP response. Source: http://seclists.org/fulldisclosure/2005/Dec/1107.html

Description

XSS can be used in variety of ways, because it is scripted and executes in a distribtued, asynchronous fashion it can create its own vector and openings. For example, the attacker can use XSS to mount a DDoS attack by having series of different computers unknowingly executing requests against a single host.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To achieve a redirection and use of less trusted source, an attacker can simply edit HTTP Headers that are sent to client machine.

Skill or Knowledge Level: High

Exploiting a client side vulnerability to inject malicious scripts into the browser's executable process.

+ Resources Required

Ability to deploy a custom hostile service for access by targeted clients. Ability to communicate synchronously or asynchronously with client machine

+ Solutions and Mitigations

Design: Use browser technologies that do not allow client side scripting.

Design: Utilize strict type, character, and encoding enforcement

Design: Server side developers should not proxy content via XHR or other means, if a http proxy for remote content is setup on the server side, the client's browser has no way of discerning where the data is originating from.

Implementation: Ensure all content that is delivered to client is sanitized against an acceptable content specification.

Implementation: Perform input validation for all remote content.

Implementation: Perform output validation for all remote content.

Implementation: Disable scripting languages such as Javascript in browser

Implementation: Session tokens for specific host

Implementation: Patching software. There are many attack vectors for XSS on the client side and the server side. Many vulnerabilities are fixed in service packs for browser, web servers, and plug in technologies, staying current on patch release that deal with XSS countermeasures mitigates this.

+ Attack Motivation-Consequences
  • Run Arbitrary Code
  • Information Leakage
  • Privilege Escalation
+ Injection Vector

Malicious input delivered through HTTP Headers.

+ Payload

Varies with instantiation of attack pattern. In the case of HTTP headers they may not be visible to the end user via a browser

+ Activation Zone

Header processing on the server or Client browser

+ Payload Activation Impact

Enables attacker to execute scripts to launch attacks on server as well as remote client machine and environment

+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
Client-Server
SOA
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateComments
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name
Sean BarnumCigital, Inc2007-04-16Modified pattern content according to review and feedback
Romain GaucherCigital, Inc2009-02-10Created draft content for detailed description
Sean BarnumCigital Federal, Inc2009-04-13Reviewed and revised content for detailed description
 
Embedding Scripts in HTTP Query Strings
Definition in a New Window Definition in a New Window
Attack Pattern ID: 32 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

A variant of cross-site scripting called "reflected" cross-site scripting, the HTTP Query Strings attack consists of passing a malicious script inside an otherwise valid HTTP request query string. This is of significant concern for sites that rely on dynamic, user-generated content such as bulletin boards, news sites, blogs, and web enabled administration GUIs. The malicious script may steal session data, browse history, probe files, or otherwise execute attacks on the client side. Once the attacker has prepared the malicious HTTP query it is sent to a victim user (perhaps by email, IM, or posted on an online forum), who clicks on a normal looking link that contains a poison query string. This technique can be made more effective through the use of services like http://tinyurl.com/, which makes very small URLs that will redirect to very large, complex ones. The victim will not know what he is really clicking on.

Attack Execution Flow

Explore
  1. Spider:

    Using a browser or an automated tool, an attacker follows all public links on a web site. He records all the links he finds.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use a spidering tool to follow and record all links. Make special note of any links that include parameters in the URL.

    env-Web
    2

    Use a proxy tool to record all links visited during a manual traversal of the web application. Make special note of any links that include parameters in the URL. Manual traversal of this type is frequently necessary to identify forms that are GET method forms rather than POST forms.

    env-Web
    3

    Use a browser to manually explore the website and analyze how it is constructed. Many browser's plugins are available to facilitate the analysis or automate the URL discovery.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    URL parameters are used by the application or the browser (DOM)

    env-Web
    2Inconclusive

    Using URL rewriting, parameters may be part of the URL path.

    env-Web
    3Inconclusive

    No parameters appear on the URL. Even though none appear, the web application may still use them if they are provided.

    env-Web
    4Inconclusive

    Application could use POST variable as GET inside the application. Therefore, looking for POST parameters and adding them to the query string.

    env-Web
    5Negative

    Applications that have only static pages or that simply present information without accepting input are unlikely to be susceptible.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    A list of URLs, with their corresponding parameters is created by the attacker.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).
    2Detective
    Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.
    3Preventative
    Use CAPTCHA to prevent the use of the application by an automated tool.
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be automated.
Experiment
  1. Attempt variations on input parameters:

    Possibly using an automated tool, an attacker requests variations on the URLs he spidered before. He sends parameters that include variations of payloads. He records all the responses from the server that include unmodified versions of his script.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use a list of XSS probe strings to inject in parameters of known URLs. If possible, the probe strings contain a unique identifier.

    env-Web
    2

    Use a proxy tool to record results of manual input of XSS probes in known URLs.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    The output of pages includes some form of a URL parameter. E.g., ?error="File not Found" becomes "File not Found" in the title of the web page.

    env-Web
    2Positive

    Input parameters become part of JavaScript, VBScript, or other script in a web page.

    env-Web
    3Inconclusive

    Nothing is returned to the web page. It may be a stored XSS. The unique identifier from the probe helps to trace the flow of the possible XSS.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker's cross-site scripting string is repeated back verbatim at some point in the web site (if not on the same page). Note that sometimes, the payload might be well encoded in the page, but wouldn't be encoded at all in some other section of the same web page (title, script, etc.)
    2Failure
    All HTML-sensitive characters are consistently re-encoded before being sent to the web browser.
    3Inconclusive
    Some sensitive characters are consistently encoded, but others are not.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor input to web servers, application servers, and other HTTP infrastructure (e.g., load balancers). Alert on standard XSS probes. The majority of attackers use well known strings to check for vulnerabilities. Use the same vulnerability catalogs that hackers use.
    2Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    3Preventative
    Do not embed user-controllable input generated HTTP headers
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
Exploit
  1. Steal session IDs, credentials, page content, etc.:

    As the attacker succeeds in exploiting the vulnerability, he can choose to steal user's credentials in order to reuse or to analyze them later on.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and sends document information to the attacker.

    env-Web
    2

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute appropriately.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker gets the user's cookies or other session identifiers.
    2Success
    The attacker gets the content of the page the user is viewing.
    3Success
    The attacker causes the user's browser to visit a page with malicious content.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    2Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    3Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    4Preventative
    Appropriately encode all browser output to avoid scripting syntax
    5Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
  2. Forceful browsing:

    When the attacker targets the current application or another one (through CSRF vulnerabilities), the user will then be the one who perform the attacks without being aware of it. These attacks are mostly targeting application logic flaws, but it can also be used to create a widespread attack against a particular website on the user's current network (Internet or not).

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and performs actions on the same web site

    env-Web
    2

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute request to other web sites (especially the web applications that have CSRF vulnerabilities).

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker indirectly controls the user's browser and makes it performing actions exploiting CSRF.
    2Success
    The attacker manipulates the browser through the steps that he designed in his attack. The user, identified on a website, is now performing actions he is not aware of.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    2Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    3Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    4Preventative
    Appropriately encode all browser output to avoid scripting syntax
    5Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
  3. Content spoofing:

    By manipulating the content, the attacker targets the information that the user would like to get from the website.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and exposes attacker-modified invalid information to the user on the current web page.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The user sees a page containing wrong information

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for scripting parameters.
    1Detective
    Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referrer headers most of the time. These can help indicate that the actual request is illegitimate.
    2Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    3Preventative
    Appropriately encode all browser output to avoid scripting syntax
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes.
+ Attack Prerequisites

    Target client software must allow scripting such as Javascript. Server software must allow display of remote generated HTML without sufficient input or output validation.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Protocol Manipulation
+ Examples-Instances

Description

http://user:host@example.com:8080/oradb<script>alert('Hi')</script>

Description

Web applications that accept name value pairs in a HTTP Query string are inherently at risk to any value (or name for that matter) that an attacker would like to enter in the query string. This can be done manually via web browser or trivially scripted to post the query string to multiple sites. In the latter case, in the instance of many sites using similar infrastructure with predictable http queries being accepted and operated on (such as blogging software, Google applications, and so on), a single malicious payload can be scritped to target a wide variety of sites.

Web 2.0 type sites like Technorati and del.icio.us rely on user generated content like tags to build http links that are displayed to other users. del.icio.us allows users to identify sites, tag them with metadata and provide URL, descriptions and more data. This data is then echoed back to any other web browser that is interested in the link. If the data is not validated by the del.icio.us site properly then an abritrary code can be added into the standard http string sent to del.icio.us by the attacker, for example formatted as normal content with a URL and description and tagged as Java, and available to be clicked on (and executed by) any user browsing for Java content that clicks on this trojaned content.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To place malicious payload on server via HTTP

Skill or Knowledge Level: High

Exploiting any information gathered by HTTP Query on script host

+ Resources Required

Ability to send HTTP post to scripting host and collect output

+ Solutions and Mitigations

Design: Use browser technologies that do not allow client side scripting.

Design: Utilize strict type, character, and encoding enforcement

Design: Server side developers should not proxy content via XHR or other means, if a http proxy for remote content is setup on the server side, the client's browser has no way of discerning where the data is originating from.

Implementation: Ensure all content that is delivered to client is sanitized against an acceptable content specification.

Implementation: Perform input validation for all remote content, including remote and user-generated content

Implementation: Perform output validation for all remote content.

Implementation: Disable scripting languages such as Javascript in browser

Implementation: Session tokens for specific host

Implementation: Patching software. There are many attack vectors for XSS on the client side and the server side. Many vulnerabilities are fixed in service packs for browser, web servers, and plug in technologies, staying current on patch release that deal with XSS countermeasures mitigates this.

Implementation: Privileges are constrained, if a script is loaded, ensure system runs in chroot jail or other limited authority mode

+ Attack Motivation-Consequences
  • Information Leakage
  • Run Arbitrary Code
+ Injection Vector

Script delivered through standard web server, such as a web server with user-generated content.

+ Payload

HTTP Request Query String

+ Activation Zone

Client web browser where script is executed

+ Payload Activation Impact

Client web browser may be used to steal session data, passwords, cookies, and other tokens.

+ Purposes
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: Low
+ Technical Context
Architectural Paradigms
Client-Server
n-Tier
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateComments
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name and Examples
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Romain GaucherCigital, Inc2009-02-10Created draft content for detailed description
Sean BarnumCigital Federal, Inc2009-04-13Reviewed and revised content for detailed description
 
Exploiting Incorrectly Configured SSL Security Levels
Definition in a New Window Definition in a New Window
Attack Pattern ID: 217 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Filter Failure through Buffer Overflow
Definition in a New Window Definition in a New Window
Attack Pattern ID: 24 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. lets the user input into the system unfiltered).

Attack Execution Flow

Explore
  1. Survey:

    The attacker surveys the target application, possibly as a valid and authenticated user

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Spidering web sites for inputs that involve potential filtering

    env-Web
    2

    Brute force guessing of filtered inputs

    env-All

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Software messages (e.g., "the following characters are not allowed...") indicate that filtered inputs are present in the software. (

    env-Web env-ClientServer
    2Positive

    Application uses predefined inputs (e.g., drop-down lists, radio buttons, selection lists, etc.)

    env-Web env-ClientServer env-Local env-Embedded
    3Negative

    Managed code (e.g., .NET, Java) is likely, based on URLs.

    env-Web
    4Negative

    Managed code (e.g., .NET, Java) is likely, based on files found in software.

    env-ClientServer env-Local env-Embedded env-Peer2Peer env-CommProtocol
    5Negative

    Java code is likely, based on standard disclaimers (e.g., "This software contains Java from Sun...."). Such declarations are frequent on commercial software that is based on Java.

    env-Embedded env-Local env-ClientServer
    6Inconclusive

    Java code is likely, based on one of the other indicators, but it could contain Java Native Interface (JNI) code. This is indicated by the inclusion of DLLs or equivalent binary object code with Java code.

    env-Embedded env-Local env-ClientServer
Experiment
  1. Attempt injections:

    Try to feed overly long data to the system. This can be done manually or a dynamic tool (black box) can be used to automate this. An attacker can also use a custom script for that purpose.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Brute force attack through black box penetration test tool.

    env-Web env-ClientServer env-CommProtocol env-Peer2Peer
    2

    Fuzzing of communications protocols

    env-CommProtocol env-Peer2Peer env-ClientServer
    3

    Manual testing of possible inputs with attack data.

    env-All

    Outcomes

    IDtypeOutcome Description
    1Success
    Unexpected output from the application.
    2Failure
    No unexpected output from the application.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor and analyze logs for failures that exceed common usage sizes. For example, if typical transactions, even normal failed transactions, rarely exceed 250 characters, monitor logs for all attempts that contain 250 or more characters. In the event of successful exploitation, there may actually be no useful log. But an attacker's experiments will likely show up, giving clues to the ultimate attack.
    2Corrective
    Disconnect or block connections from systems or users that exceed acceptable heuristics for normal transaction sizes.
  2. Monitor responses:

    Watch for any indication of failure occurring. Carefully watch to see what happened when filter failure occurred. Did the data get in?

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Boron tagging. Choose clear attack inputs that are easy to notice in output. In binary this is often 0xa5a5a5a5 (alternating 1s and 0s). Another obvious tag value is all zeroes, but it is not always obvious what goes wrong if the null values get into the data.

    env-All
    2

    Check Log files. An attacker with access to log files can look at the outcome of bad input.

    env-Local env-Embedded

    Security Controls

    IDtypeSecurity Control Description
    1Preventative
    Prevent access to log files that contain error output.
    2Preventative
    Prevent access to and/or sanitize all error output.
Exploit
  1. Abuse the system through filter failure:

    An attacker writes a script to consistently induce the filter failure.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    DoS through filter failure. The attacker causes the system to crash or stay down because of its failure to filter properly.

    env-All
    2

    Malicious code execution. An attacker introduces a malicious payload and executes arbitrary code on the target system.

    env-All
    3

    An attacker can use the filter failure to introduce malicious data into the system and leverage a subsequent SQL injection, Cross Site Scripting, Command Injection or similar weakness if it exists.

    env-All

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Failure mode of the software (perhaps as a safety mechanism) includes exiting or ceasing to respond.

    env-All
    2Negative

    Failures do not involve stopping services, rejecting inputs or connections, and do not affect other simultaneous users of the software.

    env-All

    Outcomes

    IDtypeOutcome Description
    1Success
    Attacker-supplied code is executed on the target system.
    2Success
    The software stops responding for at least two orders of magnitude longer than the input takes to send. (e.g., 0.1s to send input induces at least a 10 second period non-responsiveness).
    3Success
    Non-response by an attacker's input has an impact on the quality of service of other simultaneous users of the software.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor software response time regularly, and react to unexpected variations.
    2Preventative
    Execute filtering modules with minimal privileges.
    3Preventative
    Execute filtering modules in operating system "sandboxes" or similar containers.
+ Attack Prerequisites

    Ability to control the length of data passed to an active filter.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
+ Examples-Instances

Description

Sending in arguments that are too long to cause the filter to fail open is one instantiation of the filter failure attack. The Taylor UUCP daemon is designed to remove hostile arguments before they can be executed. If the arguments are too long, however, the daemon fails to remove them. This leaves the door open for attack.

Description

A filter is used by a web application to filter out characters that may allow the input to jump from the data plane to the control plane when data is used in a SQL statement (chaining this attack with the SQL injection attack). Leveraging a buffer overflow the attacker makes the filter fail insecurely and the tainted data is permitted to enter unfiltered into the system, subsequently causing a SQL injection.

Description

Audit Truncation and Filters with Buffer Overflow. Sometimes very large transactions can be used to destroy a log file or cause partial logging failures. In this kind of attack, log processing code might be examining a transaction in real-time processing, but the oversized transaction causes a logic branch or an exception of some kind that is trapped. In other words, the transaction is still executed, but the logging or filtering mechanism still fails. This has two consequences, the first being that you can run transactions that are not logged in any way (or perhaps the log entry is completely corrupted). The second consequence is that you might slip through an active filter that otherwise would stop your attack.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.

High : Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.

+ Probing Techniques

Try to feed very long data as input to the program and watch for any indication that a failure has occurred. Then see if input has been admitted into the system.

Some dynamic analysis tools may be helpful here to determine whether failure can be induced by feeding overly long inputs strings into the system.

+ Indicators-Warnings of Attack

Many exceptions are thrown by the application's filter modules in a short period of time. Check the logs. See if the probes are coming from the same IP address.

+ Obfuscation Techniques

An attacker may temporally space out their probes.

An attacker may perform probes from different IP addresses.

+ Solutions and Mitigations

Make sure that ANY failure occurring in the filtering or input validation routine is properly handled and that offending input is NOT allowed to go through. Basically make sure that the vault is closed when failure occurs.

Pre-design: Use a language or compiler that performs automatic bounds checking.

Pre-design through Build: Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.

Operational: Use OS-level preventative functionality. Not a complete solution.

Design: Use an abstraction library to abstract away risky APIs. Not a complete solution.

+ Attack Motivation-Consequences
  • Run Arbitrary Code
  • Privilege Escalation
  • Denial of Service
+ Injection Vector

Web form, URL, File, Command line, Network socket, etc.

+ Payload

All of the data that just got into the system unfiltered becomes the payload.

+ Activation Zone

Since the input enters the system effectively unfiltered, it may be dangerous if used in a SQL statement (i.e. SQL injection), as part of the command executed on the target system (i.e. command injection), as part of the reflection API (i.e. reflection injection), placed in logs (i.e. log injection), or perhaps to overflow another buffer in the system and give the attacker ability to execute arbitrary code. A subsequent buffer overflow may not even be required for that as the original one may be leveraged if the attacker gets lucky, that is the payload is activated in the filter itself, which also becomes the activation zone.

+ Payload Activation Impact

Since no input validation is effectively performed in this situation, the impact of the attack may be a complete compromise of confidentiality, integrity, accountability and availability services.

+ Relevant Security Requirements

Input validation and filtering logic should fail securely (vault doors are closed)

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: MediumIntegrity Impact: HighAvailability Impact: Medium
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
C
C++
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.

CWE - Buffer Errors

+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-03-01
Modifications
ModifierOrganizationDateComments
Eugene LebanidzeCigital, Inc2007-02-26Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-05Review and revise
Paco HopeCigital, Inc.2007-10-20Added extended Attack Execution Flow
 
Fuzzing and observing application log data/errors for application mapping
Definition in a New Window Definition in a New Window
Attack Pattern ID: 215 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Fuzzing for garnering (through web or log) other adjacent user/sensitive data as an authorized system user (overly broad but valid SQL queries)
Definition in a New Window Definition in a New Window
Attack Pattern ID: 261 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
Fuzzing for garnering J2EE/.NET-based stack traces, for application mapping
Definition in a New Window Definition in a New Window
Attack Pattern ID: 214 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
HTTP Request Smuggling
Definition in a New Window Definition in a New Window
Attack Pattern ID: 33 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

HTTP Request Smuggling results from the discrepancies in parsing HTTP requests between HTTP entities such as web caching proxies or application firewalls. Entities such as web servers, web caching proxies, application firewalls or simple proxies often parse HTTP requests in slightly different ways. Under specific situations where there are two or more such entities in the path of the HTTP request, a specially crafted request is seen by two attacked entities as two different sets of requests. This allows certain requests to be smuggled through to a second entity without the first one realizing it.

Attack Execution Flow

Explore
  1. Identify HTTP parsing chain:

    Determine the technologies used in the target environment such as types of web servers, application firewalls, proxies, etc.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Investigation of the target environment to determine the types of technologies used to parse the incoming HTTP requests. Attempt to understand the parsing chain traversed by the incoming HTTP request.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    Full HTTP parsing chain for the application has been identified
Experiment
  1. Probe for vulnerable differences in HTTP parsing chain:

    Attacker sends malformed HTTP Requests to the application looking for differences in the ways that individual layers in the parsing chain parse requests. When differences are identified, the attacker crafts specially malformed HTTP requests to determine if the identified parsing differences will allow extra requests to be smuggled through parsing layers.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Create many consecutive requests to the server. Some of which must be malformed.

    env-Web
    2

    Use a proxy tool to record the HTTP responses headers.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    At some point, the server is waiting for more request information to send the last response.

    env-Web
    2Inconclusive

    No response is being received.

    env-Web
    3Negative

    Malformed HTTP requests are being totally ignored.

    env-Web
    4Negative

    Responses are being sent even if the HTTP header is incomplete.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    One layer in the application's HTTP parsing chain processes HTTP Requests that other layers do not. The server smuggles the user request into the last attacker's request and transport data such as cookie, etc.
    2Failure
    The server replies with an error to the last attacker's request.
    3Inconclusive
    No response for the last incomplete request from the attacker by the server

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor requests to the server that seem malformed.
Exploit
  1. Cache poisoning:

    The attacker decides to target the cache server. The server will then cache the request and serve a wrong page to a legitimate user's request. The malicious request will most likely exploit a Cross-Site Scripting or another injection typed vulnerability.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Leverage the vulnerabilities identified in the Experiment Phase to inject malicious HTTP request that contains HTTP Request syntax that will be processed and acted on by the outer parsing layer of the cache server but not by the inner application layer. In this way it will be cached by the server without obvious sign from the application and the corrupt data will be served to future requesters.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker gets the users to be served with this cached malicious HTTP request.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for consecutive suspicious HTTP requests.
  2. Session Hijacking:

    The attacker decides to target the web server by crafting a malicious HTTP Request containing a second HTTP Request using syntax that will not be processed and acted on by an outer "filter" parsing layer but will be acted on by the inner web server/application processing layers. The application/web server will then act on the malicious HTTP Request as if it is a valid request from the client potentially subverting session management.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Leverage the vulnerabilities identified in the Experiment Phase to inject malicious HTTP request that contains HTTP Request syntax that will not be processed and acted on by the outer parsing layer of the malicious content filters but will be by the inner application/web server layer. In this way it will be acted on by the application/web server as if it is a valid request from the client.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker gets the application/web server to act on the malicious HTTP request and allows the attacker to gain control of the target user's session.

    Security Controls

    IDtypeSecurity Control Description
    1Preventative
    Monitor server logs for consecutive suspicious HTTP requests.
+ Attack Prerequisites

    An additional HTTP entity such as an application firewall or a web caching proxy between the attacker and the second entity such as a web server

    Differences in the way the two HTTP entities parse HTTP requests

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Protocol Manipulation
  • Injection
+ Examples-Instances

Description

When using Sun Java System Web Proxy Server 3.x or 4.x in conjunction with Sun ONE/iPlanet 6.x, Sun Java System Application Server 7.x or 8.x, it is possible to bypass certain application firewall protections, hijack web sessions, perform Cross Site Scripting or poison the web proxy cache using HTTP Request Smuggling. Differences in the way HTTP requests are parsed by the Proxy Server and the Application Server enable malicious requests to be smuggled through to the Application Server, thereby exposing the Application Server to aforementioned attacks.

Related Vulnerabilities

CVE-2006-6276

Description

Apache server 2.0.45 and version before 1.3.34, when used as a proxy, easily lead to web cache poisoning and bypassing of application firewall restrictions because of non-standard HTTP behavior. Although the HTTP/1.1 specification clearly states that a request with both "Content-Length" and a "Transfer-Encoding: chunked" headers is invalid, vulnerable versions of Apache accept such requests and reassemble the ones with "Transfer-Encoding: chunked" header without replacing the existing "Content-Length" header or adding its own. This leads to HTTP Request Smuggling using a request with a chunked body and a header with "Content-Length: 0".

Related Vulnerabilities

CVE-2005-2088

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: High

The attacker has to have detailed knowledge of the HTTP protocol specifics and must also possess exact details on the discrepancies between the two targeted entities in parsing HTTP requests.

+ Resources Required

None

+ Probing Techniques

If system documentation is available, the attacker can look up the exact versions of the two targeted entities, since different versions of the same system often behave differently. The attacker can also use product-specific documentation to figure out differences in parsing HTTP requests between the two entities.

In case where no documentation is available, the attacker needs to reliably fingerprint the targeted entities to discover the nature and version of the entities. Having done this, the attacker then needs to experimentally determine how the two entities differ in parsing requests.

+ Indicators-Warnings of Attack

Differences in requests processed by the two entities. This requires careful monitoring or a capable log analysis tool.

+ Solutions and Mitigations

HTTP Request Smuggling is usually targeted at web servers. Therefore, in such cases, careful analysis of the entities must occur during system design prior to deployment. If there are known differences in the way the entities parse HTTP requests, the choice of entities needs consideration.

Employing an application firewall can help. However, there are instances of the firewalls being susceptible to HTTP Request Smuggling as well.

+ Attack Motivation-Consequences
  • Run Arbitrary Code
  • Privilege Escalation
  • Data Modification
+ Injection Vector

HTTP requests that are interpreted and parsed differently by the targeted entities.

+ Payload

HTTP request to be smuggled through the first entity to the second one.

+ Activation Zone

The application server behind another HTTP entity

+ Payload Activation Impact

The impact of activation is that a particular request that was not supposed to pass through the first entity is received by the second entity who responds to it. This can defeat protection against malware or lead to Cross-Site Scripting

+ Relevant Security Requirements

System integration testing must include security checks to protect against Multiple Interpretation Errors across systems.

+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: MediumIntegrity Impact: MediumAvailability Impact: Low
+ Technical Context
Architectural Paradigms
Client-Server
n-Tier
Frameworks
All
Platforms
All
Languages
All
+ References

CWE - HTTP Request Smuggling

CWE - Multiple Interpretation Error

+ Content History
Submissions
SubmitterDateComments
Chiradeep B Chhaya2007-01-10First Draft
Modifications
ModifierOrganizationDateComments
Malik HamroCigital, Inc2007-02-27Reformat to new schema and review
Sean BarnumCigital, Inc2007-03-05Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Description
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Romain GaucherCigital, Inc2009-02-10Created draft content for detailed description
Sean BarnumCigital Federal, Inc2009-04-13Reviewed and revised content for detailed description
 
HTTP Response Smuggling
Definition in a New Window Definition in a New Window
Attack Pattern ID: 273 (Detailed Attack Pattern Completeness: Hook)Status: Draft
 
HTTP Response Splitting
Definition in a New Window Definition in a New Window
Attack Pattern ID: 34 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This attack uses a maliciously-crafted HTTP request in order to cause a vulnerable web server to respond with an HTTP response stream that will be interpreted by the client as two separate responses instead of one. This is possible when user-controlled input is used unvalidated as part of the response headers. The target software, the client, will interpret the injected header as being a response to a second request, thereby causing the maliciously-crafted contents be displayed and possibly cached.

To achieve HTTP Response Splitting on a vulnerable web server, the attacker:

Attack Execution Flow

Explore
  1. Spider:

    Using a browser or an automated tool, an attacker follows all public links on a web site. He records all the links, the forms and all potential user-controllable input points for the web application.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters in the URL, forms found in the pages (like file upload, etc.).

    env-Web
    2

    Use a proxy tool to record all links visited during a manual traversal of the web application.

    env-Web
    3

    Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    Inputs are transported through HTTP

    env-Web
    2Positive

    The application uses redirection techniques (HTTP Location, etc.)

    env-Web
    3Inconclusive

    Using URL rewriting, parameters may be part of the URL path.

    env-Web
    4Inconclusive

    No parameters appear to be used on the current page. Even though none appear, the web application may still use them if they are provided.

    env-Web
    5Negative

    Applications that have only static pages or that simply present information without accepting input are unlikely to be susceptible.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    A list of user-controllable input entry points is created by the attacker.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).
    2Detective
    Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.
    3Preventative
    Use CAPTCHA to prevent the use of the application by an automated tool.
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be automated.
Experiment
  1. Attempt variations on input parameters:

    The attacker injects the entry points identified in the Explore Phase with response splitting syntax and variations of payloads to be acted on in the additional response. He records all the responses from the server that include unmodified versions of his payload.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use CR\LF characters (encoded or not) in the payloads in order to see if the HTTP header can be split.

    env-Web
    2

    Use a proxy tool to record the HTTP responses headers.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    The web server uses unvalidated user-controlled input as part of the response headers

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The CR\LF characters are passed in the HTTP header and two responses are generated for a single request.
    2Failure
    All CR\LF characters are consistently re-encoded or stripped before being written in the HTTP header
    3Inconclusive
    The size of the payload is being limited by the server-side application.
    4Inconclusive
    Some sensitive characters are consistently encoded, but others are not.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor input to web servers (not only GET, but all in the inputs), application servers, and other HTTP infrastructure (e.g., load balancers). Alert on CR\LF characters.
    2Preventative
    Do not use user-controllable inputs in HTTP headers
    3Preventative
    Filter CR/LF syntax out of any user-controllable input utilized in HTTP headers.
    4Preventative
    Actively monitor the application and either deny or redirect requests from origins that appear to be generating HTTP Response Splitting attacks.
Exploit
  1. Cross-Site Scripting:

    As the attacker succeeds in exploiting the vulnerability, he can choose to attack the user with Cross-Site Scripting. The possible outcomes of such an attack are described in the Cross-Site Scripting related attack patterns.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Inject cross-site scripting payload preceded by response splitting syntax (CR/LF) into user-controllable input identified as vulnerable in the Experiment Phase.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The malicious script is executed within the user's context.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for consecutive suspicious HTTP request
    2Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    3Preventative
    Appropriately encode all browser output to avoid scripting syntax
  2. Cache poisoning:

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    The attacker decides to target the cache server by forging new responses. The server will then cache the second request and response. The cached response has most likely an attack vector like Cross-Site Scripting; this attack will then be serve to many clients due to the caching system.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    System performs caching of HTTP responses

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The attacker gets the users to be served with this cached malicious HTTP response.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor server logs for consecutive suspicious HTTP requests.
    2Preventative
    Apply appropriate input validation to filter all user-controllable input of scripting syntax
    3Preventative
    Appropriately encode all browser output to avoid scripting syntax
+ Attack Prerequisites

    User-controlled input used as part of HTTP header

    Ability of attacker to inject custom strings in HTTP header

    Insufficient input validation in application to check for input sanity before using it as part of response header

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Injection
  • Protocol Manipulation
+ Examples-Instances

Description

In the PHP 5 session extension mechanism, a user-supplied session ID is sent back to the user within the Set-Cookie HTTP header. Since the contents of the user-supplied session ID are not validated, it is possible to inject arbitrary HTTP headers into the response body. This immediately enables HTTP Response Splitting by simply terminating the HTTP response header from within the session ID used in the Set-Cookie directive.

Related Vulnerabilities

CVE-2006-0207

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: High

The attacker needs to have a solid understanding of the HTTP protocol and HTTP headers and must be able to craft and inject requests to elicit the split responses.

+ Resources Required

None

+ Probing Techniques

With available source code, the attacker can see whether user input is validated or not before being used as part of output. This can also be achieved with static code analysis tools

If source code is not available, the attacker can try injecting a CR-LF sequence (usually encoded as %0d%0a in the input) and use a proxy such as Paros to observe the response. If the resulting injection causes an invalid request, the web server may also indicate the protocol error.

+ Indicators-Warnings of Attack

The only indicators are multiple responses to a single request in the web logs. However, this is difficult to notice in the absence of an application filter proxy or a log analyzer. There are no indicators for the client

+ Solutions and Mitigations

To avoid HTTP Response Splitting, the application must not rely on user-controllable input to form part of its output response stream. Specifically, response splitting occurs due to injection of CR-LF sequences and additional headers. All data arriving from the user and being used as part of HTTP response headers must be subjected to strict validation that performs simple character-based as well as semantic filtering to strip it of malicious character sequences and headers.

+ Attack Motivation-Consequences
  • Run Arbitrary Code
  • Privilege Escalation
+ Injection Vector

User-controllable input that forms part of output HTTP response headers

+ Payload

Encoded HTTP header and data separated by appropriate CR-LF sequences. The injected data must consist of legitimate and well-formed HTTP headers as well as required script to be included as HTML body.

+ Activation Zone

API calls in the application that set output response headers.

+ Payload Activation Impact

The impact of payload activation is that two distinct HTTP responses are issued to the target, which interprets the first as response to a supposedly valid request and the second, which causes the actual attack, to be a response to a second dummy request issued by the attacker.

+ Relevant Security Requirements

All client-supplied input must be validated through filtering and all output must be properly escaped.