<?xml version="1.0" encoding="UTF-8"?>

        <Weakness_Catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://cwe.mitre.org/data/xsd/cwe_schema_v3.0.xsd" Catalog_Version="0.9" Catalog_Name="CWE-677: Weakness Base Elements ">
	<Views/>
	<Categories/>
	<Weaknesses>
                    <Weakness Weakness_ID="111" Weakness_Name="Direct Use of Unsafe JNI" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>When a Java application uses the Java Native Interface (JNI) to call code written in
				another programming language, it can expose the application to weaknesses in that code, even if
				those weaknesses cannot occur in Java.</Description_Summary>
			</Description>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following code defines a class named Echo. The class declares one native method
						(defined below), which uses C to echo commands entered on the console back to the user.
						class Echo { public native void runEcho(); static { System.loadLibrary("echo"); } public
						static void main(String[] args) { new Echo().runEcho(); } } The following C code defines
						the native method implemented in the Echo class: </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>Java</Code_Example_Language>
							<Code_Block><![CDATA[#include <jni.h>
					#inc]]><![CDATA[lude "Echo.h"//the java class ab]]><![CDATA[ove compiled with javah
					#in]]><![CDATA[clude <stdio.h>
					
					JNIEX]]><![CDATA[PORT void JNICALL 
					Java_Ech]]><![CDATA[o_runEcho(JNIEnv *env, jobject o]]><![CDATA[bj) 
					{
					  char buf[64];]]><![CDATA[ 
					  gets(buf);
					  print]]><![CDATA[f(buf);
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText> Because the example is implemented in Java, it may appear that it is immune to
						memory issues like buffer overflow vulnerabilities. Although Java does do a good job of
						making memory operations safe, this protection does not extend to vulnerabilities
						occurring in source code written in other languages that are accessed using the Java
						Native Interface. Despite the memory protections offered in Java, the C code in this
						example is vulnerable to a buffer overflow because it makes use of gets(), which does not
						perform any bounds checking on its input. The Sun Java(TM) Tutorial provides the following
						description of JNI [See Reference]: The JNI framework lets your native method utilize Java
						objects in the same way that Java code uses these objects. A native method can create Java
						objects, including arrays and strings, and then inspect and use these objects to perform
						its tasks. A native method can also inspect and use objects created by Java application
						code. A native method can even update Java objects that it created or that were passed to
						it, and these updated objects are available to the Java application. Thus, both the native
						language side and the Java side of an application can create, update, and access Java
						objects and then share these objects between them. The vulnerability in the example above
						could easily be detected through a source code audit of the native method implementation.
						This may not be practical or possible depending on the availability of the C source code
						and the way the project is built, but in many cases it may suffice. However, the ability
						to share objects between Java and native methods expands the potential risk to much more
						insidious cases where improper data handling in Java may lead to unexpected
						vulnerabilities in native code or unsafe operations in native code corrupt data structures
						in Java. Vulnerabilities in native code accessed through a Java application are typically
						exploited in the same manner as they are in applications written in the native language.
						The only challenge to such an attack is for the attacker to identify that the Java
						application uses native code to perform certain operations. This can be accomplished in a
						variety of ways, including identifying specific behaviors that are often implemented with
						native code or by exploiting a system information leak in the Java application that
						exposes its use of JNI [See Reference]. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>Native code is unprotected by the security features enforced by the runtime
				environment, such as strong typing and array bounds checking. Many safety features that
				programmers may take for granted simply do not apply for native code, so you must carefully review
				all such code for potential problems. Other programming languages that may be more susceptible to
				buffer overflows and other attacks, such as C or C++, usually implement native code.
				Language-based encapsulation is broken.</Context_Notes>
			<References>
				<Reference>
					<Reference_Author>Fortify Software</Reference_Author>
					<Reference_Title>Fortify Descriptions</Reference_Title>
					<Reference_Link>http://vulncat.fortifysoftware.com</Reference_Link>
				</Reference>
				<Reference>
					<Reference_Author>B. Stearns</Reference_Author>
					<Reference_Title>The Java™ Tutorial: The Java Native Interface</Reference_Title>
					<Reference_Publisher>Sun Microsystems</Reference_Publisher>
					<Reference_PubDate>2005</Reference_PubDate>
					<Reference_Link>http://java.sun.com/docs/books/tutorial/native1.1/</Reference_Link>
				</Reference>
			</References>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>100</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Unsafe JNI</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>Java</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="112" Weakness_Name="Missing XML Validation" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Failure to enable validation when parsing XML gives an attacker the opportunity to supply
				malicious input.</Description_Summary>
			</Description>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Potential_Mitigations>
				<Mitigation>Always validate XML input against a known XML Schema or DTD.</Mitigation>
				<Mitigation>Assume all input is malicious. Use an appropriate combination of black lists and white
					lists to ensure only valid and expected input is processed by the system.</Mitigation>
			</Potential_Mitigations>
			<Context_Notes>Most successful attacks begin with a violation of the programmer's assumptions. By
				accepting an XML document without validating it against a DTD or XML schema, the programmer leaves
				a door open for attackers to provide unexpected, unreasonable, or malicious input. It is not
				possible for an XML parser to validate all aspects of a document's content; a parser cannot
				understand the complete semantics of the data. However, a parser can do a complete and thorough
				job of checking the document's structure and therefore guarantee to the code that processes the
				document that the content is well-formed.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>20</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Missing XML Validation</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>99<!--XML Parser Attack--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="113" Weakness_Name="Failure to Sanitize CRLF Sequences in HTTP Headers (aka 'HTTP Response Splitting')" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software fails to adequately filter HTTP headers for CR and LF characters. Including unvalidated data in an HTTP header allows an attacker to specify the
				entirety of the HTTP response rendered by the browser. When an HTTP request contains unexpected CR and LF characters the server may respond
				with an output stream that is interpreted as two different HTTP responses (instead of
				one). An attacker can control the second response and mount attacks such as cross-site
				scripting and cache poisoning attacks.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Construct HTTP headers very carefully, avoiding the use of non-validated input data.</Mitigation>
				<Mitigation>Assume all input is malicious. Use an appropriate combination of black lists and white
					lists to ensure only valid and expected input is processed by the system. Input (specifically,
					unexpected CRLFs) that is not appropriate should not be processed into HTTP
				headers.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText> The following code segment reads the name of the author of a weblog entry, author,
						from an HTTP request and sets it in a cookie header of an HTTP response.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[St]]><![CDATA[ring author = request.getParamet]]><![CDATA[er(AUTHOR_PARAM); 
					...
				]]><![CDATA[	Cookie cookie = new Cookie("aut]]><![CDATA[hor", author); 
					cookie.setM]]><![CDATA[axAge(cookieExpiration);
					re]]><![CDATA[sponse.addCookie(cookie);]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText> Assuming a string consisting of standard alpha-numeric characters, such as "Jane
						Smith", is submitted in the request the HTTP response including this cookie might take the
						following form: HTTP/1.1 200 OK ... Set-Cookie: author=Jane Smith ... However, because the
						value of the cookie is formed of unvalidated user input the response will only maintain
						this form if the value submitted for AUTHOR_PARAM does not contain any CR and LF
						characters. If an attacker submits a malicious string, such as "Wiley Hacker\r\nHTTP/1.1
						200 OK\r\n...", then the HTTP response would be split into two responses of the following
						form: HTTP/1.1 200 OK ... Set-Cookie: author=Wiley Hacker HTTP/1.1 200 OK ... Clearly, the
						second response is completely controlled by the attacker and can be constructed with any
						header and body content desired. The ability of attacker to construct arbitrary HTTP
						responses permits a variety of resulting attacks, including: cross-user defacement, web
						and browser cache poisoning, cross-site scripting and page hijacking. Others examples:
						Cross-User Defacement: An attacker can make a single request to a vulnerable server that
						will cause the sever to create two responses, the second of which may be misinterpreted as
						a response to a different request, possibly one made by another user sharing the same TCP
						connection with the sever. This can be accomplished by convincing the user to submit the
						malicious request themselves, or remotely in situations where the attacker and the user
						share a common TCP connection to the server, such as a shared proxy server. In the best
						case, an attacker can leverage this ability to convince users that the application has
						been hacked, causing users to lose confidence in the security of the application. In the
						worst case, an attacker may provide specially crafted content designed to mimic the
						behavior of the application but redirect private information, such as account numbers and
						passwords, back to the attacker. Cache Poisoning: The impact of a maliciously constructed
						response can be magnified if it is cached either by a web cache used by multiple users or
						even the browser cache of a single user. If a response is cached in a shared web cache,
						such as those commonly found in proxy servers, then all users of that cache will continue
						receive the malicious content until the cache entry is purged. Similarly, if the response
						is cached in the browser of an individual user, then that user will continue to receive
						the malicious content until the cache entry is purged, although the user of the local
						browser instance will be affected. Cross-Site Scripting: Once attackers have control of
						the responses sent by an application, they have a choice of a variety of malicious content
						to provide users. Cross-site scripting is common form of attack where malicious JavaScript
						or other code included in a response is executed in the user's browser. The variety of
						attacks based on XSS is almost limitless, but they commonly include transmitting private
						data like cookies or other session information to the attacker, redirecting the victim to
						web content controlled by the attacker, or performing other malicious operations on the
						user's machine under the guise of the vulnerable site. The most common and dangerous
						attack vector against users of a vulnerable application uses JavaScript to transmit
						session and authentication information back to the attacker who can then take complete
						control of the victim's account. Page Hijacking: In addition to using a vulnerable
						application to send malicious content to a user, the same root vulnerability can also be
						leveraged to redirect sensitive content generated by the server and intended for the user
						to the attacker instead. By submitting a request that results in two responses, the
						intended response from the server and the response generated by the attacker, an attacker
						can cause an intermediate node, such as a shared proxy server, to misdirect a response
						generated by the server for the user to the attacker. Because the request made by the
						attacker generates two responses, the first is interpreted as a response to the attacker's
						request, while the second remains in limbo. When the user makes a legitimate request
						through the same TCP connection, the attacker's request is already waiting and is
						interpreted as a response to the victim's request. The attacker then sends a second
						request to the server, to which the proxy server responds with the server generated
						request intended for the victim, thereby compromising any sensitive information in the
						headers or body of the response intended for the victim. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-1951</Observed_Example_Reference>
					<Observed_Example_Description>Application accepts CRLF in an object ID, allowing HTTP response splitting.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2146</Observed_Example_Reference>
					<Observed_Example_Description>Application accepts CRLF in an object ID, allowing HTTP response splitting.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1620</Observed_Example_Reference>
					<Observed_Example_Description>HTTP response splitting via CRLF in parameter related to URL.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1656</Observed_Example_Reference>
					<Observed_Example_Description>HTTP response splitting via CRLF in parameter related to URL.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1687</Observed_Example_Reference>
					<Observed_Example_Description>HTTP response splitting via CRLF in parameter related to URL.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-2060</Observed_Example_Reference>
					<Observed_Example_Description>Bulletin board allows response splitting via CRLF in parameter.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-2065</Observed_Example_Reference>
					<Observed_Example_Description>Bulletin board allows response splitting via CRLF in parameter.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2512</Observed_Example_Reference>
					<Observed_Example_Description>Response splitting via CRLF in PHPSESSID.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-1951</Observed_Example_Reference>
					<Observed_Example_Description>Chain: Application accepts CRLF in an object ID,
						allowing HTTP response splitting.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1687</Observed_Example_Reference>
					<Observed_Example_Description>Chain: HTTP response splitting via CRLF in parameter
						related to URL.</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>HTTP response splitting vulnerabilities occur when: 1. Data enters a web application
				through an untrusted source, most frequently an HTTP request. 2. The data is included in an HTTP
				response header sent to a web user without being validated for malicious characters. As with many
				software security vulnerabilities, HTTP response splitting is a means to an end, not an end in
				itself. At its root, the vulnerability is straightforward: an attacker passes malicious data to a
				vulnerable application, and the application includes the data in an HTTP response header. To mount
				a successful exploit, the application must allow input that contains CR (carriage return, also
				given by %0d or \r) and LF (line feed, also given by %0a or \n)characters into the header. These
				characters not only give attackers control of the remaining headers and body of the response the
				application intends to send, but also allows them to create additional responses entirely under
				their control. </Context_Notes>
			<Context_Notes>Note that HTTP response splitting is probably only multi-factor in an environment that
				uses intermediaries.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>93</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanPrecede</Relationship_Nature>
					<Relationship_Target_ID>79</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>442</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>HTTP response splitting</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>HTTP Response Splitting</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
	
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>63<!--Simple Script Injection--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>31<!--Accessing/Intercepting/Modifying HTTP Cookies--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>85<!--Client Network Footprinting (using AJAX/XSS)--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>34<!--HTTP Response Splitting--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="114" Weakness_Name="Process Control" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>Executing commands or loading libraries from an untrusted source or in an untrusted
				environment can cause an application to execute malicious commands (and payloads) on behalf of an
				attacker.</Description_Summary>
			</Description>
			<Affected_Resource>System Process</Affected_Resource>
			<Potential_Mitigations>
				<Mitigation>Libraries that are loaded should be well understood and come from a trusted source.
					The application can execute code contained in the native libraries, which often contain calls
					that are susceptible to other security problems, such as buffer overflows or command
					injection. All native libraries should be validated to determine if the application requires
					the use of the library. It is very difficult to determine what these native libraries actually
					do, and the potential for malicious code is high. In addition, the potential for an
					inadvertent mistake in these native libraries is also high, as many are written in C or C++
					and may be susceptible to buffer overflow or race condition problems. To help prevent buffer
					overflow attacks, validate all input to native calls for content and length. If the native
					library does not come from a trusted source, review the source code of the library. The
					library should be built from the reviewed source before using it.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following code uses System.loadLibrary() to load code from a native library named
						library.dll, which is normally found in a standard system directory. </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[...
					System.loadLibrary]]><![CDATA[("library.dll");
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The problem here is that System.loadLibrary() accepts a library name, not a path,
						for the library to be loaded. From the Java 1.4.2 API documentation this function behaves
						as follows [1]: A file containing native code is loaded from the local file system from a
						place where library files are conventionally obtained. The details of this process are
						implementation-dependent. The mapping from a library name to a specific filename is done
						in a system-specific manner. If an attacker is able to place a malicious copy of
						library.dll higher in the search order than file the application intends to load, then the
						application will load the malicious copy instead of the intended file. Because of the
						nature of the application, it runs with elevated privileges, which means the contents of
						the attacker's library.dll will now be run with elevated privileges, possibly giving them
						complete control of the system. </PostText>
				</Example_Code>
				<Example_Code>
					<PreText>The following code from a privileged application uses a registry entry to determine
						the directory in which it is installed and loads a library file based on a relative path
						from the specified directory. </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[...
				]]><![CDATA[	RegQueryValueEx(hkey, "APPHOME"]]><![CDATA[,
					0, 0, (BYTE*)home, &size)]]><![CDATA[;	
					char* lib=(char*)malloc(]]><![CDATA[strlen(home)+strlen(INITLIB));
	]]><![CDATA[				if (lib) { 
					  strcpy(li]]><![CDATA[b,home);
					  strcat(lib,INITC]]><![CDATA[MD);
					  LoadLibrary(lib);
		]]><![CDATA[			}
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The code in this example allows an attacker to load an arbitrary library, from which
						code will be executed with the elevated privilege of the application, by modifying a
						registry key to specify a different path containing a malicious version of INITLIB.
						Because the program does not validate the value read from the environment, if an attacker
						can control the value of APPHOME, they can fool the application into running malicious
						code. </PostText>
				</Example_Code>
				<Example_Code>
					<PreText>The following code is from a web-based administration utility that allows users
						access to an interface through which they can update their profile on the system. The
						utility makes use of a library named =;liberty.dll, which is normally found in a standard
						system directory. </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[Load]]><![CDATA[Library("liberty.dll");]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The problem is that the program does not specify an absolute path for liberty.dll.
						If an attacker is able to place a malicious library named liberty.dll higher in the search
						order than file the application intends to load, then the application will load the
						malicious copy instead of the intended file. Because of the nature of the application, it
						runs with elevated privileges, which means the contents of the attacker's liberty.dll will
						now be run with elevated privileges, possibly giving the attacker complete control of the
						system. The type of attack seen in this example is made possible because of the search
						order used by LoadLibrary() when an absolute path is not specified. If the current
						directory is searched before system directories, as was the case up until the most recent
						versions of Windows, then this type of attack becomes trivial if the attacker can execute
						the program locally. The search order is operating system version dependent, and is
						controlled on newer operating systems by the value of the registry key:
						HKLM\System\CurrentControlSet\Control\Session Manager\SafeDllSearchMode </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>Process control vulnerabilities take two forms: - An attacker can change the command
				that the program executes: the attacker explicitly controls what the command is. - An attacker can
				change the environment in which the command executes: the attacker implicitly controls what the
				command means. We will first consider the first scenario, the possibility that an attacker may be
				able to control the command that is executed. Process control vulnerabilities of this type occur
				when: - Data enters the application from an untrusted source. - The data is used as or as part of
				a string representing a command that is executed by the application. - By executing the command,
				the application gives an attacker a privilege or capability that the attacker would not otherwise
				have. </Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>20</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">631</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>634</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Process Control</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="115" Weakness_Name="Misinterpretation of Input" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software misinterprets an input, whether from an attacker or another product, in a
				security-relevant fashion.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation/>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-2225</Observed_Example_Reference>
					<Observed_Example_Description>Product sees dangerous file extension in free text of a group discussion, disconnects
						all users.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0003</Observed_Example_Reference>
					<Observed_Example_Description>Product does not correctly import and process security settings from another product.</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Research_Gaps>This concept needs further study. It is likely a factor in several weaknesses, possibly
				resultant as well. Overlaps Multiple Interpretation Errors
	 (MIE).</Research_Gaps>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>20</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanAlsoBe</Relationship_Nature>
					<Relationship_Target_ID>436</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Misinterpretation Error</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="117" Weakness_Name="Incorrect Output Sanitization for Logs" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Writing unsanitized user input into log files can allow an attacker to forge log entries
				or inject malicious content into logs.</Description_Summary>
			</Description>
			<Likelihood_of_Exploit>Medium</Likelihood_of_Exploit>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Potential_Mitigations>
				<Mitigation>Assume all input is malicious. Use an appropriate combination of black lists
					and white lists to ensure only valid, expected and appropriate data is written to log files.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText> The following web application code attempts to read an integer value from a request
						object. If the value fails to parse as an integer, then the input is logged with an error
						message indicating what happened.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[... 
					St]]><![CDATA[ring val = request.getParameter(]]><![CDATA["val"); 
					  try { 
					    ]]><![CDATA[int value = Integer.parseInt(val]]><![CDATA[);
					  } 
					  catch (Numbe]]><![CDATA[rFormatException) {
					    log]]><![CDATA[.info("Failed to parse val = " +]]><![CDATA[ val); 
					  } 
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>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.</PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2006-4624</Observed_Example_Reference>
					<Observed_Example_Description>Chain: inject fake log entries with fake timestamps using
						CRLF injection</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>Log forging vulnerabilities occur when: 1. Data enters an application from an untrusted
				source. 2. The data is written to an application or system log file. Applications typically use
				log files to store a history of events or transactions for later review, statistics gathering, or
				debugging. Depending on the nature of the application, the task of reviewing log files may be
				performed manually on an as-needed basis or automated with a tool that automatically culls logs
				for important events or trending information. Interpretation of the log files may be hindered or
				misdirected if an attacker can supply data to the application that is subsequently logged
				verbatim. In the most benign case, an attacker may be able to insert false entries into the log
				file by providing the application with input that includes appropriate characters. If the log file
				is processed automatically, the attacker can render the file unusable by corrupting the format of
				the file or injecting unexpected characters. A more subtle attack might involve skewing the log
				file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's
				tracks or even to implicate another party in the commission of a malicious act [22]. In the worst
				case, an attacker may inject code or other commands into the log file and take advantage of a
				vulnerability in the log processing utility [17].</Context_Notes>
			<References>
				<Reference Reference_ID="17">
					<Reference_Author>G. Hoglund</Reference_Author>
					<Reference_Author>G. McGraw</Reference_Author>
					<Reference_Title>Exploiting Software: How to Break Code</Reference_Title>
					<Reference_Publisher>Addison-Wesley</Reference_Publisher>
					<Reference_PubDate>February 2004</Reference_PubDate>
				</Reference>
				<Reference Reference_ID="22">
					<Reference_Author>A. Muffet</Reference_Author>
					<Reference_Title>The night the log was forged</Reference_Title>
					<Reference_Link>http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm</Reference_Link>
				</Reference>
			</References>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>116</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Log Forging</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
	
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>81<!--Web Logs Tampering--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>93<!--Log Injection-Tampering-Forging--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="123" Weakness_Name="Write-what-where Condition" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Any condition where the attacker has the ability to write an arbitrary value to an
				arbitrary location, often as the result of a buffer overflow.</Description_Summary>
			</Description>
			<Likelihood_of_Exploit>High</Likelihood_of_Exploit>
			<Weakness_Ordinality>Resultant (Weakness is typically related to the presence of some other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Common_Consequences>
				<Common_Consequence>Access control (memory and instruction processing): Clearly, write-what-where
					conditions can be used to write data to areas of memory outside the scope of a policy. Also,
					they almost invariably can be used to execute arbitrary code, which is usually outside the
					scope of a program's implicit security policy.</Common_Consequence>
				<Common_Consequence>Availability: Many memory accesses can lead to program termination, such as
					when writing to addresses that are invalid for the current process.</Common_Consequence>
				<Common_Consequence>Other: When the consequence is arbitrary code execution, this can often be
					used to subvert any other security service.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Pre-design: Use a language that provides appropriate memory abstractions.</Mitigation>
				<Mitigation>Design: Integrate technologies that try to prevent the consequences of this problem.</Mitigation>
				<Mitigation>Implementation: Take note of mitigations provided for other flaws in this taxonomy
					that lead to write-what-where conditions.</Mitigation>
				<Mitigation>Operational: Use OS-level preventative functionality integrated after the fact. Not a
					complete solution.</Mitigation>
			</Potential_Mitigations>
			<Context_Notes>When the attacker has the ability to write arbitrary data to an arbitrary location in
				memory, the consequences are often arbitrary code execution. If the attacker can overwrite a
				pointer's worth of memory (usually 32 or 64 bits), he can redirect a function pointer to his own
				malicious code. Even when the attacker can only modify a single byte using a write-what-where
				problem, arbitrary code execution can be possible. Sometimes this is because the same problem can
				be exploited repeatedly to the same effect. Other times it is because the attacker can overwrite
				security-critical application-specific data -- such as a flag indicating whether the user is an
				administrator.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>134</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Write-what-where condition</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="124" Weakness_Name="Boundary Beginning Violation ('Buffer Underwrite')" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software allows a condition where buffers are written to using buffer access mechanisms such as indexes or pointers that reference memory locations prior to the targeted buffer. This typically occurs when indexes are negative numbers or when pointer arithmetic results in a position before the beginning of the valid memory location. This can occur when a negative number is used as an offset, or if the pointer or its index is decremented to a position before the buffer.</Description_Summary>
			</Description>
			<Alternate_Terms>Some prominent vendors and researchers use the term "buffer underrun". "Buffer
				underflow" is more commonly used, although both terms are also sometimes used to describe a buffer
				under-read (CWE-127).</Alternate_Terms>
			<Likelihood_of_Exploit>Medium</Likelihood_of_Exploit>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Common_Consequences>
				<Common_Consequence>Availability: Buffer underwrites will very likely result in the corruption of
					relevant memory, and perhaps instructions, leading to a crash.</Common_Consequence>
				<Common_Consequence>Access Control (memory and instruction processing): If the corrupted memory
					can be effectively controlled, it may be possible to execute arbitrary code. If the corrupted
					memory is data rather than instructions, the system will continue to function with improper
					changes, possibly in violation of an implicit or explicit policy. The consequences would only
					be limited by how the affected data is used, such as an adjacent memory location that is used
					to specify whether the user has special privileges.</Common_Consequence>
				<Common_Consequence>Other: When the consequence is arbitrary code execution, this can often be
					used to subvert any other security service.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Requirements specification: The choice could be made to use a language that is not
					susceptible to these issues.</Mitigation>
				<Mitigation>Implementation: Sanity checks should be performed on all calculated values used as
					index or for pointer arithmetic.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following is an example of code that may result in a buffer underwrite, if find()
						returns a negative value to indicate that ch is not found in srcBuf:</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[int main() {
	]]><![CDATA[				  ...  
					  strncpy(destB]]><![CDATA[uf, &srcBuf[find(srcBuf, ch)], 1]]><![CDATA[024);
					  ...
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>If the index to srcBuf is somehow under user control, this is an arbitrary
						write-what-where condition.</PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-2227</Observed_Example_Reference>
					<Observed_Example_Description>Unchecked length of SSLv2 challenge value leads to buffer underflow.</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-2227</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2007-4580</Observed_Example_Reference>
					<Observed_Example_Description>Buffer underflow from a small size value with a large buffer (length parameter
						inconsistency, CWE-130)</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4580</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2007-1584</Observed_Example_Reference>
					<Observed_Example_Description>Buffer underflow from an all-whitespace string, which causes a counter to be
						decremented before the buffer while looking for a non-whitespace character.</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-1584</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2007-0886</Observed_Example_Reference>
					<Observed_Example_Description>Buffer underflow resultant from encoded data that triggers an integer overflow.</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0886</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2006-6171</Observed_Example_Reference>
					<Observed_Example_Description>Product sets an incorrect buffer size limit, leading to "off-by-two" buffer
						underflow.</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-6171</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2006-4024</Observed_Example_Reference>
					<Observed_Example_Description>Negative value is used in a memcpy() operation, leading to buffer underflow.</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-4024</Observed_Example_Link>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2620</Observed_Example_Reference>
					<Observed_Example_Description>Buffer underflow due to mishandled special characters</Observed_Example_Description>
					<Observed_Example_Link>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2620</Observed_Example_Link>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>This could be resultant from several errors, including a bad offset or an array index
				that decrements before the beginning of the buffer (see CWE-129).</Context_Notes>
			<Research_Gaps>Much attention has been paid to buffer overflows, but "underflows" sometimes exist in
				products that are relatively free of overflows, so it is likely that this variant has been
				under-studied.</Research_Gaps>
			<References>
				<Reference>
					<Reference_Title>Buffer UNDERFLOWS: What do you know about it?</Reference_Title>
					<Reference_Publication>Vuln-Dev Mailing List</Reference_Publication>
					<Reference_Date>2004-01-10</Reference_Date>
					<Reference_Link>http://seclists.org/vuln-dev/2004/Jan/0022.html</Reference_Link>
				</Reference>
			</References>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Compound_Element</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>120</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>129</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>UNDER - Boundary beginning violation ('buffer underflow'
				?)</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Buffer underwrite</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="125" Weakness_Name="Out-of-bounds Read" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software reads data past the end, or before the beginning, of the intended buffer.</Description_Summary>
			</Description>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0112</Observed_Example_Reference>
					<Observed_Example_Description>out-of-bounds read due to improper length check</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0183</Observed_Example_Reference>
					<Observed_Example_Description>packet with large number of specified elements cause out-of-bounds
					read.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0221</Observed_Example_Reference>
					<Observed_Example_Description>packet with large number of specified elements cause out-of-bounds
					read.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0184</Observed_Example_Reference>
					<Observed_Example_Description>out-of-bounds read, resultant from integer underflow</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1940</Observed_Example_Reference>
					<Observed_Example_Description>large length value causes out-of-bounds read</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0421</Observed_Example_Reference>
					<Observed_Example_Description>malformed image causes out-of-bounds read</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Research_Gaps>Under-studied and under-reported. Most issues are probably labeled as buffer overflows.</Research_Gaps>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Out-of-bounds Read</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="128" Weakness_Name="Wrap-around Error" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>Wrap around errors occur whenever a value is incremented past the maximum value for its
				type and therefore "wraps around" to a very small, negative, or undefined value.</Description_Summary>
			</Description>
			<Likelihood_of_Exploit>Medium</Likelihood_of_Exploit>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Common_Consequences>
				<Common_Consequence>Availability: Wrap-around errors generally lead to undefined behavior,
					infinite loops, and therefore crashes.</Common_Consequence>
				<Common_Consequence>Integrity: If the value in question is important to data (as opposed to flow),
					simple data corruption has occurred. Also, if the wrap around results in other conditions such
					as buffer overflows, further memory corruption may occur.</Common_Consequence>
				<Common_Consequence>Access control (instruction processing): A wrap around can sometimes trigger
					buffer overflows which can be used to execute arbitrary code. This is usually outside the
					scope of a program's implicit security policy.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Requirements specification: The choice could be made to use a language that is not
					susceptible to these issues.</Mitigation>
				<Mitigation>Design: Provide clear upper and lower bounds on the scale of any protocols designed.</Mitigation>
				<Mitigation>Implementation: Place sanity checks on all incremented variables to ensure that they
					remain within reasonable bounds.</Mitigation>
			</Potential_Mitigations>
			<Context_Notes>Due to how addition is performed by computers, if a primitive is incremented past the
				maximum value possible for its storage space, the system will fail to recognize this, and
				therefore increment each bit as if it still had extra space. Because of how negative numbers are
				represented in binary, primitives interpreted as signed may "wrap" to very large negative values.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>190</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Wrap-around error</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>92<!--Forced Integer Overflow--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="129" Weakness_Name="Unchecked Array Indexing" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Unchecked array indexing occurs when an unchecked value is used as an index
				into a buffer.</Description_Summary>
			</Description>
			<Alternate_Terms>"out-of-bounds array index" or "index-out-of-range" or "array index
				underflow"</Alternate_Terms>
			<Likelihood_of_Exploit>Medium</Likelihood_of_Exploit>
			<Weakness_Ordinality>Resultant (Weakness is typically related to the presence of some other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Affected_Resource>Memory</Affected_Resource>
			<Common_Consequences>
				<Common_Consequence>Availability: Unchecked array indexing will very likely result in
					the corruption of relevant memory and perhaps instructions, leading to a crash, if
					the values are outside of the valid memory area</Common_Consequence>
				<Common_Consequence>Integrity: If the memory corrupted is data, rather than
					instructions, the system will continue to function with improper values.</Common_Consequence>
				<Common_Consequence>Access Control: If the memory corrupted memory can be effectively
					controlled, it may be possible to execute arbitrary code, as with a standard buffer
					overflow.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Requirements specification: The choice could be made to use a language that
					is not susceptible to these issues.</Mitigation>
				<Mitigation>Implementation: Include sanity checks to ensure the validity of any values
					used as index variables. In loops, use greater-than-or-equal-to, or
					less-than-or-equal-to, as opposed to simply greater-than, or less-than compare
					statements.</Mitigation>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-0369</Observed_Example_Reference>
					<Observed_Example_Description>large ID in packet used as array index</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-1009</Observed_Example_Reference>
					<Observed_Example_Description>negative array index as argument to POP LIST command</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0721</Observed_Example_Reference>
					<Observed_Example_Description>Integer signedness error leads to negative array index</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1189</Observed_Example_Reference>
					<Observed_Example_Description>product does not properly track a count and a maximum number, which can
						lead to resultant array index overflow.</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>A single fault could allow both an overflow and underflow of the array index.</Context_Notes>
			<Context_Notes>An index overflow exploit might use buffer overflow techniques, but this can
				often be exploited without having to provide "large inputs."</Context_Notes>
			<Context_Notes>Array index overflows can also trigger out-of-bounds read operations, or
				operations on the wrong objects; i.e., "buffer overflows" are not always the result.</Context_Notes>
			<Context_Notes>Unchecked array indexing, depending on its instantiation, can be responsible
				for any number of related issues. Most prominent of these possible flaws is the buffer
				overflow condition. Due to this fact, consequences range from denial of service, and
				data corruption, to full blown arbitrary code execution. The most common condition
				situation leading to unchecked array indexing is the use of loop index variables as
				buffer indexes. If the end condition for the loop is subject to a flaw, the index can
				grow or shrink unbounded, therefore causing a buffer overflow or underflow. Another
				common situation leading to this condition is the use of a function's return value, or
				the resulting value of a calculation directly as an index in to a buffer.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">631</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>633</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Unchecked array indexing</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>INDEX - Array index overflow</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="130" Weakness_Name="Length Parameter Inconsistency" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software operates on user-controlled input (including length parameters) without
				validating that the length parameters match the actual length of the input data.
				If an attacker can manipulate the length parameter associated with an input such
				that it is inconsistent with the actual length of the input, this can be leveraged to cause the
				target application to behave in unexpected, and possibly, malicious ways.
				One of the possible motives for doing so is to pass in arbitrarily large input to the
				application. Another possible motivation is the modification of application state by including
				invalid data for subsequent properties of the application. Such weaknesses commonly lead to
				attacks such as buffer overflows and execution of arbitrary code.</Description_Summary>
			</Description>
			<Alternate_Terms>length manipulation, length tampering</Alternate_Terms>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Implicit (This is an implicit weakness)</Causal_Nature>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0825</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-1186</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0191</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0429</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0655</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0492</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0201</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0825</Observed_Example_Reference>
					<Observed_Example_Description>can overlap zero-length issues</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0095</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0826</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0808</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1357</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0774</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0940</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0989</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0568</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0327</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0345</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0430</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-0064</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0413</Observed_Example_Reference>
					<Observed_Example_Description>leads to memory consumption, integer overflow, and heap overflow</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0940</Observed_Example_Reference>
					<Observed_Example_Description>is effectively an accidental double increment of a counter that prevents a length
						check conditional from exiting a loop.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1235</Observed_Example_Reference>
					<Observed_Example_Description>length field of a request not verified</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-3184</Observed_Example_Reference>
					<Observed_Example_Description>buffer overflow by modifying a length value</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>SECUNIA:18747</Observed_Example_Reference>
					<Observed_Example_Description>length field inconsistency crashes cell phone</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>Probably overlaps other categories including zero-length issues</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>118</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Length Parameter Inconsistency</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>47<!--Buffer Overflow via Parameter Expansion--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="132" Weakness_Name="Miscalculated Null Termination" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Miscalculated null termination occurs when the placement of a null character at the end
				of a buffer of characters (or string) is misplaced or omitted.</Description_Summary>
			</Description>
			<Likelihood_of_Exploit>Medium</Likelihood_of_Exploit>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Explicit (This is an explicit weakness resulting from behavior of the developer)</Causal_Nature>
			<Common_Consequences>
				<Common_Consequence>Confidentiality: Information disclosure may occur if strings with misplaced or
					omitted null characters are printed.</Common_Consequence>
				<Common_Consequence>Availability: A randomly placed null character may put the system into an
					undefined state, and therefore make it prone to crashing.</Common_Consequence>
				<Common_Consequence>Integrity: A misplaced null character may corrupt other data in memory</Common_Consequence>
				<Common_Consequence>Access Control: Should the null character corrupt the process flow, or effect
					a flag controlling access, it may lead to logical errors which allow for the execution of
					arbitrary code.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Requirements specification: The choice could be made to use a language that is not
					susceptible to these issues.</Mitigation>
				<Mitigation>Implementation: Ensure that all string functions used are understood fully as to how
					they append null characters. Also, be wary of off-by-one errors when appending nulls to the
					end of strings.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>While the following example is not exploitable, it provides a good example of how
						nulls can be omitted or misplaced, even when "safe" functions are used:</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[#include <stdio.h>
					#in]]><![CDATA[clude <string.h>
					
					int ]]><![CDATA[main() {   
					  char longStri]]><![CDATA[ng[] = "String signifying nothin]]><![CDATA[g";
					  char shortString[16];]]><![CDATA[    
					
					  strncpy(shortS]]><![CDATA[tring, longString, 16);    
				]]><![CDATA[	  printf("The last character in]]><![CDATA[ shortString is: %c %1$x\n", sho]]><![CDATA[rtString[15]);    
					  return]]><![CDATA[ (0);
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The above code gives the following output: The last character in shortString is: l
						6c So, the shortString array does not end in a NULL character, even though the "safe"
						string function strncpy() was used.</PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>Miscalculated null termination is a common issue, and often difficult to detect. The
				most common symptoms occur infrequently (in the case of problems resulting from "safe" string
				functions), or in odd ways characterized by data corruption (when caused by off-by-one errors).
				The case of an omitted null character is the most dangerous of the possible issues. This will
				almost certainly result in information disclosure, and possibly a buffer overflow condition, which
				may be exploited to execute arbitrary code. As for misplaced null characters, the biggest issue is
				a subset of buffer overflow, and write-what-where conditions, where data corruption occurs from
				the writing of a null character over valid data, or even instructions. These logic issues may
				result in any number of security flaws.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>119</Relationship_Target_ID>
				</Relationship>
				<Relationship>
					<Relationship_Views>
						<Relationship_View_ID>1000</Relationship_View_ID>
					</Relationship_Views>
					<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>682</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Compound_Element</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>120</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>123</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Miscalculated null termination</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="134" Weakness_Name="Uncontrolled Format String" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software uses externally-controlled format strings in printf-style functions, which can lead to buffer overflows or data representation problems.</Description_Summary>
			</Description>
			<Functional_Area>logging, errors, general output</Functional_Area>
			<Likelihood_of_Exploit>Very High</Likelihood_of_Exploit>
			<Weakness_Ordinality>Primary (Weakness exists independent of other weaknesses)</Weakness_Ordinality>
			<Causal_Nature>Implicit (This is an implicit weakness)</Causal_Nature>
			<Affected_Resource>Memory</Affected_Resource>
			<Common_Consequences>
				<Common_Consequence>Confidentiality: Format string problems allow for information disclosure which
					can severely simplify exploitation of the program.</Common_Consequence>
				<Common_Consequence>Access Control: Format string problems can result in the execution of
					arbitrary code.</Common_Consequence>
			</Common_Consequences>
			<Potential_Mitigations>
				<Mitigation>Requirements specification: Choose a language which is not subject to this flaw.</Mitigation>
				<Mitigation>Implementation: Ensure that all format string functions are passed a static string
					which cannot be controlled by the user and that the proper number of arguments are always sent
					to that function as well. If at all possible, do not use the %n operator in format strings.</Mitigation>
				<Mitigation>Build: Heed the warnings of compilers and linkers, since they may alert you to
					improper usage.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following example is exploitable, due to the printf() call in the printWrapper()
						function. Note: The stack buffer was added to make exploitation more simple.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[#include <stdio.h>
					
	]]><![CDATA[				void printWrapper(char *stri]]><![CDATA[ng) {   
					  printf(string);
]]><![CDATA[					}
					
					int main(int a]]><![CDATA[rgc, char **argv) {   
					  ch]]><![CDATA[ar buf[5012];    
					  memcpy(]]><![CDATA[buf, argv[1], 5012);    
					  ]]><![CDATA[printWrapper(argv[1]);    
					]]><![CDATA[  return (0);
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
				</Example_Code>
				<Example_Code>
					<PreText>The following code copies a command line argument into a buffer using snprintf().</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[int main(]]><![CDATA[int argc, char **argv){
					  c]]><![CDATA[har buf[128];
					  ...
					  ]]><![CDATA[snprintf(buf,128,argv[1]);
					]]><![CDATA[}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>This code allows an attacker to view the contents of the stack and write to the
						stack using a command line argument containing a sequence of formatting directives. The
						attacker can read from the stack by providing more formatting directives, such as %x, than
						the function takes as arguments to be formatted. (In this example, the function takes no
						arguments to be formatted.) By using the %n formatting directive, the attacker can write
						to the stack, causing snprintf() to write the number of bytes output thus far to the
						specified argument (rather than reading a value from the argument, which is the intended
						behavior). A sophisticated version of this attack will use four staggered writes to
						completely control the value of a pointer on the stack.</PostText>
				</Example_Code>
				<Example_Code>
					<PreText>Certain implementations make more advanced attacks even easier by providing format
						directives that control the location in memory to read from or write to. An example of
						these directives is shown in the following code, written for glibc: </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[printf("%d %d %]]><![CDATA[1$d %1$d\n", 5, 9);]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>This code produces the following output: 5 9 5 5 It is also possible to use
						half-writes (%hn) to accurately control arbitrary DWORDS in memory, which greatly reduces
						the complexity needed to execute an attack that would otherwise require four staggered
						writes, such as the one mentioned in the first example. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1825</Observed_Example_Reference>
					<Observed_Example_Description>format string in Perl program</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0717</Observed_Example_Reference>
					<Observed_Example_Description>format string in bad call to syslog function</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-0573</Observed_Example_Reference>
					<Observed_Example_Description>format string in bad call to syslog function</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1788</Observed_Example_Reference>
					<Observed_Example_Description>format strings in NNTP server responses</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2007-2027</Observed_Example_Reference>
					<Observed_Example_Description>Chain: untrusted search path enabling resultant
						format string by loading malicious internationalization messages</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>While Format String vulnerabilities typically fall under the Buffer Overflow category,
				technically they are not overflowed buffers. The Format String vulnerability is fairly new (circa
				1999) and stems from the fact that there is no realistic way for a function that takes a variable
				number of arguments to determine just how many arguments were passed in. The most common functions
				that take a variable number of arguments, including C-runtime functions, are the printf() family
				of calls. The Format String problem appears in a number of ways. A *printf() call without a format
				specifier is dangerous and can be exploited. For example, printf(input); is exploitable, while
				printf(y, input); is not exploitable in that context. The result of the first call, used
				incorrectly, allows for an attacker to be able to peek at stack memory since the input string will
				be used as the format specifier. The attacker can stuff the input string with format specifiers
				and begin reading stack values, since the remaining parameters will be pulled from the stack.
				Worst case, this improper use may give away enough control to allow an arbitrary value (or values
				in the case of an exploit program) to be written into the memory of the running program</Context_Notes>
			<Context_Notes>Frequently targeted entities are file names, process names, identifiers</Context_Notes>
			<Context_Notes>Format string problems are a classic C/C++ issue that are now rare due to the ease of
				discovery. The reason format string vulnerabilities can be exploited is due to the %n operator.
				The %n operator will write the number of characters, which have been printed by the format string
				therefore far, to the memory pointed to by its argument. Through skilled creation of a format
				string, a malicious user may use values on the stack to create a write-what-where condition. Once
				this is achieved, he can execute arbitrary code.</Context_Notes>
			<Research_Gaps>Format string issues are under-studied for languages other than C. Memory or disk
				consumption, control flow or variable alteration, and data corruption may result from format
				string exploitation in applications written in other languages such as Perl, PHP, Python, etc.</Research_Gaps>
			<Research_Gaps>Since format strings often occur in rarely-occurring erroneous conditions, it is highly
				that many latent issues exist in executables that do not have associated source code (or
				equivalent source).</Research_Gaps>
			<References>
				<Reference>
					<Reference_Author>Steve Christey</Reference_Author>
					<Reference_Title>Format String Vulnerabilities in Perl Programs</Reference_Title>
					<Reference_Link>http://www.securityfocus.com/archive/1/418460/30/0/threaded</Reference_Link>
				</Reference>
				<Reference>
					<Reference_Author>Hal Burch</Reference_Author>
					<Reference_Author>Robert C. Seacord</Reference_Author>
					<Reference_Title>Programming Language Format String Vulnerabilities</Reference_Title>
					<Reference_Link>http://www.ddj.com/dept/security/197002914</Reference_Link>
				</Reference>
				<Reference>
					<Reference_Author>Tim Newsham</Reference_Author>
					<Reference_Title>Format String Attacks</Reference_Title>
					<Reference_Publisher>Guardent</Reference_Publisher>
					<Reference_PubDate>September 2000</Reference_PubDate>
					<Reference_Link>http://www.lava.net/~newsham/format-string-attacks.pdf</Reference_Link>
				</Reference>
			</References>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>133</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>74</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>PeerOf</Relationship_Nature>
					<Relationship_Target_ID>123</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">630</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>View</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>630</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">631</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>633</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">635</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>View</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>635</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Format string vulnerability</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Format String</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Format string problem</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
			<Time_of_Introduction>Implementation</Time_of_Introduction>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>67<!--String Format Overflow in syslog()--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
			<White_Box_Definition>
	A weakness where the code path has:
	1.        start statement that accepts input
	2.        end statement that passes a format to format output function where
	          a.        the input data is part of the format and
	          b.        the format is undesirable
	
	Where “undesirable” is defined through the following scenarios:
	1.        not validated
	2.        incorrectly validated
			</White_Box_Definition>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="135" Weakness_Name="Incorrect Calculation of Multi-Byte String Length" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not properly calculate the length of strings that can contain wide or multi-byte characters.</Description_Summary>
			</Description>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following example would be exploitable if any of the commented incorrect malloc
						calls were used.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[#include <stdio.h>
					#inc]]><![CDATA[lude <strings.h>
					#include <]]><![CDATA[wchar.h>
					
					int main() {]]><![CDATA[   
					  wchar_t wideString[] ]]><![CDATA[= L"The spazzy orange tiger jump]]><![CDATA[ed " \ 
											  "over the t]]><![CDATA[awny jaguar.";    
					  wchar_]]><![CDATA[t *newString;    
					
					  p]]><![CDATA[rintf("Strlen() output: %d\nWcsl]]><![CDATA[en() output: %d\n", 
					  strl]]><![CDATA[en(wideString), wcslen(wideStrin]]><![CDATA[g));    
					
					  /* Very wr]]><![CDATA[ong for obvious reasons //    
	]]><![CDATA[				  newString = (wchar_t *) ma]]><![CDATA[lloc(strlen(wideString));    
		]]><![CDATA[			  */    
					
					  /* Wron]]><![CDATA[g because wide characters aren't]]><![CDATA[ 1 byte long! //    
					  newS]]><![CDATA[tring = (wchar_t *) malloc(wcsle]]><![CDATA[n(wideString));    
					  */   ]]><![CDATA[ 
					
					  /* correct! */   ]]><![CDATA[ 
					  newString = (wchar_t *)]]><![CDATA[ malloc(wcslen(wideString) * siz]]><![CDATA[eof(wchar_t));    
					
					  ]]><![CDATA[/* ... */
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The output from the printf() statement would be: Strlen() output: 0 Wcslen() output:
						53</PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>There are several ways in which improper string length checking may result in an
				exploitable condition. All of these, however, involve the introduction of buffer overflow
				conditions in order to reach an exploitable state. The first of these issues takes place when the
				output of a wide or multi-byte character string, string-length function is used as a size for the
				allocation of memory. While this will result in an output of the number of characters in the
				string, note that the characters are most likely not a single byte, as they are with standard
				character strings. So, using the size returned as the size sent to new or malloc and copying the
				string to this newly allocated memory will result in a buffer overflow. Another common way these
				strings are misused involves the mixing of standard string and wide or multi-byte string functions
				on a single string. Invariably, this mismatched information will result in the creation of a
				possibly exploitable buffer overflow condition. Again, if a language subject to these flaws must
				be used, the most effective mitigation technique is to pay careful attention to the code at
				implementation time and ensure that these flaws do not occur.</Context_Notes>
				<Relationships>
				<Relationship>
					<Relationship_Views>
						<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
					</Relationship_Views>
					<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>682</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>133</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="CLASP">
				<Original_Node_Name>Improper string length checking</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="14" Weakness_Name="Compiler Removal of Code to Clear Buffers" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Sensitive memory is cleared according to the source code, but compiler optimizations
				leave the memory untouched when it is not read from again, aka "dead store removal."</Description_Summary>
			</Description>
			<Affected_Resource>Memory</Affected_Resource>
			<Potential_Mitigations>
				<Mitigation>Overwrite sensitive data in memory prior to clearing.</Mitigation>
				<Mitigation>Where possible, encrypt sensitive data that are used by a software
				system.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following code reads a password from the user, uses the password to connect to a
						back-end mainframe and then attempts to scrub the password from memory using memset().</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[void]]><![CDATA[ GetData(char *MFAddr) { 
					 ]]><![CDATA[ char pwd[64];
					  if (GetPas]]><![CDATA[swordFromUser(pwd, sizeof(pwd)))]]><![CDATA[ { 
					    if (ConnectToMainfr]]><![CDATA[ame(MFAddr, pwd)) { 
					    //]]><![CDATA[ Interaction with mainframe 
			]]><![CDATA[		    } 
					  }
					  memset(]]><![CDATA[pwd, 0, sizeof(pwd));
					}]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The code in the example will behave correctly if it is executed verbatim, but if the
						code is compiled using an optimizing compiler, such as Microsoft Visual C++® .NET or GCC
						3.x, then the call to memset() will be removed as a dead store because the buffer pwd is
						not used after its value is overwritten [18]. Because the buffer pwd contains a sensitive
						value, the application may be vulnerable to attack if the data are left memory resident.
						If attackers are able to access the correct region of memory, they may use the recovered
						password to gain control of the system. It is common practice to overwrite sensitive data
						manipulated in memory, such as passwords or cryptographic keys, in order to prevent
						attackers from learning system secrets. However, with the advent of optimizing compilers,
						programs do not always behave as their source code alone would suggest. In the example,
						the compiler interprets the call to memset() as dead code because the memory being written
						to is not subsequently used, despite the fact that there is clearly a security motivation
						for the operation to occur. The problem here is that many compilers, and in fact many
						programming languages, do not take this and other security concerns into consideration in
						their efforts to improve efficiency. Attackers typically exploit this type of
						vulnerability by using a core dump or runtime mechanism to access the memory used by a
						particular application and recover the secret information. Once an attacker has access to
						the secret information, it is relatively straightforward to further exploit the system and
						possibly compromise other resources with which the application interacts. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>Compiler optimization errors occur when: 1. Secret data are stored in memory. 2. The
				secret data are scrubbed from memory by overwriting its contents. 3. The source code is compiled
				using an optimizing compiler, which identifies and removes the function that overwrites the
				contents as a dead store because the memory is not used subsequently. </Context_Notes>
			<Context_Notes>This is also an interaction error.</Context_Notes>
			<Context_Notes>This can be hard to diagnose.</Context_Notes>
			<References>
				<Reference>
					<Reference_Author>Michael Howard</Reference_Author>
					<Reference_Title>When scrubbing secrets in memory doesn't work</Reference_Title>
					<Reference_Publication>BugTraq</Reference_Publication>
					<Reference_Date>2002-11-05</Reference_Date>
					<Reference_Link>http://cert.uni-stuttgart.de/archive/bugtraq/2002/11/msg00046.html</Reference_Link>
				</Reference>
				<Reference>
					<Reference_Link>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncode/html/secure10102002.asp</Reference_Link>
				</Reference>
				<Reference>
					<Reference_Author>Joseph Wagner</Reference_Author>
					<Reference_Title>GNU GCC: Optimizer Removes Code Necessary for Security</Reference_Title>
					<Reference_Publication>Bugtraq</Reference_Publication>
					<Reference_Date>2002-11-16</Reference_Date>
					<Reference_Link>http://www.derkeiler.com/Mailing-Lists/securityfocus/bugtraq/2002-11/0257.html</Reference_Link>
				</Reference>
			</References>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>503</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanAlsoBe</Relationship_Nature>
					<Relationship_Target_ID>435</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">631</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>633</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Insecure Compiler Optimization</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Sensitive memory uncleared by compiler optimization</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>.NET</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="140" Weakness_Name="Failure to Sanitize Delimiters" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not properly
			sanitize delimiters.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Developers should anticipate that delimiters will be injected/removed/manipulated in
					the input vectors of their software system. Use an appropriate combination of black lists and
					white lists to ensure only valid, expected and appropriate input is processed by the
				system.</Mitigation>
			</Potential_Mitigations>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>138</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Delimiter Problems</Original_Node_Name>
			</Source_Taxonomy>
	
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>15<!--Command Delimiters--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="15" Weakness_Name="External Control of System or Configuration Setting" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>One or more system settings or configuration elements can be externally controlled by a user. Allowing external control of system settings can disrupt service or cause an application to behave in unexpected, and potentially malicious, ways.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Compartmentalize your system and determine where the trust boundaries exist. Any
					input/control outside the trust boundary should be treated as potentially hostile.</Mitigation>
				<Mitigation>Because setting manipulation covers a diverse set of functions, any attempt at
					illustrating it will inevitably be incomplete. Rather than searching for a tight-knit
					relationship between the functions addressed in the setting manipulation category, take a step
					back and consider the sorts of system values that an attacker should not be allowed to
					control. </Mitigation>
				<Mitigation>In general, do not allow user-provided or otherwise untrusted data to control
					sensitive values. The leverage that an attacker gains by controlling these values is not
					always immediately obvious, but do not underestimate the creativity of your
				attacker.</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>The following C code accepts a number as one of its command line parameters and sets
						it as the host ID of the current machine.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>C</Code_Example_Language>
							<Code_Block><![CDATA[...
					sethostid(argv[1]);]]><![CDATA[
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>Although a process must be privileged to successfully invoke sethostid(),
						unprivileged users may be able to invoke the program. The code in this example allows user
						input to directly control the value of a system setting. If an attacker provides a
						malicious value for host ID, the attacker can misidentify the affected machine on the
						network or cause other unintended behavior. </PostText>
				</Example_Code>
				<Example_Code>
					<PreText>The following Java code snippet reads a string from an HttpServletRequest and sets it
						as the active catalog for a database Connection. </PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Example_Language>Java</Code_Example_Language>
							<Code_Block><![CDATA[...
					conn.setCat]]><![CDATA[alog(request.getParamter("catalo]]><![CDATA[g"));
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>In this example, an attacker could cause an error by providing a nonexistent catalog
						name or connect to an unauthorized portion of the database. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Context_Notes>Setting manipulation vulnerabilities occur when an attacker can control values that
				govern the behavior of the system, manage specific resources, or in some way affect the
				functionality of the application. </Context_Notes>
				<Relationships>
				<Relationship>
					<Relationship_Views>
						<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
					</Relationship_Views>
					<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>610</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>2</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>Setting Manipulation</Original_Node_Name>
			</Source_Taxonomy>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>13<!--Subverting Environment Variable Values--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>76<!--Manipulating Input to File System Calls--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>77<!--Manipulating User-Controlled Variables--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>69<!--Target Programs with Elevated Privileges--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="166" Weakness_Name="Failure to Handle Missing Special Element" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not handle when an expected special element (character or reserved
				word) is missing.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Developers should anticipate that special elements will be removed in the input
					vectors of their software system. Use an appropriate combination of black lists and white
					lists to ensure only valid, expected and appropriate input is processed by the
				system.</Mitigation>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1362</Observed_Example_Reference>
					<Observed_Example_Description>Crash via message type without separator character</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-0729</Observed_Example_Reference>
					<Observed_Example_Description>Missing special character (separator) causes crash</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1532</Observed_Example_Reference>
					<Observed_Example_Description>HTTP GET without \r\n\r\n CRLF sequences causes product to wait indefinitely and
						prevents other users from accessing it</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>This can overlap incomplete input.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>159</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Missing Special Element</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="167" Weakness_Name="Failure to Handle Additional Special Element" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not handle when
				an additional unexpected special element (character or
				reserved word) is used.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Developers should anticipate that extra special elements will be injected in the input
					vectors of their software system. Use an appropriate combination of black lists and white
					lists to ensure only valid, expected and appropriate input is processed by the
				system.</Mitigation>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0116</Observed_Example_Reference>
					<Observed_Example_Description>Extra "&lt;" in front of SCRIPT tag.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-1157</Observed_Example_Reference>
					<Observed_Example_Description>Extra "&lt;" in front of SCRIPT tag.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-2086</Observed_Example_Reference>
					<Observed_Example_Description>"&lt;script" - probably a cleansing error</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>159</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Extra Special Element</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="168" Weakness_Name="Failure to Resolve Inconsistent Special Elements" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not handle when an inconsistency exists between two or more special
				characters or reserved words, e.g. if paired characters appear in the wrong order, or if the
				special characters are not properly nested.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Developers should anticipate that inconsistent special elements will be
					injected/manipulated in the input vectors of their software system. Use an appropriate
					combination of black lists and white lists to ensure only valid, expected and appropriate
					input is processed by the system.</Mitigation>
			</Potential_Mitigations>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>159</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Inconsistent Special Elements</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="170" Weakness_Name="Improper Null Termination" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>The software does not properly terminate a string or array with a null character or
				equivalent terminator. Null termination errors frequently occur in two different ways. An
				off-by-one error could cause a null to be written out of bounds, leading to an overflow. Or, a
				program could use a strncpy() function call incorrectly, which prevents a null terminator from
				being added at all. Other scenarios are possible.</Description_Summary>
			</Description>
			<Likelihood_of_Exploit>High</Likelihood_of_Exploit>
			<Potential_Mitigations>
				<Mitigation>If performance constraints permit, special code can be added that validates
					null-termination of string buffers, this is a rather naïve and error-prone solution.</Mitigation>
				<Mitigation>Switch to bounded string manipulation functions. Inspect buffer lengths involved in
					the buffer overrun trace reported with the defect.</Mitigation>
				<Mitigation>Add code that fills buffers with nulls (however, the length of buffers still needs to
					be inspected, to ensure that the non null-terminated string is not written at the physical end
					of the buffer).</Mitigation>
			</Potential_Mitigations>
			<Demonstrative_Example>
				<Example_Code>
					<PreText>Example 1: The following code reads from cfgfile and copies the input into inputbuf
						using strcpy(). The code mistakenly assumes that inputbuf will always contain a NULL
						terminator.</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[#define MAXLEN 1024 
				]]><![CDATA[	...
					char *pathbuf[MAXLEN];]]><![CDATA[ 
					...
					read(cfgfile,inp]]><![CDATA[utbuf,MAXLEN); //does not null t]]><![CDATA[erminate 
					strcpy(pathbuf,in]]><![CDATA[put_buf); //requires null termin]]><![CDATA[ated input 
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The code in Example 1 will behave correctly if the data read from cfgfile is null
						terminated on disk as expected. But if an attacker is able to modify this input so that it
						does not contain the expected NULL character, the call to strcpy() will continue copying
						from memory until it encounters an arbitrary NULL character. This will likely overflow the
						destination buffer and, if the attacker can control the contents of memory immediately
						following inputbuf, can leave the application susceptible to a buffer overflow
					attack.</PostText>
				</Example_Code>
				<Example_Code>
					<PreText>Example 2: In the following code, readlink() expands the name of a symbolic link
						stored in the buffer path so that the buffer filename contains the absolute path of the
						file referenced by the symbolic link. The length of the resulting value is then calculated
						using strlen().</PreText>
					<Example_Block>
						<Example_Code_Block>
							<Code_Block><![CDATA[...
					char buf[MAXPATH];
		]]><![CDATA[			...
					readlink(path, buf, ]]><![CDATA[MAXPATH);
					int length = strl]]><![CDATA[en(filename);
					...]]></Code_Block>
						</Example_Code_Block>
					</Example_Block>
					<PostText>The code in Example 2 will not behave correctly because the value read into buf by
						readlink() will not be null terminated. In testing, vulnerabilities like this one might
						not be caught because the unused contents of buf and the memory immediately following it
						may be NULL, thereby causing strlen() to appear as if it is behaving correctly. However,
						in the wild strlen() will continue traversing memory until it encounters an arbitrary NULL
						character on the stack, which results in a value of length that is much larger than the
						size of buf and may cause a buffer overflow in subsequent uses of this value. Buffer
						overflows aside, whenever a single call to readlink() returns the same value that has been
						passed to its third argument, it is impossible to know whether the name is precisely that
						many bytes long, or whether readlink() has truncated the name to avoid overrunning the
						buffer. Traditionally, strings are represented as a region of memory containing data
						terminated with a NULL character. Older string-handling methods frequently rely on this
						NULL character to determine the length of the string. If a buffer that does not contain a
						NULL terminator is passed to one of these functions, the function will read past the end
						of the buffer. Malicious users typically exploit this type of vulnerability by injecting
						data with unexpected size or content into the application. They may provide the malicious
						input either directly as input to the program or indirectly by modifying application
						resources, such as configuration files. In the event that an attacker causes the
						application to read beyond the bounds of a buffer, the attacker may be able use a
						resulting buffer overflow to inject and execute arbitrary code on the system. </PostText>
				</Example_Code>
			</Demonstrative_Example>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0312</Observed_Example_Reference>
					<Observed_Example_Description>Attacker does not null-terminate argv[] when invoking another program.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0777</Observed_Example_Reference>
					<Observed_Example_Description>Interrupted step causes resultant lack of null termination.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1072</Observed_Example_Reference>
					<Observed_Example_Description>Fault causes resultant lack of null termination, leading to buffer expansion.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-1389</Observed_Example_Reference>
					<Observed_Example_Description>Multiple vulnerabilities related to improper null termination.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0143</Observed_Example_Reference>
					<Observed_Example_Description>Product does not null terminate a message buffer after snprintf-like call, leading to
						overflow.</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Context_Notes>Conceptually, this does not just apply to the C language; any language or
				representation that involves a terminator could have this sort of problem.</Context_Notes>
			<Context_Notes>Factors: this is usually resultant from other weaknesses such as off-by-one errors, but
				it can be primary to boundary condition violations such as buffer overflows. In buffer overflows,
				it can act as an expander for assumed-immutable data.</Context_Notes>
			<Context_Notes>Overlaps missing input terminator.</Context_Notes>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>169</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Compound_Element</Relationship_Type>
					<Relationship_Nature>CanPrecede</Relationship_Nature>
					<Relationship_Target_ID>120</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanAlsoBe</Relationship_Nature>
					<Relationship_Target_ID>147</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">630</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>View</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>630</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Improper Null Termination</Original_Node_Name>
			</Source_Taxonomy>
			<Source_Taxonomy Source_Taxonomy_Name="7 Pernicious Kingdoms">
				<Original_Node_Name>String Termination Error</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>C</Platform>
				<Platform>C++</Platform>
			</Applicable_Platforms>
			<White_Box_Definition>
	A weakness where the code path has:
	1.        end statement that passes a data item to a null-terminated string function
	2.        start statement that removes the null-terminator from the data item 
	
	Where “removes” is defined through the following scenarios:
	1.        data item never ended with null-terminator 
	2.        null-terminator is re-written
	3.        null-terminator was purposely removed from data item
			</White_Box_Definition>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="178" Weakness_Name="Failure to Resolve Case Sensitivity" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>Improperly handled case sensitive data can lead to several possible consequences,
				including: - case-insensitive passwords reducing the size of the key space, making brute force
				attacks easier - bypassing filters or access controls using alternate names - multiple
				interpretation errors using alternate names.</Description_Summary>
			</Description>
			<Functional_Area>File Processing, Credentials</Functional_Area>
			<Affected_Resource>File/Directory</Affected_Resource>
			<Potential_Mitigations>
				<Mitigation>Avoid making decisions based on names of resources (e.g. files) if those resources can
					have alternate names.</Mitigation>
				<Mitigation>Assume all input is malicious. Use an appropriate combination of black lists and white
					lists to ensure only valid, expected and appropriate input is processed by the system. For
					example, valid input may be in the form of an absolute pathname(s). You can also limit
					pathnames to exist on selected drives, have the format specified to include only separator
					characters (forward or backward slashes) and alphanumeric characters, and follow a naming
					convention such as having a maximum of 32 characters followed by a '.' and ending with
					specified extensions.</Mitigation>
				<Mitigation>Canonicalize the name to match that of the file system's representation of the name.
					This can sometimes be achieved with an available API (e.g. in Win32 the GetFullPathName
					function).</Mitigation>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0497</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0498</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0766</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-0795</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2001-1238</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2003-0411</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-0485</Observed_Example_Reference>
					<Observed_Example_Description>Leads to interpretation error</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-1999-0239</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-0269</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-1083</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2154</Observed_Example_Reference>
					<Observed_Example_Description>Overlaps ACL bypass</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2000-0499</Observed_Example_Reference>
					<Observed_Example_Description/>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-2119</Observed_Example_Reference>
					<Observed_Example_Description>Case insensitive passwords lead to search space reduction.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2214</Observed_Example_Reference>
					<Observed_Example_Description>HTTP server allows bypass of access restrictions using URIs with mixed case.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2154</Observed_Example_Reference>
					<Observed_Example_Description>Mixed upper/lowercase allows bypass of ACLs.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-2214</Observed_Example_Reference>
					<Observed_Example_Description>Bypass access restrictions using mixed case.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-4509</Observed_Example_Reference>
					<Observed_Example_Description>Bypass malicious script detection by using tokens that aren't case sensitive.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2002-1820</Observed_Example_Reference>
					<Observed_Example_Description>Mixed case problem allows "admin" to have "Admin" rights (alternate name property).</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2007-3365</Observed_Example_Reference>
					<Observed_Example_Description>Chain: uppercase file extensions causes web server
						to return script source code instead of executing the script.</Observed_Example_Description>
				</Observed_Example>
			</Observed_Examples>
			<Research_Gaps>These are probably under-studied in Windows and Mac environments, where file names are
				case-insensitive and thus are subject to equivalence manipulations involving case.</Research_Gaps>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>171</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanPrecede</Relationship_Nature>
					<Relationship_Target_ID>433</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>CanPrecede</Relationship_Nature>
					<Relationship_Target_ID>289</Relationship_Target_ID>
				</Relationship>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID Ordinal="Primary">631</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>632</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Case Sensitivity (lowercase, uppercase, mixed case)</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="179" Weakness_Name="Incorrect Behavior Order: Early Validation" Weakness_Abstraction="Base" Weakness_Status="Incomplete">
		<Common_Attributes>
			<Description>
				<Description_Summary>Software needs to validate data at the proper time, after data has been canonicalized and
				cleansed. Early validation is susceptible to various manipulations that result in dangerous inputs
				that are produced by canonicalization and cleansing.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Validate data after attempts to canonicalize the resource name. </Mitigation>
			</Potential_Mitigations>
			<Context_Notes>Since early validation errors usually arise from improperly implemented defensive
				mechanisms, it is likely that these will be reported more frequently as secure programming becomes
				implemented more widely.</Context_Notes>
			<Research_Gaps>These errors are mostly reported in path traversal vulnerabilities, but the concept
				applies anyplace where filtering occurs.</Research_Gaps>
				<Relationships>
				<Relationship>
						<Relationship_Views>
							<Relationship_View_ID>1000</Relationship_View_ID>
						</Relationship_Views>
						<Relationship_Type>Category</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>171</Relationship_Target_ID>
				</Relationship>
				<Relationship>
					<Relationship_Views>
						<Relationship_View_ID Ordinal="Primary">1000</Relationship_View_ID>
					</Relationship_Views>
					<Relationship_Type>Weakness</Relationship_Type>
					<Relationship_Nature>ChildOf</Relationship_Nature>
					<Relationship_Target_ID>693</Relationship_Target_ID>
				</Relationship>
				</Relationships>
			<Source_Taxonomy Source_Taxonomy_Name="PLOVER">
				<Original_Node_Name>Early Validation Errors</Original_Node_Name>
			</Source_Taxonomy>
			<Applicable_Platforms>
				<Platform>All</Platform>
			</Applicable_Platforms>
			<Related_Attack_Patterns>
				<Related_Attack_Pattern>
					<CAPEC_ID>71<!--Using Unicode Encoding to Bypass Validation Logic--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>3<!--Using Leading 'Ghost' Character Sequences to Bypass Input Filters--></CAPEC_ID>
				</Related_Attack_Pattern>
				<Related_Attack_Pattern>
					<CAPEC_ID>43<!--Exploiting Multiple Input Interpretation Layers--></CAPEC_ID>
				</Related_Attack_Pattern>
			</Related_Attack_Patterns>
		</Common_Attributes>
	</Weakness>
                    <Weakness Weakness_ID="182" Weakness_Name="Collapse of Data Into Unsafe Value" Weakness_Abstraction="Base" Weakness_Status="Draft">
		<Common_Attributes>
			<Description>
				<Description_Summary>Software cleanses or filters data in a way that causes the data to "collapse" into an
				unsafe value.</Description_Summary>
			</Description>
			<Potential_Mitigations>
				<Mitigation>Validate data after attempts to canonicalize. </Mitigation>
				<Mitigation>Avoid making decisions based on names of resources (e.g. files) if those resources can
					have alternate names.</Mitigation>
				<Mitigation>Assume all input is malicious. Use an appropriate combination of black lists and white
					lists to ensure only valid, expected and appropriate input is processed by the system. For
					example, valid input may be in the form of an absolute pathname(s). You can also limit
					pathnames to exist on selected drives, have the format specified to include only separator
					characters (forward or backward slashes) and alphanumeric characters, and follow a naming
					convention such as having a maximum of 32 characters followed by a '.' and ending with
					specified extensions.</Mitigation>
				<Mitigation>Canonicalize the name to match that of the file system's representation of the name.
					This can sometimes be achieved with an available API (e.g. in Win32 the GetFullPathName
					function).</Mitigation>
			</Potential_Mitigations>
			<Observed_Examples>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2004-0815</Observed_Example_Reference>
					<Observed_Example_Description>"/.////" in pathname collapses to absolute path.</Observed_Example_Description>
				</Observed_Example>
				<Observed_Example>
					<Observed_Example_Reference>CVE-2005-3123</Observed_E