<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Khorvath</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Khorvath"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Khorvath"/>
		<updated>2026-05-08T05:16:55Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_Testing_Project/Releases/Testing_Guide_V_4.0&amp;diff=92492</id>
		<title>Projects/OWASP Testing Project/Releases/Testing Guide V 4.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_Testing_Project/Releases/Testing_Guide_V_4.0&amp;diff=92492"/>
				<updated>2010-11-08T03:23:59Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template: &amp;lt;includeonly&amp;gt;{{{1}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;Release About&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
| project_name = OWASP Testing Project&lt;br /&gt;
| project_home_page = :Category:OWASP Testing Project&lt;br /&gt;
| release_name = Testing Guide V 4.0&lt;br /&gt;
| release_date = 15th January 2011&lt;br /&gt;
| release_description =&lt;br /&gt;
* Review all the control numbers to adhere to the [http://www.owasp.org/index.php/Common_OWASP_Numbering OWASP Common numbering] &lt;br /&gt;
* Review all the sections in v3,&lt;br /&gt;
* Create a more readable guide, eliminating some sections that are not really useful,&lt;br /&gt;
* Insert new testing techniques: HTTP Verb tampering, HTTP Parameter Pollutions, etc.,&lt;br /&gt;
* Rationalize some sections as Session Management Testing,&lt;br /&gt;
* Create a new section: Client side security and Firefox extensions testing.&lt;br /&gt;
| release_license = [http://creativecommons.org/licenses/by-sa/3.0/ '''Creative Commons Attribution Share Alike 3.0''']&lt;br /&gt;
| release_download_link = &lt;br /&gt;
| leader_name1 = Matteo Meucci&lt;br /&gt;
| leader_username1 = Mmeucci&lt;br /&gt;
| leader_email1 = matteo.meucci@owasp.org&lt;br /&gt;
&lt;br /&gt;
| contributor_name1 = Roberto Suggi Liverani&lt;br /&gt;
| contributor_email1 =&lt;br /&gt;
| contributor_username1 =&lt;br /&gt;
&lt;br /&gt;
| contributor_name2 = Nick Freeman&lt;br /&gt;
| contributor_email2 =&lt;br /&gt;
| contributor_username2 =&lt;br /&gt;
&lt;br /&gt;
| contributor_name3 = Stefano Di Paola&lt;br /&gt;
| contributor_email3 = stefano.dipaola@gmail.com&lt;br /&gt;
| contributor_username3 =&lt;br /&gt;
&lt;br /&gt;
| contributor_name4 = Marco Morana&lt;br /&gt;
| contributor_email4 = marco.morana@owasp.org&lt;br /&gt;
| contributor_username4 =&lt;br /&gt;
&lt;br /&gt;
| contributor_name5 = Giorgio Fedon&lt;br /&gt;
| contributor_email5 = giorgio.fedon@gmail.com&lt;br /&gt;
| contributor_username5 =&lt;br /&gt;
&lt;br /&gt;
| contributor_name6 =  Kevin Horvath&lt;br /&gt;
| contributor_email6 = kevin.horvath@gmail.com&lt;br /&gt;
| contributor_username6 =&lt;br /&gt;
&lt;br /&gt;
| release_notes = http://www.owasp.org/index.php/Projects/OWASP_Testing_Project/Releases/Testing_Guide_V_4.0/Roadmap&lt;br /&gt;
| links_url1 = https://spreadsheets.google.com/ccc?key=0An4Puwz7EA41dDV6cUY2YWpGaHdEbFktbklNMUFiSEE&amp;amp;hl=en&lt;br /&gt;
| links_name1 = Testing Guide's (Version 4.0) Approved Budget&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Credentials_Transported_over_an_Encrypted_Channel_(OTG-AUTHN-001)&amp;diff=36652</id>
		<title>Testing for Credentials Transported over an Encrypted Channel (OTG-AUTHN-001)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Credentials_Transported_over_an_Encrypted_Channel_(OTG-AUTHN-001)&amp;diff=36652"/>
				<updated>2008-08-20T02:32:39Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Testing for credentials transport means to verify that user's authentication data, are transferred via an encrypted channel to avoid being intercepted by some malicious users. The analysis focuses simply on trying to understand if data travel unencrypted from the web browser to the server, or if the web application takes the appropriate security measures using a protocol like HTTPS. The HTTPS protocol is built on TLS/SSL to encrypt the data that are transmitted and to ensure that we are sending them towards the desired site. Clearly, the fact that traffic is encrypted does not necessarily mean that it's completely safe. The security also depends on the encryption algorithm used and the robustness of the keys that the application is using. But this particular topic will not be addressed in this section. For a more detailed discussion on testing the safety of TLS/SSL channels you can refer to chapter [[Testing for SSL-TLS]]. Here, the tester will just try to understand if the data that users put into web forms, for example, in order to log into a web site, are transmitted using secure protocols that protect them from an attacker or not. To do this we will consider various examples.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Nowadays, the most common example of this issue is the login page of a web application. The tester should verify that user's credentials are transmitted via an encrypted channel. In order to log into a web site, usually, the user has to fill a simple form that transmits the inserted data with the POST method. What is less obvious is that this data can be passed using the HTTP protocol, that means in a non-secure way, or using HTTPS, which encrypts the data. To further complicate things, there is the possibility that the site has the login page accessible via HTTP (making us believe that the transmission is insecure), but then it actually sends data via HTTPS. This test is done to be sure that an attacker cannot retrieve sensitive information by simply sniffing the net with a sniffer tool. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In the following examples we will use WebScarab in order to capture packet headers and to inspect them. Anyway you can use any web proxy that you prefer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Case study: Sending data with POST method through HTTP''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the login page presents a form with fields User, Pass and the Submit button to authenticate and have access to the application. If we look at the header of our request with WebScarab, we get something like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
POST http://www.example.com/AuthenticationServlet HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.14) Gecko/20080404&lt;br /&gt;
Accept: text/xml,application/xml,application/xhtml+xml&lt;br /&gt;
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3&lt;br /&gt;
Accept-Encoding: gzip,deflate&lt;br /&gt;
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7&lt;br /&gt;
Keep-Alive: 300&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
Referer: http://www.example.com/index.jsp&lt;br /&gt;
Cookie: JSESSIONID=LVrRRQQXgwyWpW7QMnS49vtW1yBdqn98CGlkP4jTvVCGdyPkmn3S!&lt;br /&gt;
Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
Content-length: 64&lt;br /&gt;
&lt;br /&gt;
delegated_service=218&amp;amp;User=test&amp;amp;Pass=test&amp;amp;Submit=SUBMIT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From this example the tester can understand that the POST sends the data to the page ''www.example.com/AuthenticationServlet'' simply using HTTP. So, in this case, data are transmitted without encryption and a malicious user could read our username and password simply sniffing the net with a tool like Wireshark.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Case study: Sending data with POST method through HTTPS'''&lt;br /&gt;
&lt;br /&gt;
Suppose that our web application uses the HTTPS protocol to encrypt data we are sending (or at least for those relating to the authentication). In this case, trying to access the login page and to authenticate, the header of our POST request would be similar to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
POST https://www.example.com:443/cgi-bin/login.cgi HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.14) Gecko/20080404&lt;br /&gt;
Accept: text/xml,application/xml,application/xhtml+xml,text/html&lt;br /&gt;
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3&lt;br /&gt;
Accept-Encoding: gzip,deflate&lt;br /&gt;
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7&lt;br /&gt;
Keep-Alive: 300&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
Referer: https://www.example.com/cgi-bin/login.cgi&lt;br /&gt;
Cookie: language=English; &lt;br /&gt;
Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
Content-length: 50&lt;br /&gt;
&lt;br /&gt;
Command=Login&amp;amp;User=test&amp;amp;Pass=test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see that the request is addressed to&lt;br /&gt;
''www.example.com:443/cgi-bin/login.cgi'' using the HTTPS protocol.&lt;br /&gt;
This ensures that our data are sent through en encrypted channel and that they are not readable by other people. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Case study: sending data with POST method via HTTPS on a page reachable via HTTP'''&lt;br /&gt;
&lt;br /&gt;
Now, suppose to have a web page reachable via HTTP and that then only data sent from the authentication form are shipped via HTTPS. This means that our data are transmitted in a secure way through encryption. This situation occurs for example when we are on a portal of a big company that offers various information and services publicly available, without identification, but which has also a private section accessible from the home page through a login. So when we try to log, the header of our request will look like the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
POST https://www.example.com:443/login.do HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.14) Gecko/20080404&lt;br /&gt;
Accept: text/xml,application/xml,application/xhtml+xml,text/html&lt;br /&gt;
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3&lt;br /&gt;
Accept-Encoding: gzip,deflate&lt;br /&gt;
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7&lt;br /&gt;
Keep-Alive: 300&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
Referer: http://www.example.com/homepage.do&lt;br /&gt;
Cookie: SERVTIMSESSIONID=s2JyLkvDJ9ZhX3yr5BJ3DFLkdphH0QNSJ3VQB6pLhjkW6F&lt;br /&gt;
Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
Content-length: 45&lt;br /&gt;
&lt;br /&gt;
User=test&amp;amp;Pass=test&amp;amp;portal=ExamplePortal&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see that our request is addressed to ''www.example.com:443/login.do'' using HTTPS. But if we have a look at the referer field in the header (the page from which we came), it is ''www.example.com/homepage.do'' and is accessible via simple HTTP. So in this case we have no lock inside our browser window that tells us that we are using a secure connection, but, in reality, we are sending data via HTTPS. This ensures us that no other people can read the data that we are sending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Case study: Sending data with GET method through HTTPS'''&lt;br /&gt;
&lt;br /&gt;
In this last example, suppose that the application transfers data using the GET method. This method should never be used in a form that transmits sensitive data such as username and password, because they are displayed in clear in the URL and this entails a whole set of security issues. So this example is purely demonstrative, but in reality it is strongly suggested to use the POST method instead. This is because, when the GET method is used, the url that it requests are easily available into, for example, the server logs exposing your sensitive data to information leakage. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET https://www.example.com/success.html?user=test&amp;amp;pass=test HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.14) Gecko/20080404&lt;br /&gt;
Accept: text/xml,application/xml,application/xhtml+xml,text/html&lt;br /&gt;
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3&lt;br /&gt;
Accept-Encoding: gzip,deflate&lt;br /&gt;
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7&lt;br /&gt;
Keep-Alive: 300&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
Referer: https://www.example.com/form.html&lt;br /&gt;
If-Modified-Since: Mon, 30 Jun 2008 07:55:11 GMT&lt;br /&gt;
If-None-Match: &amp;quot;43a01-5b-4868915f&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the data is transferred in clear text in the URL and not in the body of the message as before. But we must consider that TLS/SSL is a level 5 protocol, a lower level than the HTTP one, then the whole HTTP package  is still encrypted and the URL is unreadable to an attacker. It is not a good practice to use the GET method in these cases, because the information contained in the URL can be stored in many servers such as proxy and web servers, leading the privacy of the user's credentials.&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
Talk with the developers of the application and try to understand if they are aware of differences between HTTP and HTTPS protocols and why they should use the HTTPS for sensitive information transmissions.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, check with them if HTTPS is used in every sensitive transmission, like those in login pages, to prevent unauthorized users to read the data.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* HTTP/1.1: Security Considerations - http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab - https://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=35976</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=35976"/>
				<updated>2008-08-13T18:18:30Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web applications typically run on popular open source or commercial software, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc. offer web-based configuration or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom, open source, or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often:&lt;br /&gt;
* inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components &lt;br /&gt;
* programmers, who leave backdoors to easily access and test their application and later forget to remove them&lt;br /&gt;
* application administrators and users that choose an easy username and password for themselves &lt;br /&gt;
* applications with built-in, non-removable default accounts with a pre-set username and password. &lt;br /&gt;
Another problem is blank passwords, which are simply the result of a lack of security awareness or a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Also review the page source and javascript either through a proxy or just right clicking and view source.  From here look for any page references (such as &amp;quot;If admin then starturl=/admin else /index.asp&amp;quot;) for a successful login vs a failed login.  Also if you have a valid account then login and view every request and response for a valid login vs an invalid login such as additional hidden parameters, interesting GET request (login=yes), etc.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  Such as, can a user create their own account or does the system create an account for the user based on some personal information or a predictable sequence.  If the application does create its own accounts in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
* If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/passwords&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Burp Intruder: http://portswigger.net/intruder/&lt;br /&gt;
* THC Hydra: http://www.thc.org/thc-hydra/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=35975</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=35975"/>
				<updated>2008-08-13T18:16:12Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web applications typically run on popular open source or commercial software, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc. offer web-based configuration or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom, open source, or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often:&lt;br /&gt;
* inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components &lt;br /&gt;
* programmers, who leave backdoors to easily access and test their application and later forget to remove them&lt;br /&gt;
* application administrators and users that choose an easy username and password for themselves &lt;br /&gt;
* applications with built-in, non-removable default accounts with a pre-set username and password. &lt;br /&gt;
Another problem is blank passwords, which are simply the result of a lack of security awareness or a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Also review the page source and javascript either through a proxy or just right clicking and view source.  From here look for any page references for a successful login vs a failed login.  Also if you have a valid account then login and view every request and response for a valid login vs an invalid login such as additional hidden parameters, interesting GET request (login=yes), etc.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  Such as, can a user create their own account or does the system create an account for the user based on some personal information or a predictable sequence.  If the application does create its own accounts in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
* If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/passwords&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Burp Intruder: http://portswigger.net/intruder/&lt;br /&gt;
* THC Hydra: http://www.thc.org/thc-hydra/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v3_Table_of_Contents&amp;diff=35538</id>
		<title>OWASP Testing Guide v3 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v3_Table_of_Contents&amp;diff=35538"/>
				<updated>2008-08-07T17:15:12Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: Undo revision 35536 by Khorvath (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
This is the draft of table of content of the New Testing Guide.&lt;br /&gt;
You can download the stable version [http://www.owasp.org/index.php/Image:OWASP_Testing_Guide_v2_pdf.zip here] or read it on line [http://www.owasp.org/index.php/OWASP_Testing_Guide_v2_Table_of_Contents here]&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
 Testing Guide v3 (draft 16th June 2008)&lt;br /&gt;
 Updated: 30th June 2008&lt;br /&gt;
 (new)--&amp;gt; new articles, (toimp)--&amp;gt; needs to improve or to review, (xxx%) --&amp;gt; current state of the article&lt;br /&gt;
&lt;br /&gt;
'''T A B L E    o f    C O N T E N T S'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|(toimp)Foreword by OWASP Chair]]==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |(toimp: M.Meucci)1. Frontispiece]]==&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|(toimp: M.Meucci)1.1 About the OWASP Testing Guide Project]]'''&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 90%) 2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.4.1 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Tests_Integrated_in_Developers_and_Testers_Workflow Security tests integrated in developers and testers workflows]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.4.2 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Developers.27_Security_Tests Developers' security tests: unit tests and component level tests]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 90%) 2.4.3 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_Testers.27_Security_Tests Functional testers' security tests: integrated system tests, tests in UAT, and production environment]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. (toimp:M.Meucci) Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| (new: M.Meucci) 4.1.1 Testing Checklist]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Information Gathering|'''(toimp: B.Damele) 4.2 Information Gathering''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders Robots and Crawlers|(new:C.Heinrich)4.2.1 Spiders, Robots and Crawlers]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery|(new:C.Heinrich)4.2.2 Search Engine Discovery/Reconnaissance]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points| (new: K.Horvath - 95%) 4.2.3 Identify application entry points]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application Fingerprint|4.2.4 (toimp) Testing for Web Application Fingerprint]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery|4.2.5 Application Discovery]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code|(toimp)4.2.6 Analysis of Error Codes]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management|''' (new) 4.3 Configuration Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSL-TLS|(toimp) 4.3.1 SSL/TLS Testing (SSL Version, Alghoritms, Key lenght, Digital Cert. Validity]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DB Listener|4.3.2 DB Listener Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management| (toimp) 4.3.3 Application Configuration Management Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for misconfiguration| (new) 4.3.4 Testing for misconfiguration]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling|4.3.5 Testing for File Extensions Handling]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for old_file|4.3.6 Old, backup and unreferenced files]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces|(new) 4.3.7 Infrastructure and Application Admin Interfaces]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST| 4.3.8 Testing for HTTP Methods and XST]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic|'''(toimp: K.Horvath - 90%) 4.4 Business Logic Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''(toimp: M.Meucci) 4.5 Authentication Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for credentials transport|(new: G.Ingrosso - 80%) 4.5.1 Credentials transport over an encrypted channel]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for user enumeration|(new: M.Meucci - 70%) 4.5.2 Testing for user enumeration]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Default or Guessable User Account|(to imp: K.Horvath - 95%) 4.5.3 Testing for Guessable (Dictionary) User Account]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Brute Force|4.5.4 Brute Force Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema|4.5.5 Testing for bypassing authentication schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password and Pwd Reset|4.5.7 Testing for vulnerable remember &lt;br /&gt;
password and pwd reset]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Logout and Browser Cache Management|4.5.8 Testing for Logout and Browser Cache Management Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha|(new: P.Luptak) 4.5.9 Testing for CAPTCHA]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''(new: M.Meucci - 90%) 4.6 Authorization testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Directory Traversal|4.6.1 (100%) Testing for directory traversal/file include]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema|(new: M.Meucci)4.6.2 Testing for bypassing authorization schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation|(new: Cecil Su, M.Meucci - 90%)4.6.3 Testing for Privilege Escalation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema|4.7.1 Testing for Session Management Schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cookie and Session Token Manipulation|(new)4.7.2 Test the token strength (old 4.5.2 Testing for Cookie and Session Token Manipulation)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes| (new: K.Horvath - 100%) 4.7.3 Testing for Cookies attributes]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation| (new: M.Meucci) 4.7.4. Testing for Session Fixation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables|4.7.5 Testing for Exposed Session Variables ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF|4.7.6 Testing for CSRF]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Exploit|4.7.7 Testing for HTTP Exploit ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting|(new: A. Coronel)4.8.1 Testing for Reflected Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting|(new: R. Suggi Liverani - 100%)4.8.2 Testing for Stored Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting|(new: A.Agarwwal, Kuza55) 4.8.3 Testing for DOM based Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing|(new: A.Agarwwal)4.8.4 Testing for Cross Site Flashing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection| (toimp: B.Damele) 4.8.5 Testing for SQL Injection ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.5.1 Oracle Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.5.2 MySQL Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.5.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for PostgreSQL|4.8.5.4 (new: D.Bellucci from OWASP BSP) Testing PostgreSQL]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection|4.8.6 Testing for LDAP Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection|4.8.7 Testing for ORM Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection|4.8.8 Testing for XML Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection|4.8.9 Testing for SSI Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection|4.8.10 Testing for XPath Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection|4.8.11 IMAP/SMTP Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection|4.8.12 Testing for Code Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection|4.8.13 Testing for Command Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow|4.8.14 Testing for Buffer overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.14.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.14.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.14.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability|4.8.15 Testing for incubated vulnerabilities]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Denial of Service|'''4.9 Testing for Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Wildcard Attacks|(new: F.Mavituna - 100%) 4.9.1 Testing for SQL Wildcard Attacks]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Locking Customer Accounts|4.9.2 Testing for DoS Locking Customer Accounts]]	&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Buffer Overflows|4.9.3 Testing for DoS Buffer Overflows]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS User Specified Object Allocation|4.9.4 Testing for DoS User Specified Object Allocation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for User Input as a Loop Counter|4.9.5 Testing for User Input as a Loop Counter]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Writing User Provided Data to Disk|4.9.6 Testing for Writing User Provided Data to Disk]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Failure to Release Resources|4.9.7 Testing for DoS Failure to Release Resources]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Storing too Much Data in Session|4.9.8 Testing for Storing too Much Data in Session]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Services|(toimp: D.Wichers) '''4.10 Web Services Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Structural|4.10.1 XML Structural Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Content-Level|4.10.2 XML Content-level Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for WS HTTP GET parameters/REST attacks|4.10.3 HTTP GET parameters/REST Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Naughty SOAP Attachments|4.10.4 Testing for Naughty SOAP attachments]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for WS Replay|4.10.5 WS Replay Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Client-Side Testing|(new: Pdp, O.Segal, S. Di Paola) '''4.11 Client side testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for AJAX|(new) 4.11.1 AJAX Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Flash Testing|(new)4.11.2 Flash Testing]]&lt;br /&gt;
&lt;br /&gt;
[[RIA Testing|(new)4.11.3 RIA Testing]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |(toimp: Mat)5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools&lt;br /&gt;
* Source Code Analyzers&lt;br /&gt;
* Other Tools&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers&lt;br /&gt;
* Books&lt;br /&gt;
* Useful Websites&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories&lt;br /&gt;
** Recursive fuzzing&lt;br /&gt;
** Replasive fuzzing&lt;br /&gt;
* Cross Site Scripting (XSS)&lt;br /&gt;
* Buffer Overflows and Format String Errors&lt;br /&gt;
** Buffer Overflows (BFO)&lt;br /&gt;
** Format String Errors (FSE)&lt;br /&gt;
** Integer Overflows (INT)&lt;br /&gt;
* SQL Injection&lt;br /&gt;
** Passive SQL Injection (SQP)&lt;br /&gt;
** Active SQL Injection (SQI)&lt;br /&gt;
* LDAP Injection&lt;br /&gt;
* XPATH Injection&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | (new: Harish S.)Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v3_Table_of_Contents&amp;diff=35536</id>
		<title>OWASP Testing Guide v3 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v3_Table_of_Contents&amp;diff=35536"/>
				<updated>2008-08-07T17:12:32Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* 4. (toimp:M.Meucci) Web Application Penetration Testing  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
This is the draft of table of content of the New Testing Guide.&lt;br /&gt;
You can download the stable version [http://www.owasp.org/index.php/Image:OWASP_Testing_Guide_v2_pdf.zip here] or read it on line [http://www.owasp.org/index.php/OWASP_Testing_Guide_v2_Table_of_Contents here]&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
 Testing Guide v3 (draft 16th June 2008)&lt;br /&gt;
 Updated: 30th June 2008&lt;br /&gt;
 (new)--&amp;gt; new articles, (toimp)--&amp;gt; needs to improve or to review, (xxx%) --&amp;gt; current state of the article&lt;br /&gt;
&lt;br /&gt;
'''T A B L E    o f    C O N T E N T S'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|(toimp)Foreword by OWASP Chair]]==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |(toimp: M.Meucci)1. Frontispiece]]==&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|(toimp: M.Meucci)1.1 About the OWASP Testing Guide Project]]'''&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 90%) 2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.4.1 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Tests_Integrated_in_Developers_and_Testers_Workflow Security tests integrated in developers and testers workflows]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.4.2 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Developers.27_Security_Tests Developers' security tests: unit tests and component level tests]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 90%) 2.4.3 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_Testers.27_Security_Tests Functional testers' security tests: integrated system tests, tests in UAT, and production environment]&lt;br /&gt;
&lt;br /&gt;
(new: M. Morana 100%) 2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. (toimp:M.Meucci) Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| (new: M.Meucci) 4.1.1 Testing Checklist]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Information Gathering|'''(toimp: B.Damele) 4.2 Information Gathering''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders Robots and Crawlers|(new:C.Heinrich)4.2.1 Spiders, Robots and Crawlers]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery|(new:C.Heinrich)4.2.2 Search Engine Discovery/Reconnaissance]]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points| (new: K.Horvath - 95%) 4.2.3 Identify application entry points]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application Fingerprint|4.2.4 (toimp) Testing for Web Application Fingerprint]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery|4.2.5 Application Discovery]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code|(toimp)4.2.6 Analysis of Error Codes]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management|''' (new) 4.3 Configuration Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSL-TLS|(toimp) 4.3.1 SSL/TLS Testing (SSL Version, Alghoritms, Key lenght, Digital Cert. Validity]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DB Listener|4.3.2 DB Listener Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management| (toimp) 4.3.3 Application Configuration Management Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for misconfiguration| (new) 4.3.4 Testing for misconfiguration]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling|4.3.5 Testing for File Extensions Handling]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for old_file|4.3.6 Old, backup and unreferenced files]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces|(new) 4.3.7 Infrastructure and Application Admin Interfaces]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST| 4.3.8 Testing for HTTP Methods and XST]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic|'''(toimp: K.Horvath - 90%) 4.4 Business Logic Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''(toimp: M.Meucci) 4.5 Authentication Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for credentials transport|(new: G.Ingrosso - 80%) 4.5.1 Credentials transport over an encrypted channel]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for user enumeration|(new: M.Meucci - 70%) 4.5.2 Testing for user enumeration]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Default or Guessable User Account|(to imp: K.Horvath - 95%) 4.5.3 Testing for Guessable (Dictionary) User Account]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Brute Force|4.5.4 Brute Force Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema|4.5.5 Testing for bypassing authentication schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password and Pwd Reset|4.5.7 Testing for vulnerable remember &lt;br /&gt;
password and pwd reset]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Logout and Browser Cache Management|4.5.8 Testing for Logout and Browser Cache Management Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha|(new: P.Luptak) 4.5.9 Testing for CAPTCHA]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''(new: M.Meucci - 90%) 4.6 Authorization testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Directory Traversal|4.6.1 (100%) Testing for directory traversal/file include]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema|(new: M.Meucci)4.6.2 Testing for bypassing authorization schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation|(new: Cecil Su, M.Meucci - 90%)4.6.3 Testing for Privilege Escalation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema|4.7.1 Testing for Session Management Schema]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cookie and Session Token Manipulation|(new)4.7.2 Test the token strength (old 4.5.2 Testing for Cookie and Session Token Manipulation)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookie attributes| (new: K.Horvath - 100%) 4.7.3 Testing for Cookie attributes]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation| (new: M.Meucci) 4.7.4. Testing for Session Fixation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables|4.7.5 Testing for Exposed Session Variables ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF|4.7.6 Testing for CSRF]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Exploit|4.7.7 Testing for HTTP Exploit ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting|(new: A. Coronel)4.8.1 Testing for Reflected Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting|(new: R. Suggi Liverani - 100%)4.8.2 Testing for Stored Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting|(new: A.Agarwwal, Kuza55) 4.8.3 Testing for DOM based Cross Site Scripting]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing|(new: A.Agarwwal)4.8.4 Testing for Cross Site Flashing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection| (toimp: B.Damele) 4.8.5 Testing for SQL Injection ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.5.1 Oracle Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.5.2 MySQL Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.5.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for PostgreSQL|4.8.5.4 (new: D.Bellucci from OWASP BSP) Testing PostgreSQL]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection|4.8.6 Testing for LDAP Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection|4.8.7 Testing for ORM Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection|4.8.8 Testing for XML Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection|4.8.9 Testing for SSI Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection|4.8.10 Testing for XPath Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection|4.8.11 IMAP/SMTP Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection|4.8.12 Testing for Code Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection|4.8.13 Testing for Command Injection]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow|4.8.14 Testing for Buffer overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.14.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.14.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.14.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability|4.8.15 Testing for incubated vulnerabilities]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Denial of Service|'''4.9 Testing for Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Wildcard Attacks|(new: F.Mavituna - 100%) 4.9.1 Testing for SQL Wildcard Attacks]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Locking Customer Accounts|4.9.2 Testing for DoS Locking Customer Accounts]]	&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Buffer Overflows|4.9.3 Testing for DoS Buffer Overflows]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS User Specified Object Allocation|4.9.4 Testing for DoS User Specified Object Allocation]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for User Input as a Loop Counter|4.9.5 Testing for User Input as a Loop Counter]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Writing User Provided Data to Disk|4.9.6 Testing for Writing User Provided Data to Disk]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for DoS Failure to Release Resources|4.9.7 Testing for DoS Failure to Release Resources]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Storing too Much Data in Session|4.9.8 Testing for Storing too Much Data in Session]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Services|(toimp: D.Wichers) '''4.10 Web Services Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Structural|4.10.1 XML Structural Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Content-Level|4.10.2 XML Content-level Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for WS HTTP GET parameters/REST attacks|4.10.3 HTTP GET parameters/REST Testing ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Naughty SOAP Attachments|4.10.4 Testing for Naughty SOAP attachments]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for WS Replay|4.10.5 WS Replay Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Client-Side Testing|(new: Pdp, O.Segal, S. Di Paola) '''4.11 Client side testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for AJAX|(new) 4.11.1 AJAX Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Flash Testing|(new)4.11.2 Flash Testing]]&lt;br /&gt;
&lt;br /&gt;
[[RIA Testing|(new)4.11.3 RIA Testing]]&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |(toimp: Mat)5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools&lt;br /&gt;
* Source Code Analyzers&lt;br /&gt;
* Other Tools&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers&lt;br /&gt;
* Books&lt;br /&gt;
* Useful Websites&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories&lt;br /&gt;
** Recursive fuzzing&lt;br /&gt;
** Replasive fuzzing&lt;br /&gt;
* Cross Site Scripting (XSS)&lt;br /&gt;
* Buffer Overflows and Format String Errors&lt;br /&gt;
** Buffer Overflows (BFO)&lt;br /&gt;
** Format String Errors (FSE)&lt;br /&gt;
** Integer Overflows (INT)&lt;br /&gt;
* SQL Injection&lt;br /&gt;
** Passive SQL Injection (SQP)&lt;br /&gt;
** Active SQL Injection (SQI)&lt;br /&gt;
* LDAP Injection&lt;br /&gt;
* XPATH Injection&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | (new: Harish S.)Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=34641</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=34641"/>
				<updated>2008-07-24T16:12:24Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex example that the author has come across in the wild pertains to a commercial financial application that a large institution uses for their business customers.  This application provides banking ACH (Automated Clearing House) electronic funds transfer and payment services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts for their company in which they can create users at different privilege levels, such as one user can make transfers, another can approve the transfers (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this new account.  The userids' that are created are predictable. For example, if an admin from a fictitious customer of &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 115 and 116.  To make things worse if two more accounts are created and their respective userids' are 117 and 119 then it can be assumed that another company's admin has created a user account for their company with the userid of 118.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed within a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 0 and incrementing by 1), which allows userids to be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, it is possible to break the logic of the application.  Now that an account for a user of a different company has been enumerated (remember userid 118 from above), lets create another user account of our own with limited privileges to only being able to transfer funds internally and update our user preferences.  When this new user account is created it is assigned a userid of 120.  If we login with this newly created account we can't do anything but update our own user preferences and make limited transfers internally.  If we make any change to this users profile the userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 118 of our enumerated account that belongs to a different company, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account (since it is now associated with our company), and secondly we can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc) now that this userid is associated to our company.  The applications logic saw a request from an authorized user (via a valid session token) but did not cross reference this valid token to see if the userid really belonged to this company.  Since it didn't cross check that the userid that was submitted in the request belonged to the current authorized users company, it went ahead and associated that userid to the current company of the authorized user.&lt;br /&gt;
&lt;br /&gt;
Now lets take this a step further.  If a new customer is given two admin accounts with the userids starting at 113 and 114 for our current company. What would happen if we automated the attack above (i.e. sending an authenticated request with a different userid) with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 112.  If this was completed then our company would now have 113 new accounts, of which many could be admin accounts, user accounts with different privileges, etc. We could now run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Although once the account was removed from the previous company and was added to our company we lost the capability to transfer money using the accounts of the other companies.  Regardless, the damage has been done since no other company can access the banking application using these accounts any longer since they now belong to our company.  Effectively a complete DoS for every company but ours and we can now harvest a lot of sensitive information from these accounts previous transactions by running reports for users within our current company.&lt;br /&gt;
&lt;br /&gt;
As you can see the break down within the business logic was due to assumptions made by the developers and how the application reacted when it received unexpected data.  The first is the assumption that the developers made in which all data passed with the body of a POST request was valid (the userid) without verifying it on the server-side before processing it.  Secondly since the application did not verify that the authentication/authorization session token (a cookie in this scenario) for a user within one company matched as a valid userid for that same company, then the applications logic broke down.  In this scenario once the users profile was updated using the current users session token and another users userid (for a different company) it took the others users account from the victim company and moved it to the current users company.  &lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user attempts to exploit it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
'''Intercepting Proxy:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*OWASP: Webscarab -&lt;br /&gt;
http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
*Dafydd Stuttard: Burp proxy -&lt;br /&gt;
http://portswigger.net/proxy/&lt;br /&gt;
*MileSCAN: Paros Proxy - &lt;br /&gt;
http://www.parosproxy.org/download.shtml&lt;br /&gt;
&lt;br /&gt;
'''Browser Plug-in:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;quot;TamperIE&amp;quot; for Internet Explorer - &lt;br /&gt;
http://www.bayden.com/TamperIE/&lt;br /&gt;
*Adam Judson: &amp;quot;Tamper Data&amp;quot; for Firefox -&lt;br /&gt;
https://addons.mozilla.org/en-US/firefox/addon/966&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=34178</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=34178"/>
				<updated>2008-07-16T17:57:22Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commercial banking application that a large financial institution uses for their business customers.  This application provides banking ACH (Automated Clearing House) electronic funds transfer and payment services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts for their company in which they can create users at different privilege levels, such as one user can make transfers, another can approve the transfers (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this new account.  The userids' that are created are predictable. For example, if an admin for example from a fictitious customer of &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 815 and 816.  To make things worse if two more accounts are created and their respective userids' are 817 and 819 then it can be assumed that another company's admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed within a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 0 and incrementing by 1), which allows userids to be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, it is possible to break the logic of the application.  Now that an account for a user of a different company has been enumerated (remember userid 818 from above), lets create another user account of our own with limited privileges to only being able to transfer funds internally and update our user preferences.  When this new user account is created it is assigned a userid of 820.  If we login with this newly created account of ours we can't do anything but update our own user preferences and make limited transfers internally.  If we make any change to this users profile the userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account that belongs to a different company, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account (since it is now associated with our company), and secondly we can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc) now that this userid is associated to our company.  The applications logic saw a request from an authorized user (via a valid session token) but did not cross reference this valid token to see if the userid really belonged to this company.  Since it didn't cross check that the userid that was submitted in the request belonged to the current authorized users company, it went ahead and associated that userid to the current company of the authorized user.&lt;br /&gt;
&lt;br /&gt;
Now lets take this a step further.  If a new customer is given two admin accounts with the userids starting at 813 and 814 for our current company. What would happen if we automated the attack above (i.e. sending an authenticated request with a different userid) with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 812.  If this was completed then our company would now have 813 new accounts, of which many could be admin accounts, user accounts with different privileges, etc. We could now run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Although once the account was removed from the previous company and was added to our company we lost the capability to transfer money using the accounts of the other companies.  Regardless, the damage has been done since no other company can access the banking application using these accounts any longer since they now belong to our company.  Effectively a complete DoS for every company but ours and we can now harvest a lot of sensitive information from these accounts previous transactions by running reports for users within our current company.&lt;br /&gt;
&lt;br /&gt;
As you can see the break down within the business logic was due to assumptions made by the developers and how the application reacted when it received unexpected data.  The first is the assumption that the developers made in which all data passed with the body of a POST request was valid (the userid) without verifying it on the server-side before processing it.  Secondly since the application did not verify that the authentication/authorization session token (a cookie in this scenario) for a user within one company matched as a valid userid for that same company, then the applications logic broke down.  In this scenario once the users profile was updated using the current users session token and another users userid (for a different company) it took the others users account from the victim company and moved it to the current users company.  &lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user attempts to exploit it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
'''Intercepting Proxy:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*OWASP: Webscarab -&lt;br /&gt;
http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
*Dafydd Stuttard: Burp proxy -&lt;br /&gt;
http://portswigger.net/proxy/&lt;br /&gt;
*MileSCAN: Paros Proxy - &lt;br /&gt;
http://www.parosproxy.org/download.shtml&lt;br /&gt;
&lt;br /&gt;
'''Browser Plug-in:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;quot;TamperIE&amp;quot; for Internet Explorer - &lt;br /&gt;
http://www.bayden.com/TamperIE/&lt;br /&gt;
*Adam Judson: &amp;quot;Tamper Data&amp;quot; for Firefox -&lt;br /&gt;
https://addons.mozilla.org/en-US/firefox/addon/966&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=33614</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=33614"/>
				<updated>2008-07-07T19:12:20Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means were able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then he/she could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple requests.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent requests especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple other cookies used to identify the items you wish to purchase and their auxiliary information (i.e. price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; let's take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over both HTTP and HTTPS then there is the potential that the cookie can be sent in clear text.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if it is a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set too loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set too loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the application cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set too loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set too loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path that matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the user's hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2965 - HTTP State Management Mechanism -&lt;br /&gt;
http://tools.ietf.org/html/rfc2965&lt;br /&gt;
&lt;br /&gt;
*RFC 2616 – Hypertext Transfer Protocol – HTTP 1.1 - &lt;br /&gt;
http://tools.ietf.org/html/rfc2616&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Intercepting Proxy:'''&lt;br /&gt;
&lt;br /&gt;
*OWASP: Webscarab - &lt;br /&gt;
http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
&lt;br /&gt;
*Dafydd Stuttard: Burp proxy - &lt;br /&gt;
http://portswigger.net/proxy/&lt;br /&gt;
&lt;br /&gt;
*MileSCAN: Paros Proxy - &lt;br /&gt;
http://www.parosproxy.org/download.shtml&lt;br /&gt;
&lt;br /&gt;
'''Browser Plug-in:'''&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;TamperIE&amp;quot; for Internet Explorer - &lt;br /&gt;
http://www.bayden.com/TamperIE/&lt;br /&gt;
&lt;br /&gt;
*Adam Judson: &amp;quot;Tamper Data&amp;quot; for Firefox - &lt;br /&gt;
https://addons.mozilla.org/en-US/firefox/addon/966&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=33611</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=33611"/>
				<updated>2008-07-07T19:05:13Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web applications typically run on popular open source or commercial software, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc. offer web-based configuration or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom, open source, or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often:&lt;br /&gt;
* inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components &lt;br /&gt;
* programmers, who leave backdoors to easily access and test their application and later forget to remove them&lt;br /&gt;
* application administrators and users that choose an easy username and password for themselves &lt;br /&gt;
* applications with built-in, non-removable default accounts with a pre-set username and password. &lt;br /&gt;
Another problem is blank passwords, which are simply the result of a lack of security awareness or a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  Such as, can a user create their own account or does the system create an account for the user based on some personal information or a predictable sequence.  If the application does create its own accounts in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
* If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/passwords&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Burp Intruder: http://portswigger.net/intruder/&lt;br /&gt;
* THC Hydra: http://www.thc.org/thc-hydra/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=33606</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=33606"/>
				<updated>2008-07-07T18:03:30Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web applications typically run on popular open source or commercial software, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc. offer web-based configuration or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom, open source, or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often:&lt;br /&gt;
* inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components &lt;br /&gt;
* programmers, who leave backdoors to easily access and test their application and later forget to remove them&lt;br /&gt;
* application administrators and users that choose an easy username and password for themselves &lt;br /&gt;
* applications with built-in, non-removable default accounts with a pre-set username and password. &lt;br /&gt;
Another problem is blank passwords, which are simply the result of a lack of security awareness or a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  Such as, can a user create their own account or does the system create an account for the user based on some personal information or a predictable sequence.  If the application does create its own accounts in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
* If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/passwords&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* THC Hydra: http://www.thc.org/thc-hydra/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=33605</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=33605"/>
				<updated>2008-07-07T17:52:28Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commercial banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userids that are created are predictable, for example: if an admin for example from a fictitious customer &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 815 and 816.  To make things worse if two more accounts are created and their respective userids are 817 and 819 then it can be assumed that another company's admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed in a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), in addition, other user's userids can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned userid 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since the userids started at 813 and 814 what would happen if we automated this attack with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 812.  If this was completed then our company would now have 813 new accounts, of which many could be admin accounts. We could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Although once the account was removed from the previous company and was added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless, the damage has been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
As you can see the break down within the business logic was due to assumptions made by the developers and how the application reacted when it received unexpected data.  The first is the assumption that the developers made in which all data passed with the body of a POST request was valid (the userid) without verifying it on the server-side before processing it.  Secondly since the application did not verify that the authentication/authorization session token (a cookie in this scenario) for a user within one company matched as a valid userid for that same company, then the applications logic broke down.  In this scenario once the users profile was updated using the current users session token and another users id (for a different company) it took the others users account from the other victim company and moved it to the current users company.  &lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
'''Intercepting Proxy:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*OWASP: Webscarab -&lt;br /&gt;
http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
*Dafydd Stuttard: Burp proxy -&lt;br /&gt;
http://portswigger.net/proxy/&lt;br /&gt;
*MileSCAN: Paros Proxy - &lt;br /&gt;
http://www.parosproxy.org/download.shtml&lt;br /&gt;
&lt;br /&gt;
'''Browser Plug-in:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;quot;TamperIE&amp;quot; for Internet Explorer - &lt;br /&gt;
http://www.bayden.com/TamperIE/&lt;br /&gt;
*Adam Judson: &amp;quot;Tamper Data&amp;quot; for Firefox -&lt;br /&gt;
https://addons.mozilla.org/en-US/firefox/addon/966&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=33604</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=33604"/>
				<updated>2008-07-07T17:49:56Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before any testing begins always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP requests (GET and POST Methods also known as Verbs) as well as every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST requests are used to pass parameters.  It is very common that GET requests will be used, but when sensitive information is passed it will often be done within the body of a POST request.  Note that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc. that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point the tester usually traps every request and response so that they can see exactly every header, parameter, etc. that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if it's part of a multi-step process, and any other relevant notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below are some points of interests for all requests and responses.  Within the requests section focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing those HTTP Methods.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
* Identify where GETs are used and where POSTs are used&lt;br /&gt;
* Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
* Within the POST request pay special attention to any hidden parameters.  When a POST is sent all the form fields (including hidden parameters) will be sent in the body of the HTTP message to the application.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of the hidden parameter(s).&lt;br /&gt;
* Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
* Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
* A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  Later sections of the guide will identify how to test these parameters, at this point just make sure you identify each one of them.&lt;br /&gt;
* Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also note where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
The following are 2 examples on how to check for application entry points.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state).&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application.&lt;br /&gt;
&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
Body of the POST message:&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources from which the application receives data and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept or expect user input and how it's formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2616 – Hypertext Transfer Protocol – HTTP 1.1 -&lt;br /&gt;
http://tools.ietf.org/html/rfc2616&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Intercepting Proxy:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*OWASP: Webscarab -&lt;br /&gt;
http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
*Dafydd Stuttard: Burp proxy -&lt;br /&gt;
http://portswigger.net/proxy/&lt;br /&gt;
*MileSCAN: Paros Proxy - &lt;br /&gt;
http://www.parosproxy.org/download.shtml&lt;br /&gt;
&lt;br /&gt;
'''Browser Plug-in:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;quot;TamperIE&amp;quot; for Internet Explorer - &lt;br /&gt;
http://www.bayden.com/TamperIE/&lt;br /&gt;
*Adam Judson: &amp;quot;Tamper Data&amp;quot; for Firefox -&lt;br /&gt;
https://addons.mozilla.org/en-US/firefox/addon/966&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=33598</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=33598"/>
				<updated>2008-07-07T16:16:34Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before any testing begins always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP requests (GET and POST Methods also known as Verbs) as well as every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST requests are used to pass parameters.  It is very common that GET requests will be used, but when sensitive information is passed it will often be done within the body of a POST request.  Note that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc. that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point the tester usually traps every request and response so that they can see exactly every header, parameter, etc. that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if it's part of a multi-step process, and any other relevant notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below are some points of interests for all requests and responses.  Within the requests section focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing those HTTP Methods.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
* Identify where GETs are used and where POSTs are used&lt;br /&gt;
* Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
* Within the POST request pay special attention to any hidden parameters.  When a POST is sent all the form fields (including hidden parameters) will be sent in the body of the HTTP message to the application.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of the hidden parameter(s).&lt;br /&gt;
* Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
* Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
* A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  Later sections of the guide will identify how to test these parameters, at this point just make sure you identify each one of them.&lt;br /&gt;
* Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also note where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
The following are 2 examples on how to check for application entry points.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state).&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application.&lt;br /&gt;
&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
Body of the POST message:&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources from which the application receives data and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept or expect user input and how it's formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=33576</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=33576"/>
				<updated>2008-07-07T07:58:51Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2965 - HTTP State Management Mechanism&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=32538</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=32538"/>
				<updated>2008-06-27T13:27:02Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2965 - HTTP State Management Mechanism&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32537</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32537"/>
				<updated>2008-06-27T13:24:04Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commercial banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userids that are created are predictable, for example: if an admin for example from a fictitious customer &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 815 and 816.  To make things worse if two more accounts are created and their respective userids are 817 and 819 then it can be assumed that another company's admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed in a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), in addition, other user's userids can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned userid 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since the userids started at 813 and 814 what would happen if we automated this attack with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 812.  If this was completed then our company would now have 813 new accounts, of which many could be admin accounts. We could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Although once the account was removed from the previous company and was added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless, the damage has been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
As you can see the break down within the business logic was due to assumptions made by the developers and how the application reacted when it received unexpected data.  The first is the assumption that the developers made in which all data passed with the body of a POST request was valid (the userid) without verifying it on the server-side before processing it.  Secondly since the application did not verify that the authentication/authorization session token (a cookie in this scenario) for a user within one company matched as a valid userid for that same company, then the applications logic broke down.  In this scenario once the users profile was updated using the current users session token and another users id (for a different company) it took the others users account from the other victim company and moved it to the current users company.  &lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32536</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32536"/>
				<updated>2008-06-27T13:22:01Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commercial banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userids that are created are predictable, for example: if an admin for example from a fictitious customer &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 815 and 816.  To make things worse if two more accounts are created and their respective userids are 817 and 819 then it can be assumed that another company's admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed in a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), in addition, other user's userids can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned userid 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since the userids started at 813 and 814 what would happen if we automated this attack with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 812.  If this was completed then our company would now have 813 new accounts, of which many could be admin accounts. We could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Although once the account was removed from the previous company and was added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless, the damage has been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
As you can see the break down within the business logic was due to assumptions made by the developers and how the application reacted when it received unexpected data.  The first is the assumption that the developers made in which all data passed with the body of a POST request was valid (the userid) without verifying it on the server-side before processing it.  Secondly since the application did not verify that the authentication/authorization (session) token (cookie in this scenario) for a user within one company matched as a valid userid for that same company, then the applications logic broke down.  In this scenario once the users profile was updated using the current users session token and another users id (for a different company) it took the others users account from the other victim company and moved it to the current users company.  &lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32535</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=32535"/>
				<updated>2008-06-27T12:58:49Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability cannot be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same time usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic comprises may include: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows based on the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
Attacks on the business logic of an application are dangerous, difficult to detect, and are usually specific to the application being tested.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is intended? Or perhaps users are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the application's logic and pay huge dividends.  The first example starts with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application. (Note that this was a real world application penetration test, so complete destruction was not actually carried out but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better understanding of the limits and intended functionality of the application before the actual test begins.  Additionally, having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the application's functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commercial banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userids that are created are predictable, for example: if an admin for &amp;quot;Spacely Sprockets&amp;quot; creates two accounts consecutively their respective userids will be 815 and 816.  To make things worse if two more accounts are created and their respective userids are 817 and 819 then it can be assumed that another company's admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers assume that no one would ever see or attempt to manipulate the userid that was associated with the username when the account was created (since it was passed in a POST request).  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), in addition, other user's userids can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers' misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned userid 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the company's user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since our userids started at 813 and 814 what would happen if we automated this attack with a fuzzer utilizing the same request but starting at userid 0 and incrementing to 812.  If this was completed then our company would now have 813 new accounts, of which many could be admin accounts. We could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Unfortunately once the account was removed from the previous company and added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless the damage has been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the application's logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is one suggested approach:&lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as Marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various user privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint(s)?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (e.g. Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve reports submitted by his subordinate(s) || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from their own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own payslip || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical tests. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with less privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of sync can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the back-end logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for alternate ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions/privileges&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, and query string parameters being passed&lt;br /&gt;
* Try and subvert the expected process/flow by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customer “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the malicious user started sending hundreds of emails to their FlawedPhone email account&lt;br /&gt;
* The malicious user had an ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the malicious user had accumulated ~50-100  € on the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the customer list synchronization time combined with the lack of limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.  With this said a tool that can allow you to view and modify all requests is extremely valuable. Below is a small listing of each type:&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User_talk:Rick.mitchell&amp;diff=32534</id>
		<title>User talk:Rick.mitchell</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User_talk:Rick.mitchell&amp;diff=32534"/>
				<updated>2008-06-27T12:46:28Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: New section: modifications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yes I'll try to check it from time to time. Just hit the + above and add a section. [[User:Rick.mitchell|Rick.mitchell]] 09:28, 28 May 2008 (EDT)&lt;br /&gt;
&lt;br /&gt;
== modifications ==&lt;br /&gt;
&lt;br /&gt;
Rick,&lt;br /&gt;
&lt;br /&gt;
Thank you for reviewing and making modifications to my sections.  I was going to go back and change my writing style from first person to third person as the group agreed but you already did it.  Thanks.&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=32533</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=32533"/>
				<updated>2008-06-27T12:42:40Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before any testing begins always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP requests (GET and POST Methods also known as Verbs) as well as every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST requests are used to pass parameters.  It is very common that GET requests will be used, but when sensitive information is passed it will often be done within the body of a POST request.  Note that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc. that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point the tester usually traps every request and response so that they can see exactly every header, parameter, etc. that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if it's part of a multi-step process, and any other relevant notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below are some points of interests for all requests and responses.  Within the requests section focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing those HTTP Methods.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
* Identify where GETs are used and where POSTs are used&lt;br /&gt;
* Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
* Within the POST request pay special attention to any hidden parameters.  When a POST is sent all the form fields (including hidden parameters) will be sent in the body of the HTTP message to the application.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of the hidden parameter(s).&lt;br /&gt;
* Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
* Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
* A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  Later sections of the guide will identify how to test these parameters, at this point just make sure you identify each one of them.&lt;br /&gt;
* Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also note where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state).&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application.&lt;br /&gt;
&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
Body of the POST message:&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources from which the application receives data and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept or expect user input and how it's formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy (for example OWASP's Webscarab, Burp proxy, or Paros Proxy)&lt;br /&gt;
*Browser Plug-in (for example TamperIE for Internet Explorer or Tamper Data for Firefox)&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Identify_application_entry_points_(OTG-INFO-006)&amp;diff=32532</id>
		<title>Talk:Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Identify_application_entry_points_(OTG-INFO-006)&amp;diff=32532"/>
				<updated>2008-06-27T12:40:54Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: New section: plugin vague&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;Browser Plug-in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In the tools section seems awfully vague.&lt;br /&gt;
&lt;br /&gt;
== plugin vague ==&lt;br /&gt;
&lt;br /&gt;
i will add a couple examples of tools.....was trying to avoid this to stay objective.&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Testing_for_business_logic&amp;diff=32486</id>
		<title>Talk:Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Testing_for_business_logic&amp;diff=32486"/>
				<updated>2008-06-27T02:45:36Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of Issues - Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description of Issues - Example 2 ==&lt;br /&gt;
&lt;br /&gt;
There something missing in Example 2. You've jumped from altering preferences to taking ownership of accounts.&lt;br /&gt;
&lt;br /&gt;
I can understand that if I was editing preferences and sent userid 818 I'd alter the preferences of another company's user but how would ownership of that account change? [[User:Rick.mitchell|Rick.mitchell]] 08:42, 25 June 2008 (EDT)&lt;br /&gt;
&lt;br /&gt;
I see your assumption but the application was so flawed that when you updated a users account and changed the users id it didn't change the other users preferences but assign that id to your companies account.  There is a session token that is used so if this is unchanged and the userid is changed when the account is updated then the application will assign it to your company (ie the flawed logic).  I will try to make this more clear in the example.&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30955</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30955"/>
				<updated>2008-06-11T07:30:47Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* A real world example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability can not be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same standpoint usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic type of comprises: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows that are the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
The attacks on the business logic of an application are dangerous, difficult to detect and specific to that application.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is allowed? Or perhaps you are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic security checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the applications logic and pay huge dividends.  The following examples start with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application (Note that this was a real world application penetration test so complete destruction was not actually implemented but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better of the limits and intended functionality of the application before the actual test begins.  Additionally having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the applications functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commerical banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userid's that are created are predictable, whereas if an admin for Spacely Sprockets creates two accounts consecutively their respective userid's will be 815 and 816, for example.  To make things worse if two more  accounts are created and thier respective userid's are 817 and 819 then it can be assumed that another companies admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers were under the assumption that no one would ever see the userid that was associated with the username when the account was created (since it was passed in a POST request) or especially try to manipulate this userid parameter.  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), and in addition other users userid's can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned the userid of 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the companies user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since our userids' started at 813 and 814 what would happen if we automated this attack using a fuzzer utilizing the same request but started at userid 0 and incremented to 812.  If this was completed then our company would now have 813 new accounts, in which many of them would be admin accounts, and we could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Unfortunately once the account was removed from the previous company and added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless the damage as been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the applications logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is a suggested approach that consists of:  &lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various users privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve report submitted by his subordinate || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical threats. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with minimum privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of synch can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the backend logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for all alternative ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, query string parameters being passed&lt;br /&gt;
* Try and subvert it by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe another real world case that was investigated by one of the authors in 2006.  &lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customers “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the attacker started sending hundreds of emails to her FlawedPhone email account&lt;br /&gt;
* The attacker had a ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the attacker had ~50-100  € in the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the synchronization time, combined with the lack of a limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30954</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30954"/>
				<updated>2008-06-11T07:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability can not be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same standpoint usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic type of comprises: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows that are the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
The attacks on the business logic of an application are dangerous, difficult to detect and specific to that application.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is allowed? Or perhaps you are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic security checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the applications logic and pay huge dividends.  The following examples start with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application (Note that this was a real world application penetration test so complete destruction was not actually implemented but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better of the limits and intended functionality of the application before the actual test begins.  Additionally having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the applications functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commerical banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userid's that are created are predictable, whereas if an admin for Spacely Sprockets creates two accounts consecutively their respective userid's will be 815 and 816, for example.  To make things worse if two more  accounts are created and thier respective userid's are 817 and 819 then it can be assumed that another companies admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
&lt;br /&gt;
The business logic error here is that the developers were under the assumption that no one would ever see the userid that was associated with the username when the account was created (since it was passed in a POST request) or especially try to manipulate this userid parameter.  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), and in addition other users userid's can be enumerated within the application.&lt;br /&gt;
&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned the userid of 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the companies user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since our userids' started at 813 and 814 what would happen if we automated this attack using a fuzzer utilizing the same request but started at userid 0 and incremented to 812.  If this was completed then our company would now have 813 new accounts, in which many of them would be admin accounts, and we could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Unfortunately once the account was removed from the previous company and added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless the damage as been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the applications logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is a suggested approach that consists of:  &lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various users privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve report submitted by his subordinate || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical threats. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with minimum privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of synch can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the backend logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for all alternative ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, query string parameters being passed&lt;br /&gt;
* Try and subvert it by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe a real world case that was investigated by one of the authors in 2006.&lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customers “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the attacker started sending hundreds of emails to her FlawedPhone email account&lt;br /&gt;
* The attacker had a ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the attacker had ~50-100  € in the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the synchronization time, combined with the lack of a limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30953</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30953"/>
				<updated>2008-06-11T07:19:55Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability can not be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same standpoint usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic type of comprises: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows that are the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
The attacks on the business logic of an application are dangerous, difficult to detect and specific to that application.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is allowed? Or perhaps you are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic security checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.  The following two examples will illustrate how understanding the functionality of the application, the developers intentions, and some creative &amp;quot;out-of-the-box&amp;quot; thinking can break the applications logic and pay huge dividends.  The following examples start with a simplistic parameter manipulation, whereas the second is a real world example of a multi-step process leading to complete destruction of the application (Note that this was a real world application penetration test so complete destruction was not actually implemented but a proof of concept was done instead).&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.  Sometimes in very complex applications you will not have a full understanding of every aspect of the application initially.  In these situations it is best to have the client walk you through the application so that you may gain a better of the limits and intended functionality of the application before the actual test begins.  Additionally having a direct line to the developers (if possible) while the testing proceeds will help out greatly if any questions arise regarding the applications functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1''': &lt;br /&gt;
&lt;br /&gt;
Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': &lt;br /&gt;
&lt;br /&gt;
Another more complex real world example that the author has come across in the wild pertains to a commerical banking application that many large financial institutions employ for their business customers.  This application provides banking ACH electronic debit and credit services to its business customers.  Initially when a business purchases this service they are provided two administrative level accounts in which they can create users at different privilege levels, such as one user can make purchases, another can approve purchases (such as a manager) over a designated dollar amount, etc.  When a user is created by an administrator account a new userid is associated with this account.  The userid's that are created are predictable, whereas if an admin for Spacely Sprockets creates two accounts consecutively their respective userid's will be 815 and 816, for example.  To make things worse if two more  accounts are created and thier respective userid's are 817 and 819 then it can be assumed that another companies admin has created a user account for their company with the userid of 818.  &lt;br /&gt;
The business logic error here is that the developers were under the assumption that no one would ever see the userid that was associated with the username when the account was created (since it was passed in a POST request) or especially try to manipulate this userid parameter.  To make things worse this parameter is predictable (a linear sequence of numbers initiating from 1 and incrementing by 1), and in addition other users userid's can be enumerated within the application.&lt;br /&gt;
With the understanding of how the application functions and the understanding of the developers misguided assumptions, lets try to break the logic of the application.  Now that we have enumerated an account for a user of a different company (remember userid 818 from above), lets create another user account of our own with very limited privileges.  When the user account is created we are assigned the userid of 820.  If we login with this newly created account we can't do anything but update our own user preferences within our profile.  If we make any change to our profile our userid is submitted to the application with our preference change.  If we trap this request within our intercepting proxy and change the userid to 818 of our enumerated account, then that user is effectively removed from the other company and added to our company.  Two things will result from this.  This will perform a denial of service for the other customer since they can no longer access this account, and secondly a user account that initially had no privileges can now run reports and see every transaction that the companies user performed (including money transfers with bank account numbers, routing numbers, balances, etc).  Now lets take this a step further.  Since our userids' started at 813 and 814 what would happen if we automated this attack using a fuzzer utilizing the same request but started at userid 0 and incremented to 812.  If this was completed then our company would now have 813 new accounts, in which many of them would be admin accounts, and we could run as many reports as we like harvesting account numbers, routing numbers (of individuals and other companies), personal information, etc.  Unfortunately once the account was removed from the previous company and added to our company we lost the capability to transfer money using the accounts of the previous company.  Regardless the damage as been done since no other company can access the banking application any longer (effectively a complete DoS for every company but ours), and we can harvest all sensitive information from previous transactions.&lt;br /&gt;
This example shows how understanding the functionality of the application, the intentions of the developers, and some creative thinking can break the applications logic and pay huge dividends.  Thankfully we are ethical penetration testers and can inform our clients of this vulnerability and remediate it before a malicious user exploits it.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is a suggested approach that consists of:  &lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various users privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve report submitted by his subordinate || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical threats. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with minimum privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of synch can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the backend logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for all alternative ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, query string parameters being passed&lt;br /&gt;
* Try and subvert it by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe a real world case that was investigated by one of the authors in 2006.&lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customers “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the attacker started sending hundreds of emails to her FlawedPhone email account&lt;br /&gt;
* The attacker had a ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the attacker had ~50-100  € in the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the synchronization time, combined with the lack of a limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30952</id>
		<title>Testing for business logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_business_logic&amp;diff=30952"/>
				<updated>2008-06-11T05:29:55Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Testing for business logic flaws in a multi-functional dynamic web application requires thinking in unconventional ways.  If an application's authentication mechanism is developed with the intention of performing steps 1,2,3 in order to authenticate, what happens if you go from 1 straight to step 3?  In this simplistic example does the application provide provide access by failing open, deny access, or just error out with a 500 message.  There are many examples that can be made here but the one constant is thinking outside of conventional wisdom.  This type of vulnerability can not be detected by a vulnerability scanner and relies upon the skill and creativity of the penetration tester.  In addition this type of vulnerability is usually one of the hardest to detect but at the same standpoint usually one of the most detrimental to the application if exploited.&lt;br /&gt;
&lt;br /&gt;
Business logic type of comprises: &lt;br /&gt;
* Business rules that express business policy (such as channels, location, logistics, prices, and products); and&lt;br /&gt;
* Workflows that are the ordered tasks of passing documents or data from one participant (a person or a software system) to another.&lt;br /&gt;
&lt;br /&gt;
The attacks on the business logic of an application are dangerous, difficult to detect and specific to that application.&lt;br /&gt;
&lt;br /&gt;
==Description of the Issue==&lt;br /&gt;
 &lt;br /&gt;
Business logic can have security flaws that allow a user to do something that isn't allowed by the business. For example, if there is a limit on reimbursement of $1000, could an attacker misuse the system to request more money than is allowed? Or perhaps you are supposed to do operations in a particular order, but an attacker could invoke them out of sequence. Or can a user make a purchase for a negative amount of money? Frequently these business logic security checks simply are not present in the application.&lt;br /&gt;
&lt;br /&gt;
Automated tools find it hard to understand context, hence it's up to a person to perform these kinds of tests.&lt;br /&gt;
&lt;br /&gt;
'''Business Limits and Restrictions'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider the rules for the business function being provided by the application. Are there any limits or restrictions on people's behavior? Then consider whether the application enforces those rules. It's generally pretty easy to identify the test and analysis cases to verify the application if you're familiar with the business. If you are a third-party tester, then you're going to have to use your common sense and ask the business if different operations should be allowed by the application.&lt;br /&gt;
&lt;br /&gt;
'''Example''': Setting the quantity of a product on an e-commerce site as a negative number may result in funds being credited to the attacker. The countermeasure to this problem is to implement stronger data validation, as the application permits negative numbers to be entered in the quantity field of the shopping cart.&lt;br /&gt;
&lt;br /&gt;
==Black Box Testing and Examples==&lt;br /&gt;
&lt;br /&gt;
Although uncovering logical vulnerabilities will probably always remain an art, one can attempt to go about it systematically to a great extent. Here is a suggested approach that consists of:  &lt;br /&gt;
* Understanding the application&lt;br /&gt;
* Creating raw data for designing logical tests&lt;br /&gt;
* Designing the logical tests&lt;br /&gt;
* Standard prerequisites&lt;br /&gt;
* Execution of logical tests&lt;br /&gt;
&lt;br /&gt;
===Understanding the application===&lt;br /&gt;
&lt;br /&gt;
Understanding the application thoroughly is a prerequisite for designing logical tests. To start with: &lt;br /&gt;
* Get any documentation describing the application's functionality. Examples of this include:&lt;br /&gt;
** Application manuals&lt;br /&gt;
** Requirements documents&lt;br /&gt;
** Functional specifications&lt;br /&gt;
** Use or Abuse Cases&lt;br /&gt;
* Explore the application manually and try to understand all the different ways in which the application can be used, the acceptable usage scenarios and the authorization limits imposed on various users&lt;br /&gt;
&lt;br /&gt;
===Creating raw data for designing logical tests===&lt;br /&gt;
&lt;br /&gt;
In this phase, one should ideally come up with the following data: &lt;br /&gt;
* All application '''business scenarios'''. For example, for an e-commerce application this might look like,&lt;br /&gt;
** Product ordering&lt;br /&gt;
** Checkout&lt;br /&gt;
** Browse&lt;br /&gt;
** Search for a product&lt;br /&gt;
* '''Workflows'''. This is different from business scenarios since it involves a number of different users. Examples include:&lt;br /&gt;
** Order creation and approval&lt;br /&gt;
** Bulletin board (one user posts an article that is reviewed by a moderator and ultimately seen by all users)&lt;br /&gt;
* Different '''user roles'''&lt;br /&gt;
** Administrator&lt;br /&gt;
** Manager&lt;br /&gt;
** Staff&lt;br /&gt;
** CEO&lt;br /&gt;
* Different '''groups or departments''' (note that there could be a tree (e.g. the Sales group of the heavy engineering division) or tagged view (e.g. someone could be a member of Sales as well as marketing) associated with this. &lt;br /&gt;
** Purchasing&lt;br /&gt;
** Marketing&lt;br /&gt;
** Engineering&lt;br /&gt;
* '''Access rights of various user roles and groups''' - The application allows various users privileges on some resource (or asset) and we need to specify the constraints of these privileges.  One simple way to know these business rules/constraints is to make use of the application documentation effectively.  For example, look for clauses like &amp;quot;If the administrator allows individual user access..&amp;quot;, &amp;quot;If configured by the administrator..&amp;quot; and you know the restriction imposed by the application. &lt;br /&gt;
* '''Privilege Table''' – After learning about the various privileges on the resources along with the constraints, you are all set to create a Privilege Table.  Get answers to: &lt;br /&gt;
** What can each user role do on which resource with what constraint?  This will help you in deducing who cannot do what on which resource.  &lt;br /&gt;
** What are the policies across groups? &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;display: block; margin-left: 16px;&amp;quot;&amp;gt;Consider the following privileges: &amp;quot;Approve expense report&amp;quot;, &amp;quot;Book a conference room&amp;quot;, &amp;quot;Transfer money from own account to another user's account&amp;quot;. A privilege could be thought of as a combination of a verb (e.g. Approve, Book, Withdraw) and one or more nouns (Expense report, conference room, account). The output of this activity is a grid with the various privileges forming the leftmost column while all user roles and groups would form the column headings of other columns. There would also be a “Comments” column that qualifies data in this grid.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
| '''Privilege''' || '''Who can do this''' || '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
| Approve expense report || Any supervisor may approve report submitted by his subordinate || &lt;br /&gt;
|-&lt;br /&gt;
| Submit expense report || Any employee may do this for himself || &lt;br /&gt;
|-&lt;br /&gt;
| Transfer funds from one account to another || An account holder may transfer funds from own account to another account || &lt;br /&gt;
|-&lt;br /&gt;
| View payslip || Any employee may see his own || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This data is a key input for designing logical tests. &lt;br /&gt;
&lt;br /&gt;
===Developing logical tests===&lt;br /&gt;
&lt;br /&gt;
Here are several guidelines to designing logical tests from the raw data gathered. &lt;br /&gt;
&lt;br /&gt;
* '''Privilege Table''' - Make use of the privilege table as a reference while creating application specific logical threats. In general, develop a test for each admin privilege to check if it could be executed illegally by a user role with minimum privileges or no privilege.  For example:&lt;br /&gt;
** Privilege: Operations Manager cannot approve a customer order&lt;br /&gt;
** Logical Test: Operations Manager approves a customer order&lt;br /&gt;
&lt;br /&gt;
* '''Improper handling of special user action sequences''' - Navigating through an application in a certain way or revisiting pages out of synch can cause logical errors which may cause the application to do something it's not meant to. For example:&lt;br /&gt;
** A wizard application where one fills in forms and proceeds to the next step. One cannot in any normal way (according to the developers) enter the wizard in the middle of the process. Bookmarking a middle step (say step 4 of 7), then continuing with the other steps until completion or form submission, then revisiting the middle step that was bookmarked may &amp;quot;upset&amp;quot; the backend logic due to a weak ''state model''.&lt;br /&gt;
&lt;br /&gt;
* '''Cover all business transaction paths''' - While designing tests, check for all alternative ways to perform the same business transaction. For example, create tests for both cash and credit payment modes.&lt;br /&gt;
&lt;br /&gt;
* '''Client-side validation''' - Look at all client side validations and see how they could be the basis for designing logical tests.  For example, a funds transfer transaction has a validation for negative values in the amount field.  This information can be used to design a logical test such as &amp;quot;A user transfers negative amount of money&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Standard prerequisites===&lt;br /&gt;
&lt;br /&gt;
Typically, some initial activities useful as setup are: &lt;br /&gt;
* Create test users with different permissions&lt;br /&gt;
* Browse all the important business scenarios/workflows in the application&lt;br /&gt;
&lt;br /&gt;
===Execution of logical tests=== &lt;br /&gt;
&lt;br /&gt;
Pick up each logical test and do the following:&lt;br /&gt;
* Analyze the HTTP/S requests underlying the acceptable usage scenario corresponding to the logical test&lt;br /&gt;
** Check the order of HTTP/S requests&lt;br /&gt;
** Understand the purpose of hidden fields, form fields, query string parameters being passed&lt;br /&gt;
* Try and subvert it by exploiting the known vulnerabilities&lt;br /&gt;
* Verify that the application fails for the test &lt;br /&gt;
&lt;br /&gt;
===A real world example===&lt;br /&gt;
&lt;br /&gt;
In order to provide the reader with a better understanding of this issue and how to test it, we describe a real world case that was investigated by one of the authors in 2006.&lt;br /&gt;
At that time, a mobile telecom operator (we'll call it FlawedPhone.com) launched a webmail+SMS service for its customers, with the following characteristics:&lt;br /&gt;
&lt;br /&gt;
* New customers, when buying a SIM card, can open a free, permanent email account with the flawedphone.com domain&lt;br /&gt;
* The email is preserved even if the customers “transfers” the SIM card to another telecom operator&lt;br /&gt;
* However, as long as the SIM card is registered to FlawedPhone, each time an email is received, a SMS message is sent to the customer, including sender and subject&lt;br /&gt;
* The SMS application checks that the target phone number is a legitimate customer from its own copy of the FlawedPhone customers list, which is automatically updated every ~8 hours.&lt;br /&gt;
&lt;br /&gt;
The application had been developed following security best practices but it suffered from a business logic flaw and FlawedPhone was soon targeted by the following fraud attack:&lt;br /&gt;
&lt;br /&gt;
* The attacker bought a new FlawedPhone SIM card&lt;br /&gt;
* The attacker immediately requested to transfer the SIM card to another mobile carrier, which credits 0.05 € for each received SMS message&lt;br /&gt;
* As soon as the SIM card was “transferred” to the new provider, the attacker started sending hundreds of emails to her FlawedPhone email account&lt;br /&gt;
* The attacker had a ~8 hours window before the email+SMS application had its list updated and stopped delivering messages&lt;br /&gt;
* By that time, the attacker had ~50-100  € in the card, and proceeded to sell it on eBay&lt;br /&gt;
&lt;br /&gt;
The developers thought that SMS messages delivered during the 8 hours period would have introduced a negligible cost but failed to consider the likelihood of an automated attack like the one described.&lt;br /&gt;
As we can see, the synchronization time, combined with the lack of a limit to the number of messages that could be delivered in a given period of time, introduced a critical flaw in the system that was soon exploited by malicious users. &lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Business logic - http://en.wikipedia.org/wiki/Business_logic&lt;br /&gt;
* Prevent application logic attacks with sound app security practices - http://searchappsecurity.techtarget.com/qna/0,289202,sid92_gci1213424,00.html?bucket=NEWS&amp;amp;topic=302570&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Automated tools are incapable of detecting logical vulnerabilities. For example, tools have no means of detecting if a bank’s &amp;quot;fund transfer&amp;quot; page allows a user to transfer a negative amount to another user (in other words, it allows a user to transfer a positive amount into his own account) nor do they have any mechanism to help the human testers to suspect this state of affairs.&lt;br /&gt;
&lt;br /&gt;
'''Preventing transfer of a negative amount''': Tools could be enhanced so that they can report client side validations to the tester. For example, the tool may have a feature whereby it fills a form with strange values and attempts to submit it using a full-fledged browser implementation. It should check to see whether the browser actually submitted the request. Detecting that the browser has not submitted the request would signal to the tool that submitted values are not being accepted due to client-side validation. This would be reported to the tester, who would then understand the need for designing appropriate logical tests that bypass client-side validation. In our &amp;quot;negative amount transfer&amp;quot; example, the tester would learn that the transfer of negative amounts may be an interesting test. He could then design a test wherein the tool bypasses the client-side validation code and checks to see if the resulting response contains the string &amp;quot;funds transfer successful&amp;quot;. The point is not that the tool will be able to detect this or other vulnerabilities of this nature, rather that, with some thought, it would be possible to add many such features to enlist the tools in aiding human testers to find such logical vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30947</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30947"/>
				<updated>2008-06-10T22:42:51Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  such as can a user create his own account or does the system create an account for you based on some personal information or predictable sequence.  If the application does create is own account in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
*If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create as many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/passwords&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30946</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30946"/>
				<updated>2008-06-10T22:40:36Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  such as can a user create his own account or does the system create an account for you based on some personal information or predictable sequence.  If the application does create is own account in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
*If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create as many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/cgi-bin/passwd.pl&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30945</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30945"/>
				<updated>2008-06-10T22:34:40Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Gray Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  such as can a user create his own account or does the system create an account for you based on some personal information or predictable sequence.  If the application does create is own account in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
*If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create as many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/cgi-bin/passwd.pl&lt;br /&gt;
* DarkLab http://phenoelit.darklab.org/cgi-bin/display.pl?SUBF=list&amp;amp;SORT=1&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30944</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30944"/>
				<updated>2008-06-10T22:32:28Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, &amp;quot;guest&amp;quot;, &amp;quot;operator&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, &amp;quot;guest&amp;quot; and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.  In addition try an empty password or one of the following &amp;quot;password&amp;quot;, &amp;quot;pass123&amp;quot;, &amp;quot;password123&amp;quot;, &amp;quot;admin&amp;quot;, or &amp;quot;guest&amp;quot; with the above accounts or any other enumerated accounts.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity or any other similar combination as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames with any common passwords.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names such as their email address or the name before the &amp;quot;@&amp;quot; in the email.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
* Try to extrapolate from the application how usernames are created.  such as can a user create his own account or does the system create an account for you based on some personal information or predictable sequence.  If the application does create is own account in a predictable sequence, such as user7811, try fuzzing all possible accounts recursively.  If you can identify a different response from the application with a valid username and bad password then you can try a brute force attack on the valid username (or quickly try any of the identified common passwords above or in the reference section).  &lt;br /&gt;
*If the application creates its own passwords for new users, whether or not the username is created by the application or by the user, then try to determine if the password is predictable.  Try to create as many new accounts in quick succession to compare and determine if the passwords are predictable.  If predictable then try to correlate these with the usernames, or any enumerated accounts, and use them as a basis for a brute force attack.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system or application being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/cgi-bin/passwd.pl&lt;br /&gt;
* DarkLab http://phenoelit.darklab.org/cgi-bin/display.pl?SUBF=list&amp;amp;SORT=1&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30940</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30940"/>
				<updated>2008-06-10T21:56:38Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username and/or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/cgi-bin/passwd.pl&lt;br /&gt;
* DarkLab http://phenoelit.darklab.org/cgi-bin/display.pl?SUBF=list&amp;amp;SORT=1&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30939</id>
		<title>Testing for Default or Guessable User Account (OWASP-AT-003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Default_or_Guessable_User_Account_(OWASP-AT-003)&amp;diff=30939"/>
				<updated>2008-06-10T21:54:49Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]]&amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
Today's web application typically runs on popular software, open source or commercial, that is installed on servers and requires configuration or customization by the server administrator. In addition, most of today's hardware appliances, i.e. network routers, database servers, etc.,  offer web-based configurations or administrative interfaces.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Often, these applications are not properly configured and the default credentials provided for authentication are never updated.  In addition, it is typical to find generic accounts such as for testing or administration that use common usernames and passwords are left enabled on the application.&amp;lt;br&amp;gt;&lt;br /&gt;
These default username/password combinations are widely known by penetration testers and malicious hackers that can use them to gain access to various types of custom or commercial applications.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
The sources for this problem are often inexperienced IT personnel, who are unaware of the importance of changing default passwords on installed infrastructure components, programmers, who leave backdoors to easily access and test the application and later forgetting to remove them, application administrators and users that choose an easy username and password for themselves, and applications with built in, non-removable default accounts with a pre-set username and password. Another problem is blank passwords, which are simply a result of security unawareness and a desire to simplify administration.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
In blackbox testing we know nothing about the application, its underlying infrastructure, and any username and/or password policies. Often this is not the case and some information about the application is provided – simply skip the steps that refer to obtaining information you already have.&lt;br /&gt;
&lt;br /&gt;
When testing a known application interface, such as a Cisco router web interface, or Weblogic admin access, check the known usernames and passwords for these devices. This can be done either by Google, or using one of the references in the Further Reading section.&lt;br /&gt;
&lt;br /&gt;
When facing a home-grown application, to which we do not have a list of default and common user accounts, we need to test it manually, following these guidelines:&lt;br /&gt;
* Try the following usernames - &amp;quot;admin&amp;quot;, &amp;quot;administrator&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;system&amp;quot;, or &amp;quot;super&amp;quot;. These are popular among system administrators and are often used. Additionally you could try &amp;quot;qa&amp;quot;, &amp;quot;test&amp;quot;, &amp;quot;test1&amp;quot;, &amp;quot;testing&amp;quot;, and similar names. Attempt any combination of the above in both the username and the password fields. If the application is vulnerable to username enumeration, and you successfully managed to identify any of the above usernames, attempt passwords in a similar manner.&lt;br /&gt;
* Application administrative users are often named after the application. This means if you are testing an application named &amp;quot;Obscurity&amp;quot;, try using obscurity/obscurity as the username and password.&lt;br /&gt;
* When performing a test for a customer, attempt using names of contacts you have received as usernames.&lt;br /&gt;
* Viewing the User Registration page may help determine the expected format and length of the application usernames and passwords. If a user registration page does not exist, determine if the organization uses a standard naming convention for user names.   &lt;br /&gt;
* Attempt using all the above usernames with blank passwords.&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
The steps described next rely on an entirely Gray Box approach. If only some of the information is available to you, refer to black box testing to fill the gaps.&lt;br /&gt;
&lt;br /&gt;
Talk to the IT personnel to determine which passwords they use for administrative access. &lt;br /&gt;
&lt;br /&gt;
Check whether these usernames and passwords are complex, difficult to guess, and not related to the application name, person name, or administrative names (&amp;quot;system&amp;quot;). &lt;br /&gt;
Note blank passwords.&lt;br /&gt;
Check in the user database for default names, application names, and easily guessed names as described in the Black Box testing section. Check for empty password fields.&lt;br /&gt;
&lt;br /&gt;
Examine the code for hard coded usernames and passwords.&lt;br /&gt;
&lt;br /&gt;
Check for configuration files that contain usernames and passwords.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Authorized access to system being tested&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* CIRT http://www.cirt.net/cgi-bin/passwd.pl&lt;br /&gt;
* DarkLab http://phenoelit.darklab.org/cgi-bin/display.pl?SUBF=list&amp;amp;SORT=1&lt;br /&gt;
* Government Security - Default Logins and Passwords for Networked Devices http://www.governmentsecurity.org/articles/DefaultLoginsandPasswordsforNetworkedDevices.php&lt;br /&gt;
* Virus.org http://www.virus.org/default-password/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30937</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30937"/>
				<updated>2008-06-10T20:54:42Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2965 - HTTP State Management Mechanism&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30935</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30935"/>
				<updated>2008-06-10T20:51:59Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RFC 2965 - HTTP State Management Mechanism&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30934</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30934"/>
				<updated>2008-06-10T20:40:17Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Gray Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30933</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30933"/>
				<updated>2008-06-10T20:39:12Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly Attribute - This attribute should always be set even though not every browser supports it.  This attribute aides in securing the cookie from being accessed by a client side script so check to see if the &amp;quot;;HttpOnly&amp;quot; tag has been set.&lt;br /&gt;
&lt;br /&gt;
*Domain Attribute - Verify that the domain has not been set to loosely.  As noted above it should only be set for the server that needs to receive the cookie.  For example if the application resides on server app.mysite.com then it should be set to &amp;quot;; domain=app.mysite.com&amp;quot; and NOT &amp;quot;; domain=.mysite.com&amp;quot; as this would allow other potentially vulnerable servers to receive the cookie. &lt;br /&gt;
&lt;br /&gt;
*Path Attribute - Verify that the path attribute, just as the Domain attribute, has not been set to loosely.  Even if the Domain attribute has been configured as tight as possible, if the path is set to the root directory &amp;quot;/&amp;quot; then it can be vulnerable to less secure applications on the same server.  For example if the application resides at /myapp/ then verify that the cookies path is set to &amp;quot;; path=/myapp/&amp;quot; and NOT &amp;quot;; path=/&amp;quot; or &amp;quot;; path=/myapp&amp;quot;.  Notice here that the trailing &amp;quot;/&amp;quot; must be used after myapp.  If it is not used the browser will send the cookie to any path the matches &amp;quot;myapp&amp;quot; such as &amp;quot;myapp-exploited&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*expires Attribute - Verify that if this attribute is set to a time in the future that it does not contain any sensitive information.  For example if a cookie is set to &amp;quot;; expires=Fri, 13-Jun-2010 13:45:29 GMT&amp;quot; and it is currently June 10th 2008 then you want to inspect the cookie.  If the cookie is a session token that is stored on the users hard drive then an attacker or local user (such as an admin) who has access to this cookie can access the application by resubmitting this token until the expiration date passes.&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30932</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30932"/>
				<updated>2008-06-10T19:26:38Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using an intercepting proxy or browser plugin trap all responses where a cookie is set by the application (using the Set-cookie directive) and inspect the cookie for the following:&lt;br /&gt;
&lt;br /&gt;
*Secure Attribute - Whenever a cookie contains sensitive information or is a session token then it should always be passed using an encrypted tunnel.  For example after logging into an application and a session token is set using a cookie, then verify it is tagged using the &amp;quot;secure&amp;quot; flag.  If it is not then it the browser believes it safe to pass via an unencrypted channel such as using HTTP.&lt;br /&gt;
&lt;br /&gt;
* &lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30901</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30901"/>
				<updated>2008-06-09T23:31:41Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - This attribute tells the browser to only send the cookie if the request is being sent over a secure channel such as HTTPS.  This will help protect the cookie from being passed over unencrypted requests.  &lt;br /&gt;
If the application can be accessed over HTTP and HTTPS then their is the potential that the cookie can be sent in cleartext.&lt;br /&gt;
&lt;br /&gt;
*HttpOnly - This attribute is used to help prevent attacks such as cross-site scripting since it does not allow the cookie to be accessed via a client side script such as JavaScript.  Note that not all browsers support this functionality.&lt;br /&gt;
&lt;br /&gt;
*domain -  This attribute is used to compare against the domain of the server in which the URL is being requested.  If the domain matches or if its a sub-domain then the path attribute will be checked next.  &lt;br /&gt;
Note that only hosts within the specified domain can set a cookie for that domain.  Also the domain attribute can not be a top level domain (such as .gov or .com) to prevent against servers being able to set arbitrary cookies for another domain.  If domain attribute is not set then the default value of domain is set to the hostname of the server which generated the cookie. &lt;br /&gt;
For example if a cookie is set by an application at app.mydomain.com with no domain attribute set, then the cookie would be resubmitted for all subsequent requests for app.mydomain.com and its subdomains (such as hacker.app.mydomain.com), but not to otherapp.mydomain.com.  If a developer wanted to loosen this restriction then he could set the domain attribute to mydomain.com.  In this case the cookie would be sent to all requests for app.mydomain.com, its subdomains such as hacker.app.mydomain.com and even bank.mydomain.com.&lt;br /&gt;
If there was a vulnerable server on a subdomain such as (otherapp.mydomain.com) and the domain attribute has been set to loosely (for example mydomain.com), then the vulnerable server could be used to harvest cookies (such as session tokens).&lt;br /&gt;
 &lt;br /&gt;
*path - In addition to the domain, the URL path can be specified for which the cookie is valid.  If the domain and path match then the cookie will be sent in the request.&lt;br /&gt;
Just as with the domain attribute if the path attribute is set to loosely then it could leave the application vulnerable to attack by other applications on the same server.  For example if the path attribute was set to the web server root &amp;quot;/&amp;quot; then the applications cookies will be sent to every application within the same domain. &lt;br /&gt;
&lt;br /&gt;
*expires - This attribute is used to set persistent cookies, since the cookie does not expire until the set date is exceeded.  This persistent cookie will be used by this browser session and subsequent sessions until the cookie expires.  Once the expiration date has exceeded the browser will delete the cookie.  Alternatively if this attribute is not set then the cookie is only valid in the current browser session and the cookie will be deleted when the session ends.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30719</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30719"/>
				<updated>2008-06-08T04:12:32Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.  The following is a list of the attributes that can be set for each cookie and what they mean.  The next section will focus on how to test for each attribute.&lt;br /&gt;
&lt;br /&gt;
*secure - &lt;br /&gt;
*HttpOnly -&lt;br /&gt;
*domain - &lt;br /&gt;
*path - &lt;br /&gt;
*expires - &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30718</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30718"/>
				<updated>2008-06-08T03:42:56Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users (typically targeting other users) and as such the application should always take due diligence to protect these cookies.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30717</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30717"/>
				<updated>2008-06-08T03:39:51Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users and as such the application should always take due diligence to protect them.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set (separated by a semicolon) upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc) in the online store type of application.   &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30716</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30716"/>
				<updated>2008-06-08T03:32:48Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users and as such the application should always take due diligence to protect them.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The importance and secure use of Cookies cannot be understated, especially within dynamic web applications which need to maintain state across a stateless protocol such as HTTP.  To understand the importance of cookies it is imperative to understand what they are primarily used for.  These primary functions usually consist of being used as a session authorization/authentication token and/or as a temporary data container.  Thus if an attacker by some means was able to acquire a session token such as by cross site scripting (XSS) or sniffing an unencrypted session then they could use this cookie to hijack a valid current session.  Additionally cookies are set to maintain state across multiple requests.  Since HTTP is stateless the server can not determine if a request it receives is part of a current session or the start of a new session without some type of identifier.  This identifier is very commonly a cookie although not always.  As you can imagine there are many different types of applications that need to keep track of session state across multiple request.  The primary one that comes to mind would be an online store.  As a user adds multiple items to a shopping cart this data needs to be retained in subsequent requests to the application.  Cookies are very commonly used for this task and are set by the application using the Set-Cookie directive in the applications HTTP response, and is usually in a name=value format (if cookies are enabled and if they are supported, which is the case for all modern web browsers).  Once an application has told the browser to use a particular cookie the browser will send this cookie in each subsequent request.  A cookie can contain data such as items from an online shopping cart, the price of these items, the quantity of these items, personal information, user IDs, etc.  Due to the sensitive nature of information in cookies they are typically encoded or encrypted in an attempt to protect this information.  Many times multiple cookies will be set upon subsequent request especially in the case of an online store as you add multiple items to your shopping cart.  Additionally you will typically have a cookie for authentication (session token as indicated above) once you login and multiple others cookies used to identify the items you wish to purchase and their auxiliary information (ie price, quantity, etc)    &lt;br /&gt;
&lt;br /&gt;
Now that you have an understanding of how cookies are set, when they are set, what they are used for, why they are used, and their importance; lets take a look at what attributes can be set for a cookie and how to test if they are secure.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30713</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30713"/>
				<updated>2008-06-08T02:10:08Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users and as such the application should always take due diligence to protect them.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30712</id>
		<title>Testing for cookies attributes (OTG-SESS-002)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_cookies_attributes_(OTG-SESS-002)&amp;diff=30712"/>
				<updated>2008-06-08T02:05:42Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are often a key attack vector for malicious users and as such the application should always take due diligence to protect them.  In this section we will look at how an application can take the necessary precautions when assigning cookies and how to test that these attributes have been correctly configured. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Testing for Topic X vulnerabilities:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30711</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30711"/>
				<updated>2008-06-08T01:08:08Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before any testing begins always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP request (GET and POST Methods also known as Verbs) and every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST request are used to pass parameters.  It is very common that GET request will be used but when sensitive information is passed it will be done within the body of a POST request.  Note here that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc, that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point I usually trap every request and response so that I can see exactly every header, parameter, etc that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if its part of a multi-step process, and any other special notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below I will identify some helpful points of interests for all requests and responses.  Within the requests section I will focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing this so I will only make note of this to be as thorough as possible.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where GET's are used and where POST's are used&lt;br /&gt;
*Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
*Within the POST request pay special attention to any hidden parameters.  When a POST is sent the form fields you enter will be sent in the body of the message in addition to any hidden form fields that are automagically sent to the application as well.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of this hidden parameter(s).&lt;br /&gt;
*Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
*Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
*A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  I will stop at this point as later sections will identify how to test these parameters but just make sure you identify each one of them.&lt;br /&gt;
*Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified, and/or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also not where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state)&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application.&lt;br /&gt;
&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
Body of the POST message:&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources where the application receives data from and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept and/or expect user input and how its formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30647</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30647"/>
				<updated>2008-06-07T01:03:44Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP request (GET and POST Methods also known as Verbs) and every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST request are used to pass parameters.  It is very common that GET request will be used but when sensitive information is passed it will be done within the body of a POST request.  Note here that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc, that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point I usually trap every request and response so that I can see exactly every header, parameter, etc that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if its part of a multi-step process, and any other special notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below I will identify some helpful points of interests for all requests and responses.  Within the requests section I will focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing this so I will only make note of this to be as thorough as possible.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where GET's are used and where POST's are used&lt;br /&gt;
*Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
*Within the POST request pay special attention to any hidden parameters.  When a POST is sent the form fields you enter will be sent in the body of the message in addition to any hidden form fields that are automagically sent to the application as well.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of this hidden parameter(s).&lt;br /&gt;
*Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
*Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
*A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  I will stop at this point as later sections will identify how to test these parameters but just make sure you identify each one of them.&lt;br /&gt;
*Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified, and/or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also not where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state)&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application.&lt;br /&gt;
&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
Body of the POST message:&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources where the application receives data from and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept and/or expect user input and how its formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30646</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30646"/>
				<updated>2008-06-07T01:01:26Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP request (GET and POST Methods also known as Verbs) and every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST request are used to pass parameters.  It is very common that GET request will be used but when sensitive information is passed it will be done within the body of a POST request.  Note here that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc, that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point I usually trap every request and response so that I can see exactly every header, parameter, etc that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if its part of a multi-step process, and any other special notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below I will identify some helpful points of interests for all requests and responses.  Within the requests section I will focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing this so I will only make note of this to be as thorough as possible.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where GET's are used and where POST's are used&lt;br /&gt;
*Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
*Within the POST request pay special attention to any hidden parameters.  When a POST is sent the form fields you enter will be sent in the body of the message in addition to any hidden form fields that are automagically sent to the application as well.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of this hidden parameter(s).&lt;br /&gt;
*Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
*Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
*A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  I will stop at this point as later sections will identify how to test these parameters but just make sure you identify each one of them.&lt;br /&gt;
*Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified, and/or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also not where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 1:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state)&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLE 2:'''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources where the application receives data from and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept and/or expect user input and how its formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30635</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30635"/>
				<updated>2008-06-06T19:33:58Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP request (GET and POST Methods also known as Verbs) and every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST request are used to pass parameters.  It is very common that GET request will be used but when sensitive information is passed it will be done within the body of a POST request.  Note here that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc, that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point I usually trap every request and response so that I can see exactly every header, parameter, etc that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if its part of a multi-step process, and any other special notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below I will identify some helpful points of interests for all requests and responses.  Within the requests section I will focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing this so I will only make note of this to be as thorough as possible.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where GET's are used and where POST's are used&lt;br /&gt;
*Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
*Within the POST request pay special attention to any hidden parameters.  When a POST is sent the form fields you enter will be sent in the body of the message in addition to any hidden form fields that are automagically sent to the application as well.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of this hidden parameter(s).&lt;br /&gt;
*Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
*Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
*A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  I will stop at this point as later sections will identify how to test these parameters but just make sure you identify each one of them.&lt;br /&gt;
*Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified, and/or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also not where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''''EXAMPLE 1:''''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state)&lt;br /&gt;
&lt;br /&gt;
''''EXAMPLE 2:''''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources where the application receives data from and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept and/or expect user input and how its formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Intercepting Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30634</id>
		<title>Identify application entry points (OTG-INFO-006)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Identify_application_entry_points_(OTG-INFO-006)&amp;diff=30634"/>
				<updated>2008-06-06T19:33:44Z</updated>
		
		<summary type="html">&lt;p&gt;Khorvath: /* Gray Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
'''This is a draft of a section of the new Testing Guide v3'''&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Enumerating the application and its attack surface is a key precursor before any attack should commence.  This section will help you identify and map out every area within the application that should be investigated once your enumeration and mapping phase has been completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should always get a good understanding of the application and how the user/browser communicates with it as you walk through the application.  As you walk through the application pay special attention to all HTTP request (GET and POST Methods also known as Verbs) and every parameter and form field that is passed to the application.  In addition to this pay attention to when GET requests are used and when POST request are used to pass parameters.  It is very common that GET request will be used but when sensitive information is passed it will be done within the body of a POST request.  Note here that to see the parameters sent in a POST request you will need to use a tool such as an intercepting proxy (for example OWASP's Webscarab) or a browser plug-in.  Within the POST request also make special note of any hidden form fields that are being passed to the application as these usually contain sensitive information such as state information, quantity of items, the price of items, etc, that the developer never intended for you to see or change.  &lt;br /&gt;
&lt;br /&gt;
In the author's experience it has been very useful in using an intercepting proxy and a spreadsheet for this stage.  The proxy will keep track of every request and response between you and the application as you walk through it.  Additionally at this point I usually trap every request and response so that I can see exactly every header, parameter, etc that is being passed to the application and what is being returned.  This can be quite tedious at times especially on large interactive sites (think of a banking application) but with experience of knowing what to look for this time can be significantly reduced.  As you walk through the application and notice any interesting parameters in the URL, custom header, or body of the message then note this in your spreadsheet.  The spreadsheet should include the page you requested (might be good to add the request number from the proxy here also for reference), the interesting parameters, the type of request (POST/GET), authenticated/unauthenticated access, if SSL is used, if its part of a multi-step process, and any other special notes.  Once you have every area of the application mapped out then you can go through the application and test each of the areas that you have identified and make notes for what worked and what didn't work.  The rest of this guide will identify how to test each of these areas of interest but this section must be undertaken before any of the actual testing can commence.&lt;br /&gt;
&lt;br /&gt;
Below I will identify some helpful points of interests for all requests and responses.  Within the requests section I will focus on the GET and POST methods as these are the majority of the requests that are used.  Also note that are other Methods that can be used such as PUT and DELETE which can be very dangerous if allowed.  There is a special section in this guide dedicated for testing this so I will only make note of this to be as thorough as possible.&lt;br /&gt;
&lt;br /&gt;
'''Requests:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where GET's are used and where POST's are used&lt;br /&gt;
*Identify all parameters identified within a POST request (these are in the body of the request)&lt;br /&gt;
*Within the POST request pay special attention to any hidden parameters.  When a POST is sent the form fields you enter will be sent in the body of the message in addition to any hidden form fields that are automagically sent to the application as well.  These typically aren't seen unless you are using a proxy or view the HTML source code.  In addition the next page you see, its data, and your access can all be different depending on the value of this hidden parameter(s).&lt;br /&gt;
*Identify all parameters within the GET request (i.e. URL) in particular the query string (usually after a ? mark).&lt;br /&gt;
*Identify all the parameters of the query string which usually are in a pair format such as foo=bar. Also note many parameters can be in one query string such as separated by a &amp;amp;, ~, :, or any other special character or encoding.&lt;br /&gt;
*A special note when it comes to identifying multiple parameters in one string or within a POST request is that some or all of the parameters will be needed to execute your attacks.  You need to identify all of the parameters (even if encoded or encrypted) and identify which ones are processed by the application.  I will stop at this point as later sections will identify how to test these parameters but just make sure you identify each one of them.&lt;br /&gt;
*Also pay attention to any additional or custom type headers not typically seen (such as debug=False)&lt;br /&gt;
&lt;br /&gt;
'''Responses:'''&lt;br /&gt;
&lt;br /&gt;
*Identify where new cookies are set (set-cookie directive), modified, and/or added to.&lt;br /&gt;
*Identify where there are any redirects (300 type messages), 400 type messages in particular 403 Forbidden, and 500 internal server errors during normal responses (i.e. unmodified requests).&lt;br /&gt;
*Also not where any interesting headers are identified such as &amp;quot;Server: BIG-IP&amp;quot; which indicates the site is being load balanced. Thus if load balanced and one server is incorrectly configured then you might have to make multiple requests to access the vulnerable server depending on the type of load balancing used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for application entry points:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''''EXAMPLE 1:''''&lt;br /&gt;
&lt;br /&gt;
This example shows a GET request that would purchase an item from an online shopping application.&lt;br /&gt;
&lt;br /&gt;
Example 1 of a simplified GET request:&lt;br /&gt;
&lt;br /&gt;
*GET https://x.x.x.x/shoppingApp/buyme.asp?CUSTOMERID=100&amp;amp;ITEM=z101a&amp;amp;PRICE=62.50&amp;amp;IP=x.x.x.x &lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=Z29vZCBqb2IgcGFkYXdhIG15IHVzZXJuYW1lIGlzIGZvbyBhbmQgcGFzc3dvcmQgaXMgYmFy&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you would note all the parameters of the request such as CUSTOMERID, ITEM, PRICE, IP, and the Cookie (which could just be encoded parameters or used for session state)&lt;br /&gt;
&lt;br /&gt;
''''EXAMPLE 2:''''&lt;br /&gt;
&lt;br /&gt;
This example shows a POST request that would login you into an application&lt;br /&gt;
Example 2 of a simplified POST request:&lt;br /&gt;
&lt;br /&gt;
*POST https://x.x.x.x/KevinNotSoGoodApp/authenticate.asp?service=login&lt;br /&gt;
*Host: x.x.x.x&lt;br /&gt;
*Cookie: SESSIONID=dGhpcyBpcyBhIGJhZCBhcHAgdGhhdCBzZXRzIHByZWRpY3RhYmxlIGNvb2tpZXMgYW5kIG1pbmUgaXMgMTIzNA==&lt;br /&gt;
*CustomCookie=00my00trusted00ip00is00x.x.x.x00&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*user=admin&amp;amp;pass=pass123&amp;amp;debug=true&amp;amp;fromtrustIP=true&lt;br /&gt;
&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example you would note all the parameters as you have before but notice that the parameters are passed in the body of the message and not in the URL.  Additionally note that there is a custom cookie that is being used.&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Testing for application entry points via a Gray Box methodology would consist of everything already identified above with one caveat.  This would be if there are any external sources where the application receives data from and processes it (such as SNMP traps, syslog messages, SMTP, or SOAP messages from other servers).  If there are any external sources of input into the application then a meeting with the application developers could identify any functions that would accept and/or expect user input and how its formated.  For example the developer could help in understanding how to formulate a correct SOAP request that the application would accept and where the web service resides (if the web service or any other function hasn't already been identified during the black box testing).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Web Proxy&lt;br /&gt;
*Browser Plug-in&lt;/div&gt;</summary>
		<author><name>Khorvath</name></author>	</entry>

	</feed>