CAPEC Detailed Abstraction Attack Pattern Slice (Release 1.1)
CAPEC Detailed Abstraction Attack Pattern Slice (Release 1.1)
This view (slice) covers detailed abstraction attack patterns.
| Attack Pattern ID | Pattern Abstraction: Detailed 3 | | Typical Severity | Medium | | Description | Summary An attacker intentionally introduces leading characters that enable getting the input past the filters. The API that is being targetted, ignores the leading "ghost" characters, and therefore processes the attacker's input. This occurs when the targetted API will accept input data in several syntactic forms and interpret it in the equivalent semantic way, while the filter does not take into account the full spectrum of the syntactic forms acceptable to the targetted API.
Some APIs will strip certain leading characters from a string of parameters. Perhaps these characters are considered redundant, and for this reason they are removed. Another possibility is the parser logic at the beginning of analysis is specialized in some way that causes some characters to be removed. The attacker can specify multiple types of alternative encodings at the beginning of a string as a set of probes.
One commonly used possibility involves adding ghost characters—extra characters that don’t affect the validity of the request at the API layer. If the attacker has access to the API libraries being targeted, certain attack ideas can be tested directly in advance. Once alternative ghost encodings emerge through testing, the attacker can move from lab-based API testing to testing real-world service implementations.
Attack Execution Flow
Determine if the source code is available and if so, examine the filter logic.
If the source code is not available, write a small program that loops through various possible inputs to given API call and tries a variety of alternate (but equivalent) encodings of strings with leading ghost characters. Knowlege of frameworks and libraries used and what filters they apply will help to make this search more structured.
Observe the effects. See if the probes are getting past the filters. Identify a string that is semantically equivalent to that which an attacker wants to pass to the targeted API, but syntactically structured in a way as to get past the input filter. That encoding will contain certain ghost characters that will help it get past the filters. These ghost characters will be ignored by the targeted API.
Once the "winning" alternate encoding using (typically leading) ghost characters is identified, an attacker can launch the attacks against the targetted API (e.g. directory traversal attack, arbitrarary shell command execution, corruption of files)
| | Attack Prerequisites |
The targetted API must ignore the leading ghost characters that are used to get past the filters for the semantics to be the same.
| | Typical Likelihood of Exploit |
Medium
| | Methods of Attack | | | Examples-Instances | Description Alternate Encoding with Ghost Characters in FTP and Web Servers
Some web and FTP servers fail to detect prohibited upward directory traversals if the user-supplied pathname contains extra characters such as an extra leading dot. For example, a program that will disallow access to the pathname “../test.txt” may erroneously allow access to that file if the pathname is specified as “…/test.txt”. This attack succeeds because 1) the input validation logic fails to detect the triple-dot as a directory traversal attempt (since it isn’t dot-dot), 2) some part of the input processing decided to strip off the “extra” dot, leaving the dot-dot behind.
Using the file system API as the target, the following strings are all equivalent to many programs:
.../../../test.txt ............/../../test.txt ..?/../../test.txt ..????????/../../test.txt ../test.txt
As you can see, there are many ways to make a semantically equivalent request. All these strings ultimately result in a request for the file ../test.txt. Related Vulnerability | | Attacker Skill or Knowledge Required |
Medium
| | Resources Required | | | Solutions and Mitigations |
Perform white list rather than black list input validation.
Canonicalize all data prior to validation.
Take an iterative approach to input validation (defense in depth).
| | Attack Motivation-Consequences | - Privilege Escalation
- Data Modification
| | Context Description | Building “Equivalent” Requests
A large number of commands are subject to parsing or filtering. In many cases a filter only considers one particular way to format a command. The fact is that the same command can usually be encoded in thousands of different ways. In many cases, an alternative encoding for the command will produce exactly the same results as the original command. Thus, two commands that look different from the logical perspective of a filter end up producing the same semantic result. In many cases, an alternatively encoded command can be used to attack a software system, because the alternative command allows an attacker to perform an operation that would otherwise be blocked.
Mapping the API Layer
A good approach to help identify and map possible alternate encodings involves writing a small program that loops through all possible inputs to a given API call. This program can, for example, attempt to encode filenames in a variety of ways. For each iteration of the loop, the “mungified” filename can be passed to the API call and the result noted.
The following code snippet loops through many possible values that can be used as a prefix to the string \test.txt. Results of running a program like this can help us to determine which characters can be used to perform a ../../ (dots and slashes) relative traversal attack.
int main(int argc, char* argv[]) { for(unsigned long c=0x01010101;c != -1;c++) { char _filepath[255]; sprintf(_filepath, "%c%c%c%c\\test.txt", c >> 24, c >> 16, c >> 8, c&0x000000FF );
try { FILE *in_file = fopen(_filepath, "r");
if(in_file) { printf("checking path %s\n", _filepath); puts("file opened!"); getchar(); fclose(in_file); } } catch(...) {
} } return 0; }
Slight (but still automatic) modifications can be made to the string in creative ways. Ultimately, the modified string boils down to an attempt to use different tricks to obtain the same file. For example, one resulting attempt might try a command like this:
sprintf(_filepath, "..%c\\..%c\\..%c\\..%c\\scans2.txt", c, c, c, c);
A good way to think about this problem is to think of layers. The API call layer is what the examples shown here are mapping. If an engineer has placed any filters in front of the API call, then these filters can be considered additional layers, wrapping the original set of possibilities. By pondering all the possible inputs that can be provided at the API layer, we can begin uncovering and exercising any filters that the software has in place. If we know that the software definitely uses file API calls, we can try all kinds of filename encoding tricks that we know about. If we get lucky, eventually one set of encoding tricks will work, and we can get our data successfully through the filters and into the API call.
Drawing on the techniques described in Chapter 5 of "Exploiting Software: How to Break Code" (See reference - G. Hoglund and G. McGraw) , we can list a number of possible escape codes that can be injected into API calls (many of which help with the filter avoidance problem). If the data are eventually being piped into a shell, for example, we might be able to get control codes to take effect. A particular call may write data to a file or a stream that are eventually meant to be viewed on a terminal or in a client program. As a simple example, the following string contains two backspace characters that are very likely to show up in the terminal’s execution:
write("echo hey!\x08\x08");
When the terminal interprets the data we have passed in, the output will be missing the last two characters of the original string. This kind of trick has been used for ages to corrupt data in log files. Log files capture all kinds of data about a transaction. It may be possible to insert NULL characters (for example, %00 or '\0') or to add so many extra characters to the string that the request is truncated in the log. Imagine a request that has more than a thousand extra characters tacked on at the end. Ultimately, the string may be trimmed in the log file, and the important telltale data that expose an attack will be lost.
Ghost Characters
Ghost characters are extra characters that can be added to a request. The extra characters are designed not to affect the validity of the request. One easy example involves adding extra slashes to a filename. In many cases, the strings
/some/directory/test.txt
and
/////////////////some/////////////directory//////////////test.txt
are equivalent requests.
From G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.
| | Injection Vector |
Web Form, URL, Network Socket, File
| | Payload |
The payload is the parameter that an attacker is supplying to the targetted API that will allow the attacker to elevate privilege and subvert the authorization service.
| | Activation Zone |
The targetted API is the activation zone. These attacks often target the file system or the shell to execute commands.
| | Payload Activation Impact |
Failure in authorization service may lead to compromises in data confidentiality and integrity.
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 173 | Failure to Handle Alternate Encoding | Targeted | | 41 | Failure to Resolve Path Equivalence | Targeted | | 172 | Encoding Error | Targeted | | 171 | Cleansing, Canonicalization, and Comparison Errors | Targeted | | 179 | Incorrect Behavior Order: Early Validation | Targeted | | 180 | Incorrect Behavior Order: Validate Before Canonicalize | Targeted | | 181 | Incorrect Behavior Order: Validate Before Filter | Secondary | | 183 | Permissive Whitelist | Secondary | | 184 | Incomplete Blacklist | Secondary | | 20 | Insufficient Input Validation | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Targeted |
| | Related Security Principles | -
Defense in Depth
-
Reluctance to Trust
-
Least Privilege
| | Related Guidelines | - Perform input validation and filtering on data in its canonical form.
- Understand the APIs to which user input will be passed and know how permissive they are. Perform appropriate input validation given that information.
| | Purpose | Exploitation | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| Low | Low | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References | G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.
| | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Eugene Lebanidze | Cigital, Inc | 2007-02-26 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Name, Attack Execution Flow and Examples | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 4 | | Typical Severity | High | | Description | Summary This attack relies on the attacker using unexpected formats for representing IP addresses. Networked applications may expect network location information in a specific format, such as fully qualified domains names, URL, IP address, or IP Address ranges. The issue that the attacker can exploit is that these design assumptions may not be validated against a variety of different possible encodings and network address location formats. Applications that use naming for creating policy namespaces for managing access control may be susceptible to queryin directly by IP addresses, which is ultimately a more generally authoritative way of communicating on a network. Alternative IP addresses can be used by the attacker to bypass application access control in order to gain access to data that is only protected by obscuring its location. In addition this type of attack can be used as a reconnaissance mechansim to provide entry point information that the attacker gathers to penetrate deeper into the system. | | Attack Prerequisites |
The target software must fail to anticipate all of the possible valid encodings of an IP/web address.
| | Typical Likelihood of Exploit |
Medium
| | Methods of Attack | - Injection
- Protocol Manipulation
- API Abuse
| | Examples-Instances | Description An attacker identifies an application server that applies a security policy based on the domain and application name, so the access control policy covers authentication and authorization for anyone accessing http://example.domain:8080/application. However, by putting in the IP address of the host the application authentication and authorization controls may be bypassed http://192.168.0.1:8080/application. The attacker relies on the victim applying policy to the namespace abstraction and not having a default deny policy in place to manage exceptions.
| | Attacker Skill or Knowledge Required |
Low → The attacker has only to try IP address combinations.
| | Resources Required |
Ability to communicate with server. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.
| | Solutions and Mitigations |
Design: Default deny access control policies
Design: Input validation routines should check and enforce both input data types and content against a positive specification. In regards to IP addresses, this should include the authorized manner for the application to represent IP addresses and not accept user specified IP addresses and IP address formats (such as ranges)
Implementation: Perform input validation for all remote content.
| | Attack Motivation-Consequences | | | Context Description | “Attack Pattern: Alternative IP Addresses "IP address ranges can be represented using alternative methods. Here are some examples: 192.168.0.0/24 192.168.0.0/255.255.255.0 192.168.0.* Classic encoding techniques can be directed against IP numbers as well." [Hoglund and McGraw 04]
| | Injection Vector |
Malicious input delivered through standard input
| | Payload |
Varies with instantiation of attack pattern. Malicious payload may be passed directly from appliation client, such as the web browser.
| | Activation Zone |
Client machine and client network
| | Payload Activation Impact |
Enables attacker to view and access unexpected network services.
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 291 | Trusting Self-reported IP Address | Targeted | | 180 | Incorrect Behavior Order: Validate Before Canonicalize | Targeted | | 41 | Failure to Resolve Path Equivalence | Targeted | | 345 | Insufficient Verification of Data Authenticity | Targeted |
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| Medium | Medium | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References |
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.
| | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-01-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Gunnar Peterson | Cigital, Inc | 2007-02-28 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-09 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Name, Attack Prerequisites,Resources Required and Method of Attack | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 5 | | Typical Severity | Very High | | 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 |
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 Skill or Knowledge Required |
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
| | Context Description | “Attack Pattern: Analog In-band Switching Signals (aka "Blue Boxing") Many people have heard of 2600, the frequency used in the United States to control telephone switches during the 1960s and 1970s. (Come to think of it, probably more people have heard of the hacker 'zine 2600 and its associated club than have heard of the reason for the name of the club,) Most systems are no longer vulnerable to ancient phreaking attacks. However older systems are still found internationally. Overseas trunk lines that use trans-Atlantic cabling are prone to the in-band signal problem, and they are too expensive a resource to abandon. Thus, many overseas (home-country direct) 800/888 numbers are known to have in-band signal problems even today.
Consider the CCITT-5(C5) signaling system that is used internationally. This system does not use the commonly known 2,600 Hz, but instead uses 2,400Hz as a control signal. If you have ever heard the "pleeps" and chirps on the Pink Floyd album "The Wall," then you have heard C5 signals. There are millions of phone lines still in operation today that are routed through switches with in-band signaling.
This attack pattern involves playing specific control commands across a normal voice link, thus seizing control of the line, rerouting calls, and so on."
[Hoglund and McGraw 04]
| | 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.
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 264 | Permissions, Privileges, and Access Controls | Targeted |
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| Low | Medium | Medium |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| Other | Other | Other | All |
| | References |
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.
| | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-01-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Gunnar Peterson | Cigital, Inc | 2007-02-28 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-09 | Review and revise |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 7 | | Typical Severity | High | | 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. In order to achieve this using Blind SQL Injection, an attacker: 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 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 Technique |
|---|
| Description | Environments |
|---|
| Research types of SQL queries and determine which ones could be used at various places in an application. | env-All |
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 |
|---|
| Description | Environments |
|---|
| Add clauses to the SQL queries such that the query logic does not change. | env-All | | 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 |
|
Outcome |
|---|
| ID | Type | Description |
|---|
| c7s2o1 | Success | At least one way to complete a hypothesized SQL query that would violate the application developer's assumptions. |
Experiment 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 |
|---|
| Description | Environments |
|---|
| Use web browser to inject input through text fields or through HTTP GET parameters. | env-Web | | 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 | | Use network-level packet injection tools such as netcat to inject input | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | Use modified client (modified by reverse engineering) to inject input. | env-ClientServer env-Peer2Peer env-CommProtocol |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c7s3i1 | Positive | Attacker receives normal response from server. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | c7s3i2 | Positive | Response takes expected amount of time after delay is injected. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | c7s3i3 | Negative | 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 |
|---|
| ID | Type | Description |
|---|
| c7s3o1 | Success | At least one user-controllable input susceptible to injection found. | | c7s3o2 | Failure | No user-controllable input susceptible to injection found. |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c7s3sc1 | Detective | 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. | | c7s3sc2 | Preventative | Input validation of user-controlled data before including it in a SQL query | | c7s3sc3 | Preventative | Use APIs that help mitigate SQL injection (such as PreparedStatement in Java) |
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 |
|---|
| Description | Environments |
|---|
| 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 | | Try injecting a string containing 0x313D31 (this evaluates to 1=1 in MySQL only) | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | 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 of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c7s4i1 | Positive | Success outcome in previous step | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | c7s4i2 | Negative | Failure outcome in previous step | env-Web env-ClientServer env-Peer2Peer env-CommProtocol |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c7s4o1 | Success | Database platform in use discovered. | | c7s4o2 | Failure | Database platform in use not discovered. |
Exploit 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 |
|---|
| Description | Environments |
|---|
| Automatically extract database schema using a tool such as Absinthe. | env-Web | | Manually perform the blind SQL Injection to extract desired information about the database schema. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c7s5i1 | Positive | Success outcome in previous step. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | c7s5i2 | Negative | Failure outcome in previous step. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c7s5o1 | Success | Desired information about database schema extracted. | | c7s5o2 | Failure | Desired information about database schema could not be extracted. |
|
Security Control |
|---|
| ID | Type | Description |
|---|
| c7s5sc1 | Detective | Large number of unusual queries in database logs. |
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 Technique |
|---|
| Description | Environments |
|---|
| 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 of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c7s6i1 | Positive | Success outcome in previous step. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol | | c7s6i2 | Negative | Failure outcome in previous step. | env-Web env-ClientServer env-Peer2Peer env-CommProtocol |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c7s6o1 | Success | Attacker achieves goal of unauthorized system access, denial of service, etc. | | c7s6o2 | Failure | 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 |
High
| | Methods of Attack | | | 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 Vulnerability | | Attacker Skill or Knowledge Required | 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
| | Context Description | An attacker attempts Blind SQL Injection when traditional SQL Injection is not possible due to suppression of error messages. Blind SQL Injection is performed by appending logical conditions to the query being injected such that they evaluate to true or false in the context of the data stored in the database. The first step is to get the syntax for the injected query right. For example, consider a database that has a table named "users". Consider the following query: SELECT fname, lname, dob, ssn, address FROM users WHERE userid="user1" AND password="user1pwd"; To determine whether the "userid" field is injectable or not, the attacker tries an input such as user1" AND 3>1+1;-- This causes the following query SELECT fname, lname, dob, ssn, address FROM users WHERE userid="user1" AND 3>1+1;-- to be passed to the database. If the parameter is injectable, the database evaluates 3>1+1 to be true and executes the query. If, on the other hand, a condition such as 3<2 were passed, the database would return an error. Since the application suppresses such errors, the attacker never sees it. However, the application may simply hang or it may redirect to a custom error page or a default page, which is definitely an indication that the injected condition was evaluated to be false. The query can also fail if the original condition was within parentheses, such as WHERE (userid="johns" AND password="abracadabra") In such a case, the attacker will have to try injection such that the parentheses match up. Once the attacker gets the syntax right, the next step is to identify the database. This can be achieved by using operators that are unique to each database engine. For example, a condition such as "abc" = "a"+"bc" evaluates to true on MS SQL Server whereas it evaluates to false on Oracle since the concatentation operator is ||. Another approach is using system-specific functions such as those for date and time. The next step is to determine the number and type of parameters. This can again be achieved by exploiting the SELECT...WHERE conditions or using UNION SELECT statements with dummy numeric or character-based parameters. Once the type of database as well as the structure of the query has been mapped out by asking a number of questions to the database, the attacker is in a position to inject the database and extract information from it. Blind SQL Injection is a classic example of solution by reduction where the domain to be attacked is successively narrowed down by the attacker through true or false queries to the database. | | 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. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 89 | Failure to Sanitize Data into SQL Queries (aka 'SQL Injection') | Targeted | | 209 | Error Message Information Leaks | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Secondary | | 20 | Insufficient Input Validation | Secondary | | 390 | Detection of Error Condition Without Action | Secondary |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 66 | SQL Injection | Occasionally Precedes | |
| | 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. | | Related Security Principles | - Reluctance to Trust
- Failing Securely
- Defense in Depth
| | Related Guidelines | - Never Use Input as Part of a Directive to any Internal Component
- Handle All Errors Safely
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References | CWE - Input Validation CWE - Improper Error Handling | | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| Chiradeep B Chhaya | | 2007-02-22 | Third Draft - Revised to schema v1.4 |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Malik Hamro | Cigital, Inc | 2007-02-27 | Reformat to new schema and review | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Description, Attack Prerequisites and Related Attack Patterns | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback | | Amit Sethi | Cigital, Inc. | 2007-10-29 | Added extended Attack Execution Flow |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 8 | | Typical Severity | High | | 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 |
High
| | Methods of Attack | | | Examples-Instances | Description Attack Example: Libc in FreeBSD
A buffer overflow in the FreeBSD utility setlocale (found in the libc module) puts many programs at risk all at once.
Description Xtlib
A buffer overflow in the Xt library of the X windowing system allows local users to execute commands with root privileges.
| | Attacker Skill or Knowledge Required | 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. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 120 | Unbounded Transfer ('Classic Buffer Overflow') | Targeted | | 119 | Failure to Constrain Operations within the Bounds of an Allocated Memory Buffer | Targeted | | 118 | Range Errors | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Targeted | | 20 | Insufficient Input Validation | Targeted |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 100 | Overflow Buffers | More Detailed | |
| | Relevant Security Requirements | Bound checking should be performed when copying data to a buffer. | | Related Security Principles | - Reluctance to trust
- Defense in Depth
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References | G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. CWE – Buffer Errors | | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Eric Dalci | Cigital, Inc | 2007-02-13 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Description | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 9 | | Typical Severity | High | | 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 |
High
| | Methods of Attack | | | Examples-Instances | Description Attack Example: HPUX passwd
A buffer overflow in the HPUX passwd command allows local users to gain root privileges via a command-line option.</AttackExample> <AttackExample>Attack Example: Solaris getopt
A buffer overflow in Solaris’s getopt command (found in libc) allows local users to gain root privileges via a long argv[0].
| | Attacker Skill or Knowledge Required | 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. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 120 | Unbounded Transfer ('Classic Buffer Overflow') | Targeted | | 118 | Range Errors | Targeted | | 119 | Failure to Constrain Operations within the Bounds of an Allocated Memory Buffer | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Targeted | | 20 | Insufficient Input Validation | Targeted |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 100 | Overflow Buffers | More Detailed | | | 10 | Buffer Overflow via Environment Variables | More Detailed | |
| | Related Security Principles | - Reluctance to trust
- Defense in Depth
- Least Privilege
| | Related Guidelines | - Bound checking should be performed when copying data to a buffer.
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References | G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. CWE – Buffer Errors | | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Eric Dalci | Cigital, Inc | 2007-02-13 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Attack Execution Flow, Probing Techniques and Method of Attack | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 10 | | Typical Severity | High | | 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 |
High
| | Methods of Attack | | | Examples-Instances | Description Attack Example: Buffer Overflow in $HOME
A buffer overflow in sccw allows local users to gain root access via the $HOME environmental variable.
Related Vulnerability Description Attack Example: Buffer Overflow in TERM
A buffer overflow in the rlogin program involves its consumption of the TERM environmental variable.
Related Vulnerability | | Attacker Skill or Knowledge Required |
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. | | Obfuscation Techniques | | | 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. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 120 | Unbounded Transfer ('Classic Buffer Overflow') | Targeted | | 302 | Authentication Bypass by Assumed-Immutable Data | Targeted | | 118 | Range Errors | Targeted | | 119 | Failure to Constrain Operations within the Bounds of an Allocated Memory Buffer | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Targeted | | 99 | Insufficient Control of Resource Identifiers (aka 'Resource Injection') | Targeted | | 20 | Insufficient Input Validation | Targeted |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 100 | Overflow Buffers | More Detailed | |
| | Related Security Principles | | | Related Guidelines | - Bound checking should be performed when copying data to a buffer.
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | References | G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. CWE – Buffer Errors | | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Eric Dalci | Cigital, Inc | 2007-02-13 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Name | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 14 | | Typical Severity | High | | 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 |
Medium
| | Methods of Attack | | | Examples-Instances | Description Attack Example: Buffer Overflow in Internet Explorer 4.0 Via EMBED Tag
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 Skill or Knowledge Required | 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
| | Context Description | “Backwash Attacks: Leveraging Client-side Buffer Overflows
Nothing is more forward than directly attacking those who are attacking you. In many cases this philosophy is instantiated as a series of denial-of-service attacks launched in either direction. In standard scenarios, you can learn what IP address is being used to attack you, and then you can follow up with an attack of your own. (Be forewarned, however, that the legal ramifications of counterattack are drastic.) If the attacker is dumb enough to have open services, you may in some cases be able to own their system.
This has led some security types to consider a rather insidious tactic—creating hostile network services that look like valid targets. The basic idea builds on the idea of honey pots, but goes one important step further. Because most client software contains buffer overflows and other vulnerabilities, including a capacity to exploit these weaknesses directly when probed is within the realm of possibility.
Not surprisingly, of all the code that gets tested and probed in a security situation, client code is usually ignored. This is one of the reasons that client code ends up with more serious problems than server code. If a vulnerable client attaches to a hostile service, the hostile service can attempt to identify the type and version of the client that is connecting. This is a variety of fingerprinting.
Once the client is properly identified, the hostile server can issue a response that exploits a buffer overflow (or some other security defect) in the client. Typically this kind of attack is not designed simply just to crash the client. Attackers using this technique can inject a virus or backdoor into the original attacker’s computer using their own connection against them.
Obviously, this kind of “backwash attack” is a serious threat to an attacker. Anyone planning to attack arbitrary systems should assume that a backwash attack can and will happen. Any and all client software should be carefully audited before use.” | | 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. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 120 | Unbounded Transfer ('Classic Buffer Overflow') | Targeted | | 353 | Failure to Add Integrity Check Value | Targeted | | 118 | Range Errors | Targeted | | 119 | Failure to Constrain Operations within the Bounds of an Allocated Memory Buffer | Targeted | | 74 | Failure to Sanitize Data into a Different Plane (aka 'Injection') | Targeted | | 20 | Insufficient Input Validation | Targeted |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 8 | Buffer Overflow in an API Call | More Detailed | |
| | Related Security Principles | - Reluctance to Trust
- Defense in Depth
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| Client-Server | All | All | All |
| | References | G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. CWE – Buffer Errors | | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Eric Dalci | Cigital, Inc | 2007-02-13 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Related Attack Patterns | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 16 | | Typical Severity | High | | 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 Determine application's/system's password policy: Determine the password policies of the target application/system. |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Determine minimum and maximum allowed password lengths. | env-All | | 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 | | Determine account lockout policy (a strict account lockout policy will prevent brute force attacks). | env-All |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c49s0i1 | Positive | Passwords are used in the application/system | env-All | | c49s0i2 | Negative | Passwords are not used in the application/system. | env-All |
Select dictionaries:
Pick the dictionaries to be used in the attack (e.g. different languages, specific terminology, etc.)
|
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Select dictionary based on particular users' preferred languages. | env-All | | Select dictionary based on the application/system's supported languages. | env-All |
Determine username(s) to target: Determine username(s) whose passwords to crack. |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Obtain username(s) by sniffing network packets. | env-CommProtocol env-Peer2Peer env-ClientServer | | 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 | | 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 |
|
Indicator of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c16s2i1 | Negative | 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 |
|---|
| ID | Type | Description |
|---|
| c16s2o1 | Success | At least one valid username found. | | c16s2o2 | Failure | Presence of any valid usernames could not be established. |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c16s2sc1 | Preventative | Do not reveal information regarding validity of particular usernames to users. | | c16s2sc2 | Corrective | Lock out accounts whose usernames are suspected to have been compromised. |
|
|