<?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=Alombardini</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=Alombardini"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Alombardini"/>
		<updated>2026-05-16T09:13:34Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12351</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12351"/>
				<updated>2006-11-11T16:44:14Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Private sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
To leverage different bruteforcing attacks it's important to discover the type of authentication method used by the application, because the techniques and the tools to be used may change.&lt;br /&gt;
&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Digest Access Authentication&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Here is an example of the initial Response header when handling an HTTP Digest target:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Unauthorized&lt;br /&gt;
WWW-Authenticate: Digest realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
         nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
         opaque=&amp;quot;0000000000000000&amp;quot;, \&lt;br /&gt;
         stale=false, &lt;br /&gt;
         algorithm=MD5, &lt;br /&gt;
         qop=&amp;quot;auth&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The Subsequent response headers with valid credentials would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization:  Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
        realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
        qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
        algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
        uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
        nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
        nc=00000001, &lt;br /&gt;
        cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
        opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
        response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTML Form-based Authentication'''&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure.&lt;br /&gt;
&lt;br /&gt;
Source code taken from a HTML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;form method=&amp;quot;POST&amp;quot; action=&amp;quot;login&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;text&amp;quot; name&amp;quot;username&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;password&amp;quot; name=&amp;quot;password&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bruteforce Attacks ===&lt;br /&gt;
&lt;br /&gt;
After having listed the different types of authentication methods in web application, we will explain several bruteforce attacks which can be carried out.&lt;br /&gt;
&lt;br /&gt;
* Dictionary Attack&lt;br /&gt;
Dictionary-based attacks consist of automated scripts and tools that will try to guess username and passwords from a dictionary file. Dictionary file can be tuned and compiled to cover words probably used by the owner of the account a malicious user is going to attack. &lt;br /&gt;
The attacker can previously perform some investigations to understand user's interests, or build a list of all unique words available on the website.&lt;br /&gt;
&lt;br /&gt;
* Search Attacks&lt;br /&gt;
Search attacks will try to cover all possible combination of a given character set and a given password lenght range. This kind of attack is very slow because the space of possible candidates is quite big. For example given a known user id, the total number of passwords to try up to 8 characters in lenght is equal to 26^(8!) in a lower alpha charset (more than 200 billions of different passwords!). &lt;br /&gt;
&lt;br /&gt;
* Rule-based search attacks&lt;br /&gt;
To increase combination space coverage without slowing too much the process it's suggested to create good rules to generate candidates. &lt;br /&gt;
For example &amp;quot;John the Ripper&amp;quot; can generate password variations from part of the username or modify through a preconfigured mask words in input (e.g. 1st round &amp;quot;pen&amp;quot; --&amp;gt; 2nd round &amp;quot;p3n&amp;quot; --&amp;gt; 3rd round &amp;quot;p3np3n&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTTP Basic Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com http-head /private/&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org) starting at 2009-07-04 18:15:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-head on port 80&lt;br /&gt;
[STATUS] 792.00 tries/min, 792 tries in 00:01h, 846 todo in 00:02h&lt;br /&gt;
[80][www] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 18:16:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTML Form Based Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com  https-post-form&lt;br /&gt;
 &amp;quot;/index.cgi:login&amp;amp;name=^USER^&amp;amp;password=^PASS^&amp;amp;login=Login:Not allowed&amp;quot; &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org)starting at 2009-07-04 19:16:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-post-form on port 443&lt;br /&gt;
[STATUS] attack finished for wiki.intranet (waiting for childs to finish)&lt;br /&gt;
[443] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 19:18:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Partial knowledge of password and account details'''&lt;br /&gt;
&lt;br /&gt;
When an attacker has some information about lenght or password (account) structure, it's possible to perform a bruteforce attack with a higher probability of success. Infact, limiting the number of characters and defining the password lenght, the total number of password values significantly decreases.&lt;br /&gt;
&lt;br /&gt;
'''Memory Trade Off Attacks'''&lt;br /&gt;
&lt;br /&gt;
To perform a Memory Trade Off Attack is needed at least a password hash previously obtained by the attacker exploiting flaws in the application (e.g. SQL Injection) or sniffing http traffic. Nowadays the most commond attacks of this kind are based on Rainbow Tables, a special type of lookup table used in recovering the plaintext password from a ciphertext generated by a one-way hash.&lt;br /&gt;
&lt;br /&gt;
Rainbowtable is an optimization of Hellman's Memory Trade Off Attack, where the reduction algorithm is used to create chains with the purpose to compress the data output generated by computing all possible candidates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Tables are specific to the hash function they were created for e.g., MD5 tables can only crack MD5 hashes. &lt;br /&gt;
The more powerful RainbowCrack program was later developed that can generate and use rainbow tables for a variety &lt;br /&gt;
of character sets and hashing algorithms, including LM hash, MD5, SHA1, etc.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Philippe Oechslin: Making a Faster Cryptanalytic Time-Memory Trade-Off - http://lasecwww.epfl.ch/pub/lasec/doc/Oech03.pdf&lt;br /&gt;
'''Links'''&amp;lt;br&amp;gt;&lt;br /&gt;
* OPHCRACK (the time-memory-trade-off-cracker) - http://lasecwww.epfl.ch/~oechslin/projects/ophcrack/&lt;br /&gt;
* Rainbowcrack.com - http://www.rainbowcrack.com/&lt;br /&gt;
* Project RainbowCrack - http://www.antsight.com/zsl/rainbowcrack/&lt;br /&gt;
* milw0rm - http://www.milw0rm.com/cracker/list.php&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* THC Hydra:        http://www.thc.org/thc-hydra/&lt;br /&gt;
* John the Ripper:  http://www.openwall.com/john/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12348</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12348"/>
				<updated>2006-11-11T16:35:30Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Private sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
To leverage different bruteforcing attacks it's important to discover the type of authentication method used by the application, because the techniques and the tools to be used may change.&lt;br /&gt;
&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Digest Access Authentication&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Here is an example of the initial Response header when handling an HTTP Digest target:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Unauthorized&lt;br /&gt;
WWW-Authenticate: Digest realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
         nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
         opaque=&amp;quot;0000000000000000&amp;quot;, \&lt;br /&gt;
         stale=false, &lt;br /&gt;
         algorithm=MD5, &lt;br /&gt;
         qop=&amp;quot;auth&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The Subsequent response headers with valid credentials would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization:  Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
        realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
        qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
        algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
        uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
        nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
        nc=00000001, &lt;br /&gt;
        cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
        opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
        response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTML Form-based Authentication'''&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure.&lt;br /&gt;
&lt;br /&gt;
Source code taken from a HTML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;form method=&amp;quot;POST&amp;quot; action=&amp;quot;login&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;text&amp;quot; name&amp;quot;username&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;password&amp;quot; name=&amp;quot;password&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bruteforce Attacks ===&lt;br /&gt;
&lt;br /&gt;
After having listed the different types of authentication methods in web application, we will explain several bruteforce attacks which can be carried out.&lt;br /&gt;
&lt;br /&gt;
* Dictionary Attack&lt;br /&gt;
Dictionary-based attacks consist of automated scripts and tools that will try to guess username and passwords from a dictionary file. Dictionary file can be tuned and compiled to cover words probably used by the owner of the account a malicious user is going to attack. &lt;br /&gt;
The attacker can previously perform some investigations to understand user's interests, or build a list of all unique words available on the website.&lt;br /&gt;
&lt;br /&gt;
* Search Attacks&lt;br /&gt;
Search attacks will try to cover all possible combination of a given character set and a given password lenght range. This kind of attack is very slow because the space of possible candidates is quite big. For example given a known user id, the total number of passwords to try up to 8 characters in lenght is equal to 26^(8!) in a lower alpha charset (more than 200 billions of different passwords!). &lt;br /&gt;
&lt;br /&gt;
* Rule-based search attacks&lt;br /&gt;
To increase combination space coverage without slowing too much the process it's suggested to create good rules to generate candidates. &lt;br /&gt;
For example &amp;quot;John the Ripper&amp;quot; can generate password variations from part of the username or modify through a preconfigured mask words in input (e.g. 1st round &amp;quot;pen&amp;quot; --&amp;gt; 2nd round &amp;quot;p3n&amp;quot; --&amp;gt; 3rd round &amp;quot;p3np3n&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTTP Basic Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com http-head /private/&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org) starting at 2009-07-04 18:15:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-head on port 80&lt;br /&gt;
[STATUS] 792.00 tries/min, 792 tries in 00:01h, 846 todo in 00:02h&lt;br /&gt;
[80][www] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 18:16:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTML Form Based Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com  https-post-form&lt;br /&gt;
 &amp;quot;/index.cgi:login&amp;amp;name=^USER^&amp;amp;password=^PASS^&amp;amp;login=Login:Not allowed&amp;quot; &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org)starting at 2009-07-04 19:16:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-post-form on port 443&lt;br /&gt;
[STATUS] attack finished for wiki.intranet (waiting for childs to finish)&lt;br /&gt;
[443] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 19:18:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
TD - Having Partial knowledge of password and account details (e.g. lenght or charset)&lt;br /&gt;
&lt;br /&gt;
TD - Memory Trade Off Attacks&lt;br /&gt;
&lt;br /&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;
* OPHCRACK (the time-memory-trade-off-cracker) - http://lasecwww.epfl.ch/~oechslin/projects/ophcrack/&lt;br /&gt;
* Rainbowcrack.com - http://www.rainbowcrack.com/&lt;br /&gt;
* Project RainbowCrack - http://www.antsight.com/zsl/rainbowcrack/&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* THC Hydra:        http://www.thc.org/thc-hydra/&lt;br /&gt;
* John the Ripper:  http://www.openwall.com/john/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12347</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12347"/>
				<updated>2006-11-11T16:25:41Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Private sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
To leverage different bruteforcing attacks it's important to discover the type of authentication method used by the application, because the techniques and the tools to be used may change.&lt;br /&gt;
&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Digest Access Authentication&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Here is an example of the initial Response header when handling an HTTP Digest target:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Unauthorized&lt;br /&gt;
WWW-Authenticate: Digest realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
         nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
         opaque=&amp;quot;0000000000000000&amp;quot;, \&lt;br /&gt;
         stale=false, &lt;br /&gt;
         algorithm=MD5, &lt;br /&gt;
         qop=&amp;quot;auth&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The Subsequent response headers with valid credentials would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization:  Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
        realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
        qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
        algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
        uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
        nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
        nc=00000001, &lt;br /&gt;
        cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
        opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
        response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTML Form-based Authentication'''&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure.&lt;br /&gt;
&lt;br /&gt;
Source code taken from a HTML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;form method=&amp;quot;POST&amp;quot; action=&amp;quot;login&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;text&amp;quot; name&amp;quot;username&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;password&amp;quot; name=&amp;quot;password&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bruteforce Attacks ===&lt;br /&gt;
&lt;br /&gt;
After having listed the different types of authentication methods in web application, we will explain several bruteforce attacks which can be carried out.&lt;br /&gt;
&lt;br /&gt;
* Dictionary Attack&lt;br /&gt;
Dictionary-based attacks consist of automated scripts and tools that will try to guess username and passwords from a dictionary file. Dictionary file can be tuned and compiled to cover words probably used by the owner of the account a malicious user is going to attack. &lt;br /&gt;
The attacker can previously perform some investigations to understand user's interests, or build a list of all unique words available on the website.&lt;br /&gt;
&lt;br /&gt;
* Search Attacks&lt;br /&gt;
Search attacks will try to cover all possible combination of a given character set and a given password lenght range. This kind of attack is very slow because the space of possible candidates is quite big. For example given a known user id, the total number of passwords to try up to 8 characters in lenght is equal to 26^(8!) in a lower alpha charset (more than 200 billions of different passwords!). &lt;br /&gt;
&lt;br /&gt;
* Rule-based search attacks&lt;br /&gt;
To increase combination space coverage without slowing too much the process it's suggested to create good rules to generate candidates. &lt;br /&gt;
For example &amp;quot;John the Ripper&amp;quot; can generate password variations from part of the username or modify through a preconfigured mask words in input (e.g. 1st round &amp;quot;pen&amp;quot; --&amp;gt; 2nd round &amp;quot;p3n&amp;quot; --&amp;gt; 3rd round &amp;quot;p3np3n&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTTP Basic Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com http-head /private/&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org) starting at 2009-07-04 18:15:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-head on port 80&lt;br /&gt;
[STATUS] 792.00 tries/min, 792 tries in 00:01h, 846 todo in 00:02h&lt;br /&gt;
[80][www] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 18:16:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTML Form Based Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com  https-post-form&lt;br /&gt;
 &amp;quot;/index.cgi:login&amp;amp;name=^USER^&amp;amp;password=^PASS^&amp;amp;login=Login:Not allowed&amp;quot; &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org)starting at 2009-07-04 19:16:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-post-form on port 443&lt;br /&gt;
[STATUS] attack finished for wiki.intranet (waiting for childs to finish)&lt;br /&gt;
[443] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 19:18:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
TD - Having Partial knowledge of password and account details (e.g. lenght or charset)&lt;br /&gt;
&lt;br /&gt;
TD - Memory Trade Off Attacks&lt;br /&gt;
&lt;br /&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;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* THC Hydra:        http://www.thc.org/thc-hydra/&lt;br /&gt;
* John the Ripper:  http://www.openwall.com/john/&lt;br /&gt;
* Brutus http://www.hoobie.net/brutus/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12344</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12344"/>
				<updated>2006-11-11T15:52:32Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&lt;br /&gt;
&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&lt;br /&gt;
&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&lt;br /&gt;
&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&lt;br /&gt;
&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&lt;br /&gt;
&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12343</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12343"/>
				<updated>2006-11-11T15:52:06Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&lt;br /&gt;
&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&lt;br /&gt;
&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&lt;br /&gt;
&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&lt;br /&gt;
&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&lt;br /&gt;
&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12342</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12342"/>
				<updated>2006-11-11T15:51:28Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&lt;br /&gt;
&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&lt;br /&gt;
&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&lt;br /&gt;
&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&lt;br /&gt;
&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&lt;br /&gt;
&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12341</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12341"/>
				<updated>2006-11-11T15:50:50Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Brief Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&lt;br /&gt;
&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&lt;br /&gt;
&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12340</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12340"/>
				<updated>2006-11-11T15:50:09Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12339</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12339"/>
				<updated>2006-11-11T15:47:53Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session ID Prediction'''&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
In the case an attacker has been able to retrieve the application source code by exploiting a previosly discovered vulnerability (e.g. directory traversal), or from a web repository (Open Source Applications), could be possible to perform refined attacks against the implementation of the authentication process.&lt;br /&gt;
&lt;br /&gt;
In the following example (PHPBB 2.0.13 - Authentication Bypass Vulnerability), at line 5 unserialize() function parse user supplied cookie and set values inside $row array. At line 10 user md5 password hash stored inside the backend database is compared to the one supplied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;1.  if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ||&lt;br /&gt;
2.  {&lt;br /&gt;
3.  $sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ?&lt;br /&gt;
4. &lt;br /&gt;
5.  unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();&lt;br /&gt;
6. &lt;br /&gt;
7.  $sessionmethod = SESSION_METHOD_COOKIE;&lt;br /&gt;
8.  }&lt;br /&gt;
9. &lt;br /&gt;
10. if( md5($password) == $row['user_password'] &amp;amp;&amp;amp; $row['user_active'] )&lt;br /&gt;
11. &lt;br /&gt;
12. {&lt;br /&gt;
13. $autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;&lt;br /&gt;
14. }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In PHP a comparison between a string value and a boolean value (1 - &amp;quot;TRUE&amp;quot;) is always &amp;quot;TRUE&amp;quot;, so supplying the following string (important part is &amp;quot;b:1&amp;quot;) to the userialize() function is possible to bypass the authentication control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a:2:{s:11:&amp;quot;autologinid&amp;quot;;b:1;s:6:&amp;quot;userid&amp;quot;;s:1:&amp;quot;2&amp;quot;;}&amp;lt;/pre&amp;gt;&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12329</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12329"/>
				<updated>2006-11-11T15:24:40Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12328</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12328"/>
				<updated>2006-11-11T15:24:24Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12327</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12327"/>
				<updated>2006-11-11T15:22:06Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Bypassing authentication schema methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
There are several methods to bypass the authentication schema in use by a web &lt;br /&gt;
&lt;br /&gt;
application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Bypassing authentication schema methods ===&lt;br /&gt;
&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe this technique into detail, because it's possible to find many dedicated paragraphs in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12326</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12326"/>
				<updated>2006-11-11T15:20:55Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Black Box testing and example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
There are several methods to bypass the authentication schema in use by a web &lt;br /&gt;
&lt;br /&gt;
application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Bypassing authentication schema methods ===&lt;br /&gt;
&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, &lt;br /&gt;
&lt;br /&gt;
otherwise if a user requests directly a different page     in the designed protected &lt;br /&gt;
&lt;br /&gt;
area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a &lt;br /&gt;
&lt;br /&gt;
succesful login upon fixed value parameters.&lt;br /&gt;
&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas &lt;br /&gt;
&lt;br /&gt;
without providing valid credentials.&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification &lt;br /&gt;
&lt;br /&gt;
values(SESSION ID). Therefore if Session ID generation is predictable a malicious &lt;br /&gt;
&lt;br /&gt;
user could be able to find a valid session ID and gain unauthorized access to the &lt;br /&gt;
&lt;br /&gt;
application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies increase linearly, so could be easy &lt;br /&gt;
&lt;br /&gt;
for an attacker to guess a valid session ID.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
In the following figure values inside cookies change only partially, so it's &lt;br /&gt;
&lt;br /&gt;
possible to restrict a bruteforce attack to the defined fields shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
SQL Injection is a widely known range of techniques. We are not going to describe &lt;br /&gt;
&lt;br /&gt;
this technique into detail, because it's possible to find many dedicated paragraphs &lt;br /&gt;
&lt;br /&gt;
in Owasp Testing Guide for either common and advanced readers.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows that with simple sql injection it's possible to bypass &lt;br /&gt;
&lt;br /&gt;
the authentication form.&lt;br /&gt;
The Example is obfuscated because it's part of OWASP WebGoat suite, and to let the &lt;br /&gt;
&lt;br /&gt;
reader experiment by himself without knowing the solution.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12324</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12324"/>
				<updated>2006-11-11T15:17:15Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Bypassing authentication schema methods ===&lt;br /&gt;
&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebScarab: http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project&lt;br /&gt;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12323</id>
		<title>Testing for Bypassing Authentication Schema (OTG-AUTHN-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004)&amp;diff=12323"/>
				<updated>2006-11-11T15:16:23Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
While most most application require authentication for gaining access to private information or tasks, not every authentication method is able to provide adequate security level.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Negligence, ignorance or simple understatement of the security threats often result in authentication schemes that can be easily bypassed by simply skipping the login page and directly calling an internal page that is supposed to be accessed only after authentication has been performed.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition to this it is often possible to bypass compulsory authentication tampering with requests and tricking the application into thinking that we're already authenticated either by modifying the given URL parameter or by manipulating form or by counterfeiting sessions.&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;
Problems related to Authentication Schema could be found at different stages of software development life cycle (SDLC), like design, development and deployment phase.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Examples of '''design errors''' include a wrong definition of application parts to be protected, the choice of not applying strong encryption protocols for securing authentication data exchange, and many more.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problems in development''' phase are for example the incorrect implementation of input validation functionalities, or not following the security best practices for the specific language.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In addition there are '''issues during application setup''' (Installation and configuration activities) due to a lack in required technical skills, or due to poor documentation available.&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;
There are several methods to bypass the authentication schema in use by a web application:&lt;br /&gt;
* Direct page request&lt;br /&gt;
* Parameter Modification&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
* Session Fixation&lt;br /&gt;
* Sql Injection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Bypassing authentication schema methods ===&lt;br /&gt;
&lt;br /&gt;
'''Direct page request'''&lt;br /&gt;
&lt;br /&gt;
Several web applications implement access control only inside the login page, otherwise if a user requests directly a different page     in the designed protected area, the authentication schema could be bypassed.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-directreq.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Parameter Modification'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another problem related to authentication design is to let the application verify a succesful login upon fixed value parameters.&lt;br /&gt;
&lt;br /&gt;
Therefore a user could modify these parameters to gain access to the protected areas without providing valid credentials.&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.site.com/page.asp?authenticated=no &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;raven@blackbox /home $nc www.site.com 80                    &lt;br /&gt;
GET /page.asp?authenticated=yes HTTP/1.0                    &lt;br /&gt;
                                                            &lt;br /&gt;
HTTP/1.1 200 OK                                             &lt;br /&gt;
Date: Sat, 11 Nov 2006 10:22:44 GMT                         &lt;br /&gt;
Server: Apache                                              &lt;br /&gt;
Connection: close                                           &lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1                 &lt;br /&gt;
                                                            &lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//IETF//DTD HTML 2.0//EN&amp;quot;&amp;gt;          &lt;br /&gt;
&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;                                                &lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;                                               &lt;br /&gt;
&amp;lt;H1&amp;gt;You Are Auhtenticated&amp;lt;/H1&amp;gt;                              &lt;br /&gt;
&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-parammod.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Session Issues'''&lt;br /&gt;
* Session ID Prediction&lt;br /&gt;
Many web applications manage authentication using session identification values(SESSION ID). Therefore if Session ID generation is predictable a malicious user could be able to find a valid session ID and gain unauthorized access to the application, impersonating  a previously authenticated user.&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sessid2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sql Injection (HTML Form Authentication)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:basm-sqlinj2.gif]]&lt;br /&gt;
&lt;br /&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;
* WebGoat: http://www.owasp.org/index.php/OWASP_WebGoat_Project&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12309</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=12309"/>
				<updated>2006-11-11T14:14:16Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Private sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
To leverage different bruteforcing attacks it's important to discover the type of authentication method used by the application, because the techniques and the tools to be used may change.&lt;br /&gt;
&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Digest Access Authentication&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1. Here is an example of the initial Response header when handling an HTTP Digest target:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Unauthorized&lt;br /&gt;
WWW-Authenticate: Digest realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
         nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
         opaque=&amp;quot;0000000000000000&amp;quot;, \&lt;br /&gt;
         stale=false, &lt;br /&gt;
         algorithm=MD5, &lt;br /&gt;
         qop=&amp;quot;auth&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The Subsequent response headers with valid credentials would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization:  Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
        realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
        qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
        algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
        uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
        nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
        nc=00000001, &lt;br /&gt;
        cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
        opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
        response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTML Form-based Authentication'''&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure.&lt;br /&gt;
&lt;br /&gt;
Source code taken from a HTML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;form method=&amp;quot;POST&amp;quot; action=&amp;quot;login&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;text&amp;quot; name&amp;quot;username&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;password&amp;quot; name=&amp;quot;password&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bruteforce Attacks ===&lt;br /&gt;
&lt;br /&gt;
After having listed the different types of authentication methods in web application, we will explain several bruteforce attacks which can be carried out.&lt;br /&gt;
&lt;br /&gt;
* Dictionary Attack&lt;br /&gt;
Dictionary-based attacks consist of automated scripts and tools that will try to guess username and passwords from a dictionary file. Dictionary file can be tuned and compiled to cover words probably used by the owner of the account a malicious user is going to attack. &lt;br /&gt;
The attacker can previously perform some investigations to understand user's interests, or build a list of all unique words available on the website.&lt;br /&gt;
&lt;br /&gt;
* Search Attacks&lt;br /&gt;
Search attacks will try to cover all possible combination of a given character set and a given password lenght range. This kind of attack is very slow because the space of possible candidates is quite big. For example given a known user id, the total number of passwords to try up to 8 characters in lenght is equal to 26^(8!) in a lower alpha charset (more than 200 billions of different passwords!). &lt;br /&gt;
&lt;br /&gt;
* Rule-based search attacks&lt;br /&gt;
To increase combination space coverage without slowing too much the process it's suggested to create good rules to generate candidates. &lt;br /&gt;
For example &amp;quot;John the Ripper&amp;quot; can generate password variations from part of the username or modify through a preconfigured mask words in input (e.g. 1st round &amp;quot;pen&amp;quot; --&amp;gt; 2nd round &amp;quot;p3n&amp;quot; --&amp;gt; 3rd round &amp;quot;p3np3n&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTTP Basic Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com http-head /private/&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org) starting at 2009-07-04 18:15:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-head on port 80&lt;br /&gt;
[STATUS] 792.00 tries/min, 792 tries in 00:01h, 846 todo in 00:02h&lt;br /&gt;
[80][www] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 18:16:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Bruteforcing HTML Form Based Authentication'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com  https-post-form&lt;br /&gt;
 &amp;quot;/index.cgi:login&amp;amp;name=^USER^&amp;amp;password=^PASS^&amp;amp;login=Login:Not allowed&amp;quot; &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.&lt;br /&gt;
Hydra (http://www.thc.org)starting at 2009-07-04 19:16:17&lt;br /&gt;
[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task&lt;br /&gt;
[DATA] attacking service http-post-form on port 443&lt;br /&gt;
[STATUS] attack finished for wiki.intranet (waiting for childs to finish)&lt;br /&gt;
[443] host: 10.0.0.1   login: owasp   password: password&lt;br /&gt;
[STATUS] attack finished for www.site.com (waiting for childs to finish)&lt;br /&gt;
Hydra (http://www.thc.org) finished at 2009-07-04 19:18:34&lt;br /&gt;
&lt;br /&gt;
raven@blackbox /hydra $&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
TD - Having Partial knowledge of password and account details (e.g. lenght or charset)&lt;br /&gt;
&lt;br /&gt;
TD - Memory Trade Off Attacks&lt;br /&gt;
&lt;br /&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;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* THC Hydra:        http://www.thc.org/thc-hydra/&lt;br /&gt;
* John the Ripper:  http://www.openwall.com/john/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=11644</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=11644"/>
				<updated>2006-11-04T14:45:53Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Discovery Authentication Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Inner sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
* Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1) Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Digest Access Authentication'''&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure. Chiefly amongst these are: &lt;br /&gt;
&lt;br /&gt;
* Requirements for users to more fully identify themselves uniquely, beyond simple user name and password fields.&lt;br /&gt;
* To provide a robust defence against brute force type attacks.&lt;br /&gt;
* To better handle the client-server sessions, particularly their cancellation and expiry.&lt;br /&gt;
* To overcome the nuances of a distributed, load-balanced site architecture, and client-side caching or proxy services.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization: 	Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
		realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
		qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
		algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
		uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
		nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
		nc=00000001, &lt;br /&gt;
		cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
		opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
		response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;								&lt;br /&gt;
&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=11643</id>
		<title>Testing for Brute Force (OWASP-AT-004)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Brute_Force_(OWASP-AT-004)&amp;diff=11643"/>
				<updated>2006-11-04T14:45:15Z</updated>
		
		<summary type="html">&lt;p&gt;Alombardini: /* Discovery Authentication Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Brute-forcing consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In web application testing, the problem we are going to face with the most is very often connected with the need of having a valid user account to access the inner part of the application.&lt;br /&gt;
Therefore we are going to check different types of authentication schema and the effectiveness of different brute-force  attacks.&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;
A great majority of web applications provide a way for users to authenticate themselves. By having knowledge of user's identity it's possible to create protected areas or more generally, to have the application behave differently upon the logon of different users.&lt;br /&gt;
Actually there are several methods for a user to authenticate to a system like certificates, biometric devices, OTP (One Time Password) tokens, but in web application we usually find a combination of user ID and password. Therefore it's possible to carry out an attack to retrieve a valid user account and password, by trying to enumerate many (ex. dictionary attack) or the whole space of possible candidates.&lt;br /&gt;
&lt;br /&gt;
After a successful bruteforce attack, a malicious user could have access to:&lt;br /&gt;
&lt;br /&gt;
* Confidential information / data;&lt;br /&gt;
** Private sections of a web application, could disclose confidential documents, user's profile data, financial status, bank details, user's relationships, etc..&lt;br /&gt;
	&lt;br /&gt;
* Administration panels;&lt;br /&gt;
** These sections are used by webmasters to manage (modify, delete, add) web application content, manage user provisioning, assign different privileges to the users, etc..&lt;br /&gt;
&lt;br /&gt;
* Availability of further attack vectors;&lt;br /&gt;
** Inner sections of a web application could hide dangerous vulnerabilities and contain advanced functionalities not available to public users.&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Discovery Authentication Methods ===&lt;br /&gt;
&lt;br /&gt;
Unless an entity decides to apply a sophisticated web authentication, the two most commonly see methods are as follows:&lt;br /&gt;
&lt;br /&gt;
* HTTP Authentication;&lt;br /&gt;
** Basic Access Authentication&lt;br /&gt;
** Digest Access Authentication&lt;br /&gt;
* HTML Form-based Authentication;&lt;br /&gt;
&lt;br /&gt;
The following sections provide some good information on identifying the authentication mechanism employed during a blackbox test.&lt;br /&gt;
&lt;br /&gt;
'''HTTP authentication'''&lt;br /&gt;
&lt;br /&gt;
There are two native HTTP access authentication schemes available to an organisation – Basic and Digest. &lt;br /&gt;
&lt;br /&gt;
* Basic Access Authentication&lt;br /&gt;
&lt;br /&gt;
Basic Access Authentication assumes the client will identify themselves with a login name (&amp;quot;owasp&amp;quot;) and password (&amp;quot;password&amp;quot;). When the client browser initially accesses a site using this scheme, the web server will reply with a 401 response containing a “WWW-Authenticate” tag containing a value of “Basic” and the name of the protected realm (e.g. WWW-Authenticate: Basic realm=&amp;quot;wwwProtectedSite”). The client browser will then prompt the user for their login name and password for that realm. The client browser then responds to the web server with an “Authorization” tag, containing the value “Basic” and the base64-encoded concatenation of the login name, a colon, and the password (e.g. Authorization: Basic b3dhc3A6cGFzc3dvcmQ=). Unfortunately, the authentication reply can be easily decrypted should an attacker sniff the transmission.&lt;br /&gt;
&lt;br /&gt;
* Request and Response Test:&lt;br /&gt;
&lt;br /&gt;
1) Client sends standard HTTP request for resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. The web server states that the requested resource is located in a protected directory.&lt;br /&gt;
&lt;br /&gt;
3. Server Sends Response with HTTP 401 Authorization Required:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 401 Authorization Required&lt;br /&gt;
Date: Sat, 04 Nov 2006 12:52:40 GMT&lt;br /&gt;
WWW-Authenticate: Basic realm=&amp;quot;User Realm&amp;quot;&lt;br /&gt;
Content-Length: 401&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Browser displays challenge pop-up for username and password data entry.&lt;br /&gt;
&lt;br /&gt;
5. Client Resubmits HTTP Request with credentials included:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /members/docs/file.pdf HTTP/1.1&lt;br /&gt;
Host: target&lt;br /&gt;
Authorization: Basic b3dhc3A6cGFzc3dvcmQ=&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
6. Server compares client information to its credentials list.&lt;br /&gt;
&lt;br /&gt;
7. If the credentials are valid the server sends the requested content. If authorization fails the server resends HTTP status code 401 in the response header. If the user clicks Cancel the browser will likely display an error message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The string QWRtaW46Zm9vYmFy== symply base64 decodes as follows:&lt;br /&gt;
Base64 Decoded : owasp:password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Digest Access Authentication'''&lt;br /&gt;
&lt;br /&gt;
Digest Access Authentication expands upon the security of Basic Access Authentication by using a one-way cryptographic hashing algorithm (MD5) to encrypt authentication data and, secondly, adding a single use (connection unique) “nonce” value set by the web server. This value is used by the client browser in the calculation of a hashed password response. While the password is obscured by the use of the cryptographic hashing and the use of the nonce value precludes the threat of a replay attack, the login name is submitted in clear text.&lt;br /&gt;
&lt;br /&gt;
However, while both HTTP access authentication schemes may appear suitable for commercial use over the Internet, particularly when used over an SSL encrypted session, many organisations have chosen to utilise custom HTML and application level authentication procedures in order to provide a more sophisticated authentication procedure. Chiefly amongst these are: &lt;br /&gt;
&lt;br /&gt;
* Requirements for users to more fully identify themselves uniquely, beyond simple user name and password fields.&lt;br /&gt;
* To provide a robust defence against brute force type attacks.&lt;br /&gt;
* To better handle the client-server sessions, particularly their cancellation and expiry.&lt;br /&gt;
* To overcome the nuances of a distributed, load-balanced site architecture, and client-side caching or proxy services.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /example/owasp/test.asmx HTTP/1.1&lt;br /&gt;
Accept: */*&lt;br /&gt;
Authorization: 	Digest username=&amp;quot;owasp&amp;quot;, &lt;br /&gt;
								realm=&amp;quot;OwaspSample&amp;quot;, &lt;br /&gt;
								qop=&amp;quot;auth&amp;quot;, &lt;br /&gt;
								algorithm=&amp;quot;MD5&amp;quot;, &lt;br /&gt;
								uri=&amp;quot;/example/owasp/test.asmx&amp;quot;, &lt;br /&gt;
								nonce=&amp;quot;Ny8yLzIwMDIgMzoyNjoyNCBQTQ&amp;quot;, &lt;br /&gt;
								nc=00000001, &lt;br /&gt;
								cnonce=&amp;quot;c51b5139556f939768f770dab8e5277a&amp;quot;, &lt;br /&gt;
								opaque=&amp;quot;0000000000000000&amp;quot;, &lt;br /&gt;
								response=&amp;quot;2275a9ca7b2dadf252afc79923cd3823&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;								&lt;br /&gt;
&lt;br /&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;
...&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;br /&gt;
[[OWASP Testing Guide v2 Table of Contents]]&lt;br /&gt;
{{Template:Stub}}&lt;/div&gt;</summary>
		<author><name>Alombardini</name></author>	</entry>

	</feed>