CAPEC Dictionary (Release 1.1)
CAPEC Dictionary (Release 1.1)
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
| Attack Pattern ID | Pattern Abstraction: Standard 17 | | Typical Severity | Very High | | Description | Summary An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
| | Attack Prerequisites |
System's configuration must allow an attacker to directly access executable files or upload files to execute. This means that any access control system that is supposed to mediate communications between the subkect and the object is set incorrectly or assumes a benign environment.
| | Typical Likelihood of Exploit |
High
| | Methods of Attack | - Modification of Resources
- API Abuse
| | Examples-Instances | Description Consider a directory on a web server with the following permissions
drwxrwxrwx 5 admin public 170 Nov 17 01:08 webroot
This could allow an attacker to both execute and upload and execute programs' on the web server. This one vulnerability can be exploited by a threat to probe the system and identify additional vulnerabilities to exploit.
| | Attacker Skill or Knowledge Required |
Low → to identify and execute against an overprivileged system interface
| | Resources Required |
Ability to communicate synchronously or asynchronously with server that publishes an overprivileged directory, program, or interface. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.
| | Solutions and Mitigations |
Design: Enforce principle of least privilege
Design: Run server interfaces with a non-root account and/or utilize chroot jails or other configuration techniques to constrain privileges even if attacker gains some limited access to commands.
Implementation: Perform testing such as pentesting and vulnerability scanning to identify directories, programs, and interfaces that grant direct access to executables.
| | Attack Motivation-Consequences | - Run Arbitrary Code
- Data Modification
- Information Leakage
- Privilege Escalation
| | Context Description | “Attack Pattern: Direct Access to Executable Files A privileged program is directly accessible. The program performs operations on behalf of the attacker that allow privilege escalation or shell access. For Web servers, this is often a fatal issue. If a server runs external executables provided by a user (or even simply named by a user), the user can cause the system to behave in unanticipated ways. This may be accomplished by passing in command-line options or by spinning an interactive session. A problem like this is almost always as bad as giving complete shell access to an attacker.
The most common targets for this kind of attack are Web servers. The attack is so easy that attackers have been known to use Internet search engines to find potential targets. The Altavista search engine is a great resource for attackers looking for such targets. Google works too." [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 attacker to execute server side code with any commands that the program owner has privileges to.
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 285 | Missing or Inconsistent Access Control | Targeted | | 272 | Least Privilege Violation | Targeted | | 59 | Failure to Resolve Links Before File Access (aka 'Link Following') | Targeted | | 282 | Improper Ownership Management | Targeted | | 275 | Permission Issues | Targeted | | 264 | Permissions, Privileges, and Access Controls | Targeted | | 270 | Privilege Context Switching Error | Targeted |
| | Related Attack Patterns | | ID | Name | Relationship Type | Relationship Description |
|---|
| 1 | Accessing Functionality Not Properly Constrained by ACLs | More Detailed | |
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | Medium | Low |
| | 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, Description and Examples | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| Attack Pattern ID | Pattern Abstraction: Detailed 31 | | Typical Severity | High | | 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 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 |
|---|
| Description | Environments |
|---|
| 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 | | Sniff cookie using a network sniffer such as Wireshark | env-Web | | Obtain cookie from local memory or filesystem using a utility such as the Firefox Cookie Manager or AnEC Cookie Editor. | env-Web | | Steal cookie via a cross-site scripting attack. | env-Web | | Guess cookie contents if it contains predictable information. | env-Web |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c31s1i1 | Positive | Cookies used in web application. | env-Web | | c31s1i2 | Negative | Cookies not used in web application. | env-Web |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c31s1o1 | Success | Cookie captured by attacker. | | c31s1o2 | Failure | Cookie cannot be captured by attacker. |
|
Security Control |
|---|
| ID | Type | Description |
|---|
| c31s1sc1 | Preventative | 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 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 |
|---|
| Description | Environments |
|---|
| If cookie shows any signs of being encoded using a standard scheme such as base64, decode it. | env-Web | | Analyze the cookie's contents to determine whether it contains any sensitive information. | env-Web |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c31s2i1 | Negative | Cookie only contains a random session ID (e.g. ASPSESSIONID, JSESSIONID, etc.) | env-Web | | c31s2i2 | Positive | Cookie contains sensitive information (e.g. "ACCTNO=0234234", or "DBIP=0xaf112a22" -- database server's IP address). | env-Web | | c31s2i3 | Inconclusive | Cookie's contents cannot be deciphered. | env-Web |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c31s2o1 | Success | Cookie contains sensitive information that developer did not intent the end user to see. | | c31s2o2 | Failure | Cookie does not contain any sensitive information. |
|
Security Control |
|---|
| ID | Type | Description |
|---|
| c31s2sc1 | Preventative | Do not store sensitive information in cookies unless they are encrypted such that only the server can decrypt them. |
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 |
|---|
| Description | Environments |
|---|
| Modify logical parts of cookie and send it back to server to observe the effects. | env-Web | | Modify numeric parts of cookie arithmetically and send it back to server to observe the effects. | env-Web | | Modify cookie bitwise and send it back to server to observe the effects. | env-Web | | 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 |
|---|
| ID | Type | Description |
|---|
| c31s3o1 | Success | Subversion of security controls on server | | c31s3o2 | Failure | Cookie reset by server |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c31s3sc1 | Detective | Web server logs contain many messages indicating that invalid cookies were received from client. | | c31s3sc2 | Preventative | 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 |
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 Skill or Knowledge Required |
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
| | Context Description | One of the biggest challenges in distributed systems is communicating state between the client and server. A variety of schemes have been used, the de facto standard in web application is HTTP cookies. Because these cookies tie together a client and a server through a session, they are useful to system designers and attackers. Because cookies contain remote generated content they can also contain attack payloads. Cookies may contain a variety of data that servers use to enforce security policy, including session ID, cookie issuer, cookie issuance timestamp, session timeout, subject IP address, and MAC, however the HTTP server should not assume that the session cookie variables are invulnerable. They may be overwritten by the client and/or intermediaries. Cookies, like "hidden" HTML form fields, are generally assumed by developers to be invisible from a client standpoint, but in fact they are a target. From a privacy standpoint, cookies leave a digital audit trail that can violate a digital subject's privacy, cookies may persist personal information on hard drives, in browser cache, log files, proxy servers, and other intermediaries. “Because HTTP is a stateless protocol, cookies (small files that are stored in a client browser) were invented, mostly to preserve state. Poor design of cookie handling systems leaves both clients and HTTP daemons susceptible to buffer overflow attack." [Hoglund and McGraw 04]
| | 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
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 565 | Use of Cookies in Security Decision | Targeted | | 302 | Authentication Bypass by Assumed-Immutable Data | Targeted | | 113 | Failure to Sanitize CRLF Sequences in HTTP Headers (aka 'HTTP Response Splitting') | Targeted | | 539 | Information Leak Through Persistent Cookies | Targeted | | 20 | Insufficient Input Validation | Targeted | | 315 | Plaintext Storage in a Cookie | Targeted | | 384 | Session Fixation | Targeted | | 472 | External Control of Assumed-Immutable Web Parameter | Secondary |
| | Purpose | Exploitation | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | Low |
| | 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.
| | 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 and Description | | 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: Standard 1 | | Typical Severity | High | | Description | Summary In applications, particularly web applications, access to functionality is mitigated by the authorization framework, whose job it is to map ACLs to elements of the application's functionality; particularly URL's for web apps. In the case that the application deployer failed to specify an ACL for a particular element, an attacker may be able to access it with impunity. An attacker with the ability to access functionality not properly constrained by ACLs can obtain sensitive information and possibly compromise the entire application. Such an attacker can access resources that must be available only to users at a higher privilege level, can access management sections of the application or can run queries for data that he is otherwise not supposed to. Attack Execution Flow Explore Survey: The attacker surveys the target application, possibly as a valid and authenticated user |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Spidering web sites for all available links | env-Web | | Brute force guessing of resource names | env-All | | Brute force guessing of user names / credentials | env-All | | Brute force guessing of function names / actions | env-All |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c1s1i1 | Positive | ACLs or other access control mechanisms are present in the software | env-Web env-ClientServer | | c1s1i2 | Positive | User IDs or other credentials are present in the software | env-Web env-ClientServer | | c1s1i3 | Positive | Operating modes with different privileges are present in the software | env-ClientServer env-Local env-Embedded |
Identify Functionality: At each step, the attacker notes the resource or functionality access mechanism invoked upon performing specific actions |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Use the web inventory of all forms and inputs and apply attack data to those inputs. | env-Web | | Use a packet sniffer to capture and record network traffic | env-CommProtocol | | Execute the software in a debugger and record API calls into the operating system or important libraries. This might occur in an environment other than a production environment, in order to find weaknesses that can be exploited in a production environment. | env-Local env-Embedded |
|
Outcome |
|---|
| ID | Type | Description |
|---|
| c1s2o1 | Success | The attacker produces a list of functionality or data that can be accessed through the system. |
Experiment Iterate over access capabilities: Possibly as a valid user, the attacker then tries to access each of the noted access mechanisms directly in order to perform functions not constrained by the ACLs. |
Attack Step Technique |
|---|
| Description | Environments |
|---|
| Fuzzing of API parameters (URL parameters, OS API parameters, protocol parameters) | env-Web env-Local env-Embedded env-ClientServer |
|
Indicator of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c1s3i1 | Negative | Attempts to create a catalog of access mechanisms and data have failed. | env-All |
|
Outcome |
|---|
| ID | Type | Description |
|---|
| c1s3o1 | Success | Functionality is accessible to unauthorized users. |
| | Attack Prerequisites | The application must be navigable in a manner that associates elements (subsections) of the application with ACLs. The various resources, or individual URLs, must be somehow discoverable by the attacker The deployer must have forgotten to associate an ACL or has associated an inappropriately permissive ACL with a particular navigable resource. | | Typical Likelihood of Exploit |
Very High
| | Methods of Attack | | | Examples-Instances | Description Implementing the Model-View-Controller (MVC) within Java EE's Servlet paradigm using a "Single front controller" pattern that demands that brokered HTTP requests be authenticated before hand-offs to other Action Servlets. If no security-constraint is placed on those Action Servlets, such that positively no one can access them, the front controller can be subverted.
| | Attacker Skill or Knowledge Required | Low: In order to discover unrestricted resources, the attacker does not need special tools or skills. He only has to observe the resources or access mechanisms invoked as each action is performed and then try and access those access mechanisms directly. | | Resources Required | No special resources are required for the exploit of this pattern. | | Probing Techniques | In the case of web applications, use of a spider or other crawling software can allow an attacker to search for accessible pages not beholden to a security constraint. More generally, noting the target resource accessed upon performing specific actions drives an understanding of the resources accessible from the current context. | | Solutions and Mitigations | In a J2EE setting, deployers can associate a role that is impossible for the authenticator to grant users, such as "NoAccess", with all Servlets to which access is guarded by a limited number of servlets visible to, and accessible by, the user..
Having done so, any direct access to those protected Servlets will be prohibited by the web container.
In a more general setting, the deployer must mark every resource besides the ones supposed to be exposed to the user as accessible by a role impossible for the user to assume. The default security setting must be to deny access and then grant access only to those resources intended by business logic.
| | Attack Motivation-Consequences | | | Context Description | The context of this pattern's applicability is most likely a web-based application, subject to an authorization framework. | | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 285 | Missing or Inconsistent Access Control | Targeted | | 276 | Insecure Default Permissions | Targeted |
| | Relevant Security Requirements | All resources must be constrained to be inaccessible by default followed by selectively allowing access to resources as dictated by application and business logic In addition to a central controller, every resource must also restrict, wherever possible, incoming accesses as dictated by the relevant ACL. | | Related Security Principles | - Failing Securely
- Least Privilege
- Reluctance To Trust
- Complete Mediation
| | Related Guidelines | - Use Authorization Mechanisms Correctly
- Design Configuration Subsystems Correctly and Distribute Safe Default Configurations
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | Medium | Low |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| John Steven | Cigital, Inc | 2007-02-10 | Initial core pattern content |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Chiradeep B. Chhaya | Cigital, Inc | 2007-02-23 | Fleshed out pattern with extra content | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Attack Execution Flow, Attack Prerequisites, Examples and Solutions | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback | | Paco Hope | Cigital, Inc. | 2007-10-20 | Added extended Attack Execution Flow |
|
| 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: Standard 6 | | Typical Severity | High | | Description | Summary An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be directly or indirectly applied as arguments, for example as shell commands. This may allow an attacker access to files, network resources, media, and in short anything accessible through the shell.
The argument injection attack uses the exposed service or method as a launch pad to invoke other programs. If the service does not validate or filter the input data then the client program is granted access to execute commands using the server's privileges. The OS commands can be appended to standard input for shell programs, HTTP Requests, and XML messages. The ability to invoke commands is not necessarily sufficient for the attacker to collect the output of the attack. This may or may not be an issue depending on the attacker goal.
| | Attack Prerequisites | Target software fails to strip all user-supplied input of any content that could cause the shell to perform unexpected actions.
Software must allow for unvalidated or unfiltered input to be executed on operating system shell, and, optionally, the system configuration must allow for output to be sent back to client.
| | Typical Likelihood of Exploit |
High
| | Methods of Attack | | | Examples-Instances | Description A recent example instance of argument injection occurred against Java Web Start technology, which eases the client side deployment for Java programs. The JNLP files that are used to describe the properties for the program. The client side Java runtime used the arguments in the property setting to define execution parameters, but if the attacker appends commands to an otherwise legitimate property file, then these commands are sent to the client command shell. Source http://www.securityfocus.com/archive/1/393696 | | Attacker Skill or Knowledge Required |
Medium → The attacker has to identify injection vector, identify the operating system-specific commands, and optionally collect the output.
| | Resources Required |
Ability to communicate synchronously or asynchronously with server. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.
| | Solutions and Mitigations |
Design: Do not program input values directly on command shell, instead treat user input as guilty until proven innocent. Build a function that takes user input and converts it to applications specific types and values, stripping or filtering out all unauthorized commands and characters in the process.
Design: Limit program privileges, so if metacharcters or other methods circumvent program input validation routines and shell access is attained then it is not running under a privileged account. chroot jails create a sandbox for the application to execute in, making it more difficult for an attacker to elevate privilege even in the case that a compromise has occurred.
Implementation: Implement an audit log that is written to a separate host, in the event of a compromise the audit log may be able to provide evidence and details of the compromise.
| | Attack Motivation-Consequences | - Privilege Escalation
- Data Modification
- Information Leakage
| | Context Description | “Attack Pattern: Argument Injection "User input is directly pasted into the argument of a shell command. A number of third-party programs allow passthrough to a shell with little or no filtering." [Hoglund and McGraw 04]
| | Injection Vector |
Malicious input delivered through standard input, the attacker inserts additional arguments on the application's standard interface
| | Payload |
Varies with instantiation of attack pattern. Malicious payload either pass commands through valid paramters or supply metacharacters that cause unexpected termination that redirects to shell
| | Activation Zone |
Client machine and client network (e..g Intranet)
| | Payload Activation Impact |
Enables attacker to execute server side code with any commands that the program owner has privileges to, this is particularly problematic when the sprogram is run as a system or privileged account.
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 77 | Failure to Sanitize Data into a Control Plane (aka 'Command Injection') | Targeted | | 146 | Failure to Sanitize Expression/Command Delimiters | Targeted | | 184 | Incomplete Blacklist | Targeted | | 78 | Failure to Sanitize Data into an OS Command (aka 'OS Command Injection') | Targeted | | 185 | Regular Expression Error | Targeted |
| | Related Guidelines | - Never Use Input as Part of a Directive to any Internal Component
| | Purpose | Penetration | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| Low | High | Low |
| | 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 Attack Prerequisites and Related Guidelines | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|
| 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: Standard 96 | | Typical Severity | Medium | | Description | Summary An application typically makes calls to functions that are a part of libraries external to the application. These libraries may be part of the operating system or they may be third party libraries. It is possible that the application does not handle situations properly where access to these libraries has been blocked. Depending on the error handling within the application, blocked access to libraries may leave the system in an insecure state that could be leveraged by an attacker.
Attack Execution Flow
Determine what external libraries the application accesses.
Block access to the external libraries accessed by the application.
Monitor the behavior of the system to see if it goes into an insecure/inconsistent state.
If the system does go into an insecure/inconsistent state, leverage that to obtain information about the system functionality or data, elevate access control, etc. The rest of this attack will depend on the context and the desired goal.
| | Attack Prerequisites |
An application requires access to external libraries.
An attacker has the priviliges to block application access to external libraries.
| | Typical Likelihood of Exploit |
Medium
| | Methods of Attack | - API Abuse
- Modification of Resources
| | Examples-Instances | Description A web-based system uses a third party cryptographic random number generation library that derives entropy from machine's hardware. This library is used in generation of user session ids used by the applicatoin. If the library is inaccessible, the application instead uses a software based weak pseudo random number generation library. An attacker of the system blocks access of the application to the third party cryptographic random number generation library (by renaming it). The application in turn uses the weak pseudo random number generation library to generate session ids that are predictable. An attacker then leverages this weakness to guess a session id of another user to perform a horizontal elevation of privilege escalation and gain access to another user's account.
| | Attacker Skill or Knowledge Required |
Low
| | Solutions and Mitigations |
Ensure that application handles situations where access to APIs in external libraries is not available securely. If the application cannot continue its execution safely it should fail in a consistent and secure fashion.
| | Attack Motivation-Consequences | - Denial of Service
- Information Leakage
- Privilege Escalation
| | Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 589 | Call to Non-ubiquitous API | Targeted | | 227 | Failure to Fulfill API Contract (aka 'API Abuse') | Targeted |
| | Related Security Principles | | | Purpose | Exploitation | | CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| Low | Low | High |
| | Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| All | All | All | All |
| | Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| Sean Barnum | Cigital, Inc. | 2007-03-25 | Identified priority for pattern creation |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Evgeny Lebanidze | Cigital, Inc., | 2007-03-21 | Fleshed out content for pattern | | Sean Barnum | Cigital, Inc | 2007-04-16 | Review and revise |
|
| 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') | |
|
|