<?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=Tusharvartak</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=Tusharvartak"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Tusharvartak"/>
		<updated>2026-04-29T19:18:08Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Error_Code_(OTG-ERR-001)&amp;diff=16680</id>
		<title>Testing for Error Code (OTG-ERR-001)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Error_Code_(OTG-ERR-001)&amp;diff=16680"/>
				<updated>2007-02-23T03:24:17Z</updated>
		
		<summary type="html">&lt;p&gt;Tusharvartak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]] &amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Often during a penetration test on web applications we come up against many error codes generated from applications or web servers.&lt;br /&gt;
It's possible to cause these errors to be displayed by using a particular request, either specially crafted with tools or created manually.&lt;br /&gt;
These codes are very useful to penetration testers during their activities because they reveal a lot of information about databases, bugs, and other technological components directly linked with web applications.&lt;br /&gt;
Within this section we'll analyse the more common codes (error messages) and bring into focus the steps of vulnerability assessment.&lt;br /&gt;
The most important aspect for this activity is to focus one's attention on these errors, seeing them as a collection of information that will aid in the next steps of our analysis. A good collection can facilitate assessment efficiency by decreasing the overall time taken to perform the penetration test.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue ==&lt;br /&gt;
&lt;br /&gt;
A common error that we can see during our search is the HTTP 404 Not Found.&lt;br /&gt;
Often this error code provides useful details about the underlying web server and associated components. For example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Not Found&lt;br /&gt;
The requested URL /page.html was not found on this server.&lt;br /&gt;
Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g  DAV/2 PHP/5.1.2 Server at localhost Port 80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This error message can be generated by requesting a non-existant URL.&lt;br /&gt;
After the common message that shows a page not found, there is information about web server version, OS, modules and other products used.&lt;br /&gt;
This information can be very important from an OS and application type and version identification point of view.&lt;br /&gt;
&lt;br /&gt;
Web server errors aren't the only useful output returned requiring security analysis. Consider the next example error message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)&lt;br /&gt;
[DBNETLIB][ConnectionOpen(Connect())] - SQL server does not exist or access denied &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What happened? We will explain step-by-step below.&lt;br /&gt;
&lt;br /&gt;
In this example, the 80004005 is a generic IIS error code which indicates that it could not establish a connection to its associated database. In many cases, the error message will detail the type of the database. This will often indicate the underlying operating system by association. With this information, the penetration tester can plan an appropriate strategy for the security test.&lt;br /&gt;
&lt;br /&gt;
By manipulating the variables that are passed to the database connect string, we can invoke more detailed errors.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers error '80004005'&lt;br /&gt;
[Microsoft][ODBC Access 97 ODBC driver Driver]General error Unable to open registry key 'DriverId'&lt;br /&gt;
&amp;lt;/pre&amp;gt; 	&lt;br /&gt;
&lt;br /&gt;
In this example, we can see a generic error in the same situation which reveals the type and version of the associated database system and a dependence on Windows operating system registry key values.&lt;br /&gt;
&lt;br /&gt;
Now we will look at a practical example with a security test against a web application that loses its link to its database server and does not handle the exception in a controlled manner. This could be caused by a database name resolution issue, processing of unexpected variable values, or other network problems.&lt;br /&gt;
&lt;br /&gt;
Consider the scenario where we have a database administration web portal which can be used as a front end GUI to issue database queries, create tables and modify database fields. During POST of the logon credentials, the following error message is presented to the penetration tester that which indicates the presence of a MySQL database server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)&lt;br /&gt;
[MySQL][ODBC 3.51 Driver]Unknown MySQL server host&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
If we see in the HTML code of the logon page the presence of a '''hidden field''' with a database IP, we can try to change this value in the URL with the address of database server under the penetration tester's control in an attempt to fool the application into thinking that logon was successful.&lt;br /&gt;
&lt;br /&gt;
Another example: knowing the database server that services a web application, we can take advantage of this information to carry out a SQL Injection for that kind of database or a persistent XSS test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Error Handling in IIS and ASP .net'''&lt;br /&gt;
&lt;br /&gt;
ASP .net is a common framework from Microsoft used for developing web applications. IIS is one of the commonly used web server. Errors occur in all applications, we try to trap most errors but it is alomst impossible to cover each and every exception. &lt;br /&gt;
&lt;br /&gt;
IIS uses a set of custom error pages generally found in c:\winnt\help\iishelp\common to display errors like '404 page not found' to the user. These default pages can be changed and custom errors can be configured for IIS server. when IIS receives request for an aspx page it is passed on to the dot net framework.&lt;br /&gt;
&lt;br /&gt;
There are various ways by which errors can be handled in dot net framework. Errors are handled at three places in ASP .net &lt;br /&gt;
&lt;br /&gt;
1. Inside Web.config customErrors section&lt;br /&gt;
2. Inside global.asax Application_Error Sub&lt;br /&gt;
3. at the the aspx or associated codebehind page in the Page_Error sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Handling errors using web.config'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;customErrors defaultRedirect=&amp;quot;myerrorpagedefault.aspx&amp;quot; mode=&amp;quot;On|Off|RemoteOnly&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;myerrorpagefor404.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;error statusCode=&amp;quot;500&amp;quot; redirect=&amp;quot;myerrorpagefor500.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/customErrors&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mode=&amp;quot;On&amp;quot; will turn on custom errors. mode=RemoteOnly will show custome errors to the remote web application users. a user accessing the server locally will be presented by the complete stack trace and custom errors will not be shown to him.&lt;br /&gt;
&lt;br /&gt;
all the errors unless explicitly specified will be brought to defaultRedirect i.e. myerrorpagedefault.aspx. &lt;br /&gt;
&lt;br /&gt;
a statuscode 404 will be shown myerrorpagefor404.aspx.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Handling errors in Global.asax'''&lt;br /&gt;
&lt;br /&gt;
When an error occurs, the Application_Error sub is called. A developer can write code for error handling / page redirection in this sub.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Private Sub Application_Error (ByVal sender As Object, ByVal e As System.EventArgs) &lt;br /&gt;
     Handles MyBase.Error&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''''Handling errors in Page_Error sub'''&lt;br /&gt;
&lt;br /&gt;
This is similiar to application error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Private Sub Page_Error (ByVal sender As Object, ByVal e As System.EventArgs) &lt;br /&gt;
     Handles MyBase.Error&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Error hierarchy in ASP .net'''&lt;br /&gt;
&lt;br /&gt;
Page_Error sub will be processed first, global.asax Application_Error sub and finally customErrors section in web.config file will be processed.&lt;br /&gt;
&lt;br /&gt;
Information Gathering on web applications with server-side technology is quite difficult, but the information discovered can be useful for the correct execution of an attempted exploit (for example, SQL injection or Cross Site Scripting (XSS) attacks)and can reduce false positives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to test for ASP.net and IIS Error Handling'''&lt;br /&gt;
&lt;br /&gt;
Fire up your browser and type a random page name &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Http:\\www.mywebserver.com\anyrandomname.asp&lt;br /&gt;
&amp;lt;\pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the server returns &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The page cannot be found&lt;br /&gt;
&lt;br /&gt;
HTTP 404 - File not found&lt;br /&gt;
Internet Information Services&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it means IIS custom errors are not configured. Please note the .asp extension.&lt;br /&gt;
&lt;br /&gt;
Also test for .net custom errors. type a random page name with aspx extension in your browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Http:\\www.mywebserver.com\anyrandomname.'''aspx'''&lt;br /&gt;
&amp;lt;\pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the server returns&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Server Error in '/' Application.&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
The resource cannot be found. &lt;br /&gt;
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
custom errors for .net are not configured.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet &amp;lt;host target&amp;gt; 80&lt;br /&gt;
GET /&amp;lt;wrong page&amp;gt; HTTP/1.1&lt;br /&gt;
&amp;lt;CRLF&amp;gt;&amp;lt;CRLF&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 404 Not Found&lt;br /&gt;
Date: Sat, 04 Nov 2006 15:26:48 GMT&lt;br /&gt;
Server: Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g&lt;br /&gt;
Content-Length: 310&lt;br /&gt;
Connection: close&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Network problems&lt;br /&gt;
2. Bad configuration about host database address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005) '&lt;br /&gt;
[MySQL][ODBC 3.51 Driver]Unknown MySQL server host&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Authentication failed&lt;br /&gt;
2. Credentials not inserted&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&lt;br /&gt;
Firewall version used for authentication:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error 407&lt;br /&gt;
FW-1 at &amp;lt;firewall&amp;gt;: Unauthorized to access the document.&lt;br /&gt;
•  Authorization is needed for FW-1.&lt;br /&gt;
•  The authentication required by FW-1 is: unknown.&lt;br /&gt;
•  Reason for failure of last attempt: no user&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&lt;br /&gt;
Enumeration of the directories with access denied:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://&amp;lt;host&amp;gt;/&amp;lt;dir&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Directory Listing Denied&lt;br /&gt;
This Virtual Directory does not allow contents to be listed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Forbidden&lt;br /&gt;
You don't have permission to access /&amp;lt;dir&amp;gt; on this server.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [1] [[http://www.ietf.org/rfc/rfc2616.txt?number=2616 RFC2616]] Hypertext Transfer Protocol -- HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Tusharvartak</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_Guide_Frontispiece&amp;diff=16679</id>
		<title>Testing Guide Frontispiece</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_Guide_Frontispiece&amp;diff=16679"/>
				<updated>2007-02-23T03:09:13Z</updated>
		
		<summary type="html">&lt;p&gt;Tusharvartak: /* Authors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Welcome to the OWASP Testing Guide 2.0==&lt;br /&gt;
“Open and collaborative knowledge: that’s the OWASP way”&amp;lt;br&amp;gt;&lt;br /&gt;
-- [[User:Mmeucci|Matteo Meucci]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OWASP thanks the many authors, reviewers, and editors for their hard work in bringing this guide to where it is today. If you have any comments or suggestions on the Testing Guide, please e-mail the Testing Guide mail list:&lt;br /&gt;
&lt;br /&gt;
 http://lists.owasp.org/mailman/listinfo/owasp-testing&lt;br /&gt;
&lt;br /&gt;
==Copyright and License==&lt;br /&gt;
&lt;br /&gt;
Copyright (c) 2006 The OWASP Foundation.&lt;br /&gt;
&lt;br /&gt;
This document is released under the [http://creativecommons.org/licenses/by-sa/2.5/ Creative Commons 2.5 License]. Please read and understand the license and copyright conditions.&lt;br /&gt;
&lt;br /&gt;
==Revision History ==&lt;br /&gt;
&lt;br /&gt;
The Testing guide originated in 2003 with Dan Cuthbert as one of the original editors. It was handed over to Eoin Keary in 2005 and transformed into a wiki. Matteo Meucci has decided to take on the Testing guide and is now the lead of the OWASP Testing Guide Autumn of Code (AoC) effort.&lt;br /&gt;
&lt;br /&gt;
; December 25, 2006&lt;br /&gt;
: &amp;quot;OWASP Testing Guide&amp;quot;, Version 2.0&lt;br /&gt;
&lt;br /&gt;
; July 14, 2004&lt;br /&gt;
: &amp;quot;OWASP Web Application Penetration Checklist&amp;quot;, Version 1.1&lt;br /&gt;
&lt;br /&gt;
; December 2004&lt;br /&gt;
: &amp;quot;The OWASP Testing Guide&amp;quot;, Version 1.0&lt;br /&gt;
&lt;br /&gt;
== Editors ==&lt;br /&gt;
'''Eoin Keary''': OWASP Testing Guide 2005-2007 Lead.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Matteo Meucci''': OWASP Testing Guide &amp;quot;Autumn of Code&amp;quot; 2006 Lead. Testing Guide 2007 Lead. &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Authors ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; &lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Vicente Aguilera&lt;br /&gt;
* Mauro Bregolin&lt;br /&gt;
* Tom Brennan&lt;br /&gt;
* Gary	Burns&lt;br /&gt;
* Luca Carettoni&lt;br /&gt;
* Dan Cornell&lt;br /&gt;
* Mark Curphey&lt;br /&gt;
* Daniel Cuthbert&lt;br /&gt;
* Sebastien Deleersnyder&lt;br /&gt;
* Stephen DeVries&lt;br /&gt;
* Stefano Di Paola&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* David	Endler&lt;br /&gt;
* Giorgio Fedon&lt;br /&gt;
* Javier Fernández-Sanguino&lt;br /&gt;
* Glyn Geoghegan&lt;br /&gt;
* Stan Guzik &lt;br /&gt;
* Madhura Halasgikar&lt;br /&gt;
* Eoin Keary&lt;br /&gt;
* David Litchfield&lt;br /&gt;
* Andrea Lombardini&lt;br /&gt;
* Ralph M. Los&lt;br /&gt;
* Claudio Merloni&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Matteo Meucci&lt;br /&gt;
* Marco	Morana&lt;br /&gt;
* Laura Nunez&lt;br /&gt;
* Gunter Ollmann&lt;br /&gt;
* Antonio Parata&lt;br /&gt;
* Yiannis Pavlosoglou&lt;br /&gt;
* Carlo Pelliccioni&lt;br /&gt;
* Harinath Pudipeddi&lt;br /&gt;
* Alberto Revelli&lt;br /&gt;
* Mark Roxberry&lt;br /&gt;
* Tom Ryan&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Anush Shetty&lt;br /&gt;
* Larry Shields&lt;br /&gt;
* Dafydd Studdard&lt;br /&gt;
* Andrew van der Stock&lt;br /&gt;
* Ariel	Waissbein&lt;br /&gt;
* Jeff Williams&lt;br /&gt;
* Tushar Vartak&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reviewers ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; &lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Vicente Aguilera&lt;br /&gt;
* Marco Belotti&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Mauro Bregolin&lt;br /&gt;
* Marco Cova&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Daniel Cuthbert&lt;br /&gt;
* Paul Davies&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Stefano Di Paola&lt;br /&gt;
* Matteo G.P. Flora&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Simona Forti&lt;br /&gt;
* Darrell Groundy&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Eoin Keary&lt;br /&gt;
* James Kist&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Katie McDowell&lt;br /&gt;
* Marco Mella &lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Matteo Meucci&lt;br /&gt;
* Syed Mohamed A.&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Antonio Parata&lt;br /&gt;
* Alberto Revelli&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
* Mark Roxberry&lt;br /&gt;
* Dave Wichers&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Trademarks==&lt;br /&gt;
&lt;br /&gt;
* Java, Java Web Server, and JSP are registered trademarks of Sun Microsystems, Inc.&lt;br /&gt;
* Merriam-Webster is a trademark of Merriam-Webster, Inc.&lt;br /&gt;
* Microsoft is a registered trademark of Microsoft Corporation.&lt;br /&gt;
* Octave is a service mark of Carnegie Mellon University.&lt;br /&gt;
* VeriSign and Thawte are registered trademarks of VeriSign, Inc.&lt;br /&gt;
* Visa is a registered trademark of VISA USA.&lt;br /&gt;
* OWASP is a registered trademark of the OWASP Foundation&lt;br /&gt;
&lt;br /&gt;
All other products and company names may be trademarks of their respective owners. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Tusharvartak</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Error_Code_(OTG-ERR-001)&amp;diff=16678</id>
		<title>Testing for Error Code (OTG-ERR-001)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Error_Code_(OTG-ERR-001)&amp;diff=16678"/>
				<updated>2007-02-23T03:07:56Z</updated>
		
		<summary type="html">&lt;p&gt;Tusharvartak: /* Description of the Issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[http://www.owasp.org/index.php/Web_Application_Penetration_Testing_AoC Up]] &amp;lt;br&amp;gt;&lt;br /&gt;
{{Template:OWASP Testing Guide v2}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Often during a penetration test on web applications we come up against many error codes generated from applications or web servers.&lt;br /&gt;
It's possible to cause these errors to be displayed by using a particular request, either specially crafted with tools or created manually.&lt;br /&gt;
These codes are very useful to penetration testers during their activities because they reveal a lot of information about databases, bugs, and other technological components directly linked with web applications.&lt;br /&gt;
Within this section we'll analyse the more common codes (error messages) and bring into focus the steps of vulnerability assessment.&lt;br /&gt;
The most important aspect for this activity is to focus one's attention on these errors, seeing them as a collection of information that will aid in the next steps of our analysis. A good collection can facilitate assessment efficiency by decreasing the overall time taken to perform the penetration test.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue ==&lt;br /&gt;
&lt;br /&gt;
A common error that we can see during our search is the HTTP 404 Not Found.&lt;br /&gt;
Often this error code provides useful details about the underlying web server and associated components. For example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Not Found&lt;br /&gt;
The requested URL /page.html was not found on this server.&lt;br /&gt;
Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g  DAV/2 PHP/5.1.2 Server at localhost Port 80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This error message can be generated by requesting a non-existant URL.&lt;br /&gt;
After the common message that shows a page not found, there is information about web server version, OS, modules and other products used.&lt;br /&gt;
This information can be very important from an OS and application type and version identification point of view.&lt;br /&gt;
&lt;br /&gt;
Web server errors aren't the only useful output returned requiring security analysis. Consider the next example error message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)&lt;br /&gt;
[DBNETLIB][ConnectionOpen(Connect())] - SQL server does not exist or access denied &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What happened? We will explain step-by-step below.&lt;br /&gt;
&lt;br /&gt;
In this example, the 80004005 is a generic IIS error code which indicates that it could not establish a connection to its associated database. In many cases, the error message will detail the type of the database. This will often indicate the underlying operating system by association. With this information, the penetration tester can plan an appropriate strategy for the security test.&lt;br /&gt;
&lt;br /&gt;
By manipulating the variables that are passed to the database connect string, we can invoke more detailed errors.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers error '80004005'&lt;br /&gt;
[Microsoft][ODBC Access 97 ODBC driver Driver]General error Unable to open registry key 'DriverId'&lt;br /&gt;
&amp;lt;/pre&amp;gt; 	&lt;br /&gt;
&lt;br /&gt;
In this example, we can see a generic error in the same situation which reveals the type and version of the associated database system and a dependence on Windows operating system registry key values.&lt;br /&gt;
&lt;br /&gt;
Now we will look at a practical example with a security test against a web application that loses its link to its database server and does not handle the exception in a controlled manner. This could be caused by a database name resolution issue, processing of unexpected variable values, or other network problems.&lt;br /&gt;
&lt;br /&gt;
Consider the scenario where we have a database administration web portal which can be used as a front end GUI to issue database queries, create tables and modify database fields. During POST of the logon credentials, the following error message is presented to the penetration tester that which indicates the presence of a MySQL database server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)&lt;br /&gt;
[MySQL][ODBC 3.51 Driver]Unknown MySQL server host&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
If we see in the HTML code of the logon page the presence of a '''hidden field''' with a database IP, we can try to change this value in the URL with the address of database server under the penetration tester's control in an attempt to fool the application into thinking that logon was successful.&lt;br /&gt;
&lt;br /&gt;
Another example: knowing the database server that services a web application, we can take advantage of this information to carry out a SQL Injection for that kind of database or a persistent XSS test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Error Handling in IIS and ASP .net'''&lt;br /&gt;
&lt;br /&gt;
ASP .net is a common framework from Microsoft used for developing web applications. IIS is one of the commonly used web server. Errors occur in all applications, we try to trap most errors but it is alomst impossible to cover each and every exception. &lt;br /&gt;
&lt;br /&gt;
IIS uses a set of custom error pages generally found in c:\winnt\help\iishelp\common to display errors like '404 page not found' to the user. These default pages can be changed and custom errors can be configured for IIS server. when IIS receives request for an aspx page it is passed on to the dot net framework.&lt;br /&gt;
&lt;br /&gt;
There are various ways by which errors can be handled in dot net framework. Errors are handled at three places in ASP .net &lt;br /&gt;
&lt;br /&gt;
1. Inside Web.config customErrors section&lt;br /&gt;
2. Inside global.asax Application_Error Sub&lt;br /&gt;
3. at the the aspx or associated codebehind page in the Page_Error sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Handling errors using web.config'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;customErrors defaultRedirect=&amp;quot;myerrorpagedefault.aspx&amp;quot; mode=&amp;quot;On|Off|RemoteOnly&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;myerrorpagefor404.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;error statusCode=&amp;quot;500&amp;quot; redirect=&amp;quot;myerrorpagefor500.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/customErrors&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mode=&amp;quot;On&amp;quot; will turn on custom errors. mode=RemoteOnly will show custome errors to the remote web application users. a user accessing the server locally will be presented by the complete stack trace and custom errors will not be shown to him.&lt;br /&gt;
&lt;br /&gt;
all the errors unless explicitly specified will be brought to defaultRedirect i.e. myerrorpagedefault.aspx. &lt;br /&gt;
&lt;br /&gt;
a statuscode 404 will be shown myerrorpagefor404.aspx.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Handling errors in Global.asax'''&lt;br /&gt;
&lt;br /&gt;
When an error occurs, the Application_Error sub is called. A developer can write code for error handling / page redirection in this sub.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Private Sub Application_Error (ByVal sender As Object, ByVal e As System.EventArgs) &lt;br /&gt;
     Handles MyBase.Error&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''''Handling errors in Page_Error sub'''&lt;br /&gt;
&lt;br /&gt;
This is similiar to application error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Private Sub Page_Error (ByVal sender As Object, ByVal e As System.EventArgs) &lt;br /&gt;
     Handles MyBase.Error&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Error hierarchy in ASP .net'''&lt;br /&gt;
&lt;br /&gt;
Page_Error sub will be processed first, global.asax Application_Error sub and finally customErrors section in web.config file will be processed.&lt;br /&gt;
&lt;br /&gt;
Information Gathering on web applications with server-side technology is quite difficult, but the information discovered can be useful for the correct execution of an attempted exploit (for example, SQL injection or Cross Site Scripting (XSS) attacks)and can reduce false positives.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet &amp;lt;host target&amp;gt; 80&lt;br /&gt;
GET /&amp;lt;wrong page&amp;gt; HTTP/1.1&lt;br /&gt;
&amp;lt;CRLF&amp;gt;&amp;lt;CRLF&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 404 Not Found&lt;br /&gt;
Date: Sat, 04 Nov 2006 15:26:48 GMT&lt;br /&gt;
Server: Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g&lt;br /&gt;
Content-Length: 310&lt;br /&gt;
Connection: close&lt;br /&gt;
Content-Type: text/html; charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Network problems&lt;br /&gt;
2. Bad configuration about host database address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Microsoft OLE DB Provider for ODBC Drivers (0x80004005) '&lt;br /&gt;
[MySQL][ODBC 3.51 Driver]Unknown MySQL server host&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Authentication failed&lt;br /&gt;
2. Credentials not inserted&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&lt;br /&gt;
Firewall version used for authentication:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error 407&lt;br /&gt;
FW-1 at &amp;lt;firewall&amp;gt;: Unauthorized to access the document.&lt;br /&gt;
•  Authorization is needed for FW-1.&lt;br /&gt;
•  The authentication required by FW-1 is: unknown.&lt;br /&gt;
•  Reason for failure of last attempt: no user&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
'''Test:'''&lt;br /&gt;
&lt;br /&gt;
Enumeration of the directories with access denied:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://&amp;lt;host&amp;gt;/&amp;lt;dir&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Result:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Directory Listing Denied&lt;br /&gt;
This Virtual Directory does not allow contents to be listed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Forbidden&lt;br /&gt;
You don't have permission to access /&amp;lt;dir&amp;gt; on this server.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [1] [[http://www.ietf.org/rfc/rfc2616.txt?number=2616 RFC2616]] Hypertext Transfer Protocol -- HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Category:OWASP Testing Project AoC}}&lt;/div&gt;</summary>
		<author><name>Tusharvartak</name></author>	</entry>

	</feed>