<?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=Ari+Elias-Bachrach</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=Ari+Elias-Bachrach"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Ari_Elias-Bachrach"/>
		<updated>2026-04-21T20:21:51Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:Java&amp;diff=223051</id>
		<title>Category:Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:Java&amp;diff=223051"/>
				<updated>2016-11-04T17:26:16Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: /* Validation */ adding apache commons validator&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Main =&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;
&lt;br /&gt;
== About ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Java™ and JVM Technology Knowledge Base is the clearing house for all information related to building secure web/distributed applications and services based on Java and JVM technologies. The focus of these pages is on guidance for developers and architects using Java frameworks and JVM based technologies for web application development, on OWASP components that use Java and on participation in OWASP projects that use Java and JVM technologies. Moreover, we aim to provide security related guidance for system administrators managing Java and JVM based applications and tools.&lt;br /&gt;
&lt;br /&gt;
The project is not limited to Java. It aims to also address topics around the JVM in general.&lt;br /&gt;
&lt;br /&gt;
Community content is key to security information. The project depends on content from developers throughout the Java and JVM ecosystem.&lt;br /&gt;
&lt;br /&gt;
==Purpose==&lt;br /&gt;
&lt;br /&gt;
* Provide deep, rich guidance for Java developers in using the security features of Java and of Java frameworks.&lt;br /&gt;
* Address security in relation to the Java Virtual Machine and derived technologies.&lt;br /&gt;
* Guide system administrators in managing Java and JVM related components and applications.&lt;br /&gt;
* Create guidance for use of OWASP components that are designed for use with Java or other JVM languages.&lt;br /&gt;
* Focus on information about working with and on OWASP tools built using Java or other JVM technologies.&lt;br /&gt;
* Provide a stream of security related information, like vulnerabilities and security patches, related to the Java and JVM universe.&lt;br /&gt;
* Build an ecosystem allowing to all actors interested to discuss, share and learn.&lt;br /&gt;
&lt;br /&gt;
== Licensing ==&lt;br /&gt;
&lt;br /&gt;
OWASP Java™ and JVM Technology Knowledge Base is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
Oracle® and Java™ are [http://www.oracle.com/us/legal/trademarks/index.html|registered trademarks of Oracle] and/or its affiliates. Other names may be trademarks of their respective owners.&lt;br /&gt;
&lt;br /&gt;
== What's Hot! ==&lt;br /&gt;
&lt;br /&gt;
See the &amp;quot;Tasks and Roadmap&amp;quot; tab for more information. &lt;br /&gt;
&lt;br /&gt;
[[OWASP Java Project WIPRO 1 2015|Wiki Pages Review Operation - 2015/2016]]&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
[[File:OWASP_Java_Wiki_logo.png|frame]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Meta ==&lt;br /&gt;
&lt;br /&gt;
Last Update: '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Resources ==&lt;br /&gt;
&lt;br /&gt;
[http://lists.owasp.org/mailman/listinfo/java-project Mailing List]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/owasp GitHub (OWASP)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP_Project|OWASP Project Repository]]&lt;br /&gt;
* [[Language|Languages Repository]]&lt;br /&gt;
* [[OWASP_.NET_Project|.NET Project]]&lt;br /&gt;
* [[Ruby|Ruby]]&lt;br /&gt;
* [[PHP|PHP]]&lt;br /&gt;
* [[Perl|Perl]]&lt;br /&gt;
* [[Python|Python]]&lt;br /&gt;
* [[JavaScript|JavaScript]]&lt;br /&gt;
* [[C/C++|C/C++]]&lt;br /&gt;
* [[SQL|SQL, PL/SQL, DB Scripting]]&lt;br /&gt;
* [[OWASP_Internet_of_Things_Project|OWASP IoT Security]]&lt;br /&gt;
* [[OWASP_Mobile_Security_Project|OWASP Mobile Security]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Related OWASP Projects =&lt;br /&gt;
&lt;br /&gt;
== Security Tools ==&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; &lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_Dependency_Check|OWASP Dependency Check]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| Dependency-Check is a utility that identifies project dependencies and checks if there are any known, publicly disclosed, vulnerabilities. Currently &amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;, .NET, Ruby, Node.js, and Python projects are supported.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_SonarQube_Project|OWASP SonarQube Project]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| The first goal of the OWASP SonarQube Project is to a create a referential of check specifications targeting OWASP vulnerabilities that can be detected by SAST tools (Static Application Security Testing). From there, the second goal is to provide a reference implementations of most of those checks in the Open Source SonarQube language analyzers (&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;, JavaScript, PHP and C#). SonarQube is an Open Source platform for managing code quality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Secure Coding Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_AppSensor_Project|OWASP AppSensor]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| The AppSensor project defines a conceptual framework and methodology that offers prescriptive guidance to implement intrusion detection and automated response into applications.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[CSRFGuard|OWASP CSRFGuard]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| CSRFGuard is a Java library that implements a variant of the synchronizer token pattern to mitigate the risk of Cross-Site Request Forgery (CSRF) attacks. &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_Java_Encoder_Project|OWASP Java Encoder Project]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| The OWASP Java Encoder is a Java 1.5+ simple-to-use drop-in high-performance encoder class with no dependencies and little baggage. This project will help Java web developers defend against Cross Site Scripting.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_Java_HTML_Sanitizer|OWASP Java HTML Sanitizer]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| The OWASP HTML Sanitizer is a fast and easy to configure HTML Sanitizer written in Java which lets you include HTML authored by third-parties in your web application while protecting against XSS.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_Security_Logging_Project|OWASP Security Logging Project]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| The OWASP Security Logging project provides developers and ops personnel with APIs for logging security-related events. The aim is to let developers use the same set of logging APIs they are already familiar with from over a decade of experience with Log4J and its successors, while also adding powerful security features.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | [[OWASP_ESAPI|OWASP Enterprise Security API (ESAPI)]]&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;20&amp;quot; | &amp;amp;nbsp;&lt;br /&gt;
| ESAPI (The OWASP Enterprise Security API) for Java is a free, open source, web application security control library that makes it easier for programmers to write lower-risk applications. This project has seen major updates as recently as February 2016.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== General Documents ==&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
| [[OWASP_Secure_Coding_Practices_-_Quick_Reference_Guide|OWASP Secure Coding Practices - Quick Reference Guide]]&lt;br /&gt;
| [[OWASP_Codes_of_Conduct|OWASP Codes of Conduct]]&lt;br /&gt;
| [[Cheat_Sheets|OWASP Cheat Sheets Series]]&lt;br /&gt;
|- &lt;br /&gt;
| [[OWASP_Testing_Project|OWASP Testing Project]]&lt;br /&gt;
| [[OWASP_Top_Ten_Project|OWASP Web Top 10]]&lt;br /&gt;
| [[OWASP_Vulnerable_Web_Applications_Directory_Project|OWASP Vulnerable Web Applications Directory]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Related 3rd Party Projects =&lt;br /&gt;
&lt;br /&gt;
A list of third party (i.e. not part of Java SE or EE) security frameworks. This page contains a list of Java security libraries and frameworks and indicates which security features each library supports. &lt;br /&gt;
&lt;br /&gt;
==Enterprise==&lt;br /&gt;
* [http://shiro.apache.org/ Apache Shiro] is a Java security framework that performs authentication, authorization, cryptography, and session management. &lt;br /&gt;
* [http://projects.spring.io/spring-security/ Spring Security] provides security services for Java EE-based enterprise software applications. Services include authentication, authorization and protection against attacks like session fixation, clickjacking and cross site request forgery. &lt;br /&gt;
* [http://www.hdiv.org/ HDIV] A web application security framework that provides a number of functions.&lt;br /&gt;
&lt;br /&gt;
== Access Control (Authentication and Authorization) ==&lt;br /&gt;
* [http://oaccframework.org/ OACC] is an application security framework for Java designed for fine grained (object level) access control. OACC uses the abstraction of a ''resource'' for the application objects being secured. This key abstraction enables OACC to provide a rich API that includes grant, revoke and query capabilities for storing and managing the application's security relationships.&lt;br /&gt;
* [http://picketlink.org/appsecurity/ PicketLink]  provides authentication, single sign on, permission based access control and other security features.&lt;br /&gt;
&lt;br /&gt;
== Encryption ==&lt;br /&gt;
* [https://github.com/google/keyczar Keyczar] is an open source cryptographic toolkit designed to make it easier and safer for developers to use cryptography in their applications. Keyczar supports authentication and encryption with both symmetric and asymmetric keys.&lt;br /&gt;
* [http://www.bouncycastle.org/ Bouncycastle] is a lightweight Java cryptography API &amp;lt;i&amp;gt;provider&amp;lt;/i&amp;gt;.&lt;br /&gt;
* [http://www.jasypt.org/ Jasypt] is a Java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.&lt;br /&gt;
&lt;br /&gt;
== XML Security ==&lt;br /&gt;
* The [http://santuario.apache.org/ Apache Santuario] project is aimed at providing implementation of the primary security standards for XML: XML-Signature Syntax and Processing and XML Encryption Syntax and Processing.&lt;br /&gt;
&lt;br /&gt;
== Validation ==&lt;br /&gt;
* [http://www.sapia-oss.org/projects/vlad/home.html Vlad] stands for &amp;quot;validation&amp;quot;. This projects indeed aims at offering a simple, high-level, extensible, generic validation framework that can easily be integrated into existing applications.&lt;br /&gt;
* [https://www.owasp.org/index.php/Protect_FileUpload_Against_Malicious_File This OWASP article] and [https://github.com/righettod/document-upload-protection code snippet] proposes a way to protect a file upload feature against submission of files that may contain malicious code.&lt;br /&gt;
* [http://commons.apache.org/proper/commons-validator/ The Apache Common's validator] can be used to perform validation.&lt;br /&gt;
&lt;br /&gt;
= Resources =&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
&lt;br /&gt;
[http://lists.owasp.org/mailman/listinfo/java-project OWASP Java and JVM Technologies Mailing List]&lt;br /&gt;
&lt;br /&gt;
== Code Repository ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/owasp GitHub OWASP Global Repository]&lt;br /&gt;
&lt;br /&gt;
== Related Project Resources ==&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Project|OWASP Project Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Language|Languages Repository]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_.NET_Project|.NET Project]]&lt;br /&gt;
&lt;br /&gt;
[[Ruby|Ruby Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[PHP|PHP Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[Perl|Perl Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[Python|Python Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[JavaScript|JavaScript Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[C/C++|C/C++ Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[SQL|SQL, PL/SQL and DB Scripting Technology Knowledge Base]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Internet_of_Things_Project|OWASP IoT Security Project]]&lt;br /&gt;
&lt;br /&gt;
[[OWASP_Mobile_Security_Project|OWASP Mobile Security Project]]&lt;br /&gt;
&lt;br /&gt;
= Tasks and Roadmap =&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP Java Project WIPRO 1 2015|Wiki Pages Review Operation - 2016]] General review of all Java and JVM related pages in the wiki.&lt;br /&gt;
* Build Java and JVM security related net resources guide&lt;br /&gt;
* The OWASP Java and JVM Technology Knowledge Base is principally about creating deep, rich guidance for Java and JVM developers using all kind of security resources. The idea is to have an effort of building a internet resource guide for everything around the JVM universe. Information, blogs, articles, tools, test servers and more. Important however is that this list is seriously curated.&lt;br /&gt;
* Concrete guideline for Java and JVM developers&lt;br /&gt;
* Clear checklists, around various topics, language, servers and frameworks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Get involved =&lt;br /&gt;
&lt;br /&gt;
The first step would be to establish contact with the project leaders and/or the entire team. This can be done using a direct and private message, or by joining the public mailing list to say hello.&lt;br /&gt;
&lt;br /&gt;
When it comes to participating in project activities, everything depends on the time you are willing and able to invest. It is however very important to not jump into too many things at the beginning, later having to back out or to let unfinished things behind you. It is much better to start with small tasks, increasing intensity and investment over time. &lt;br /&gt;
&lt;br /&gt;
Please also be patient with expecting the &amp;quot;merge&amp;quot; of your work into the existing project pages and code. As everywhere in live, trust has to be built-up. &lt;br /&gt;
&lt;br /&gt;
The Java and JVM knowledge base has currently multiple tasks open, which can be found on the adequate section of this page. Not all tasks require a wiki account. Please take something you are interested in and start participating. Work load is not the only outcome when participating in open projects. You are getting a lot of things back: recognition, satisfaction, knowledge and contacts, sometime friends. &lt;br /&gt;
&lt;br /&gt;
Sounds cool? Then jump in...&lt;br /&gt;
&lt;br /&gt;
To get involved join the mailing list, follow this link: [http://lists.owasp.org/mailman/listinfo/java-project OWASP Java and JVM Mailing List]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Archives =&lt;br /&gt;
&lt;br /&gt;
The previous version of this JAVA Project home page is archived here: [[OWASP Java Project Archive (8.2010)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''IMPORTANT: all pages of these project are currently under review. A lot are outdated and are in the process of being removed or updated.''' The review effort is coordinated on this page: [[OWASP Java Project WIPRO 1 2015|Wiki Pages Review Operation - 2015/2016]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(The pages in the &amp;quot;old&amp;quot; category &amp;quot;OWASP Java Project&amp;quot; have to be moved into the category &amp;quot;Java&amp;quot;. Work is in progress).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;categorytree mode=pages&amp;gt;OWASP Java Project&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Wikimedia insert classified page list here --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=222949</id>
		<title>Cross-Site Request Forgery (CSRF)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-Site_Request_Forgery_(CSRF)&amp;diff=222949"/>
				<updated>2016-11-02T17:19:55Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: /* Related Security Activities */ contraction needs an apostophe&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP ASDR Project]]&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.&lt;br /&gt;
&lt;br /&gt;
==Related Security Activities==&lt;br /&gt;
&lt;br /&gt;
===How to Review Code for CSRF Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the [[:Category:OWASP Code Review Project|OWASP Code Review Guide]] article on how to [[Reviewing code for Cross-Site Request Forgery issues|review code for CSRF vulnerabilities]].&lt;br /&gt;
&lt;br /&gt;
===How to Test for CSRF Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the [[:Category:OWASP Testing Project|OWASP Testing Guide]] article on how to [[Testing_for_CSRF_(OTG-SESS-005)|test for CSRF vulnerabilities]].&lt;br /&gt;
&lt;br /&gt;
===How to Prevent CSRF Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the [[CSRF Prevention Cheat Sheet]] for prevention measures.&lt;br /&gt;
&lt;br /&gt;
Listen to the [http://www.owasp.org/download/jmanico/owasp_podcast_69.mp3 OWASP Top Ten CSRF Podcast].&lt;br /&gt;
&lt;br /&gt;
Most frameworks have built-in CSRF support such as [http://docs.joomla.org/How_to_add_CSRF_anti-spoofing_to_forms Joomla], [http://blog.eyallupu.com/2012/04/csrf-defense-in-spring-mvc-31.html Spring], [http://web.securityinnovation.com/appsec-weekly/blog/bid/84318/Cross-Site-Request-Forgery-CSRF-Prevention-Using-Struts-2 Struts], [http://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf Ruby on Rails], [http://www.troyhunt.com/2010/11/owasp-top-10-for-net-developers-part-5.html .NET] and others.&lt;br /&gt;
&lt;br /&gt;
Use [[:Category:OWASP_CSRFGuard_Project|OWASP CSRF Guard]] to add CSRF protection to your Java applications. You can use [[CSRFProtector Project]] to protect your php applications or any project deployed using Apache Server. There is a [[.Net CSRF Guard]] at OWASP as well, but it's old and doesn't look complete.&lt;br /&gt;
&lt;br /&gt;
John Melton also has an [http://www.jtmelton.com/2010/05/16/the-owasp-top-ten-and-esapi-part-6-cross-site-request-forgery-csrf/ excellent blog post] describing how to use the native anti-CSRF functionality of the [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP ESAPI].&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
CSRF is an attack that tricks the victim into submitting a malicious request. It inherits the identity and privileges of the victim to perform an undesired function on the victim's behalf. For most sites, browser requests automatically include any credentials associated with the site, such as the user's session cookie, IP address, Windows domain credentials, and so forth. Therefore, if the user is currently authenticated to the site, the site will have no way to distinguish between the forged request sent by the victim and a legitimate request sent by the victim.&lt;br /&gt;
&lt;br /&gt;
CSRF attacks target functionality that causes a state change on the server, such as changing the victim's email address or password, or purchasing something. Forcing the victim to retrieve data doesn't benefit an attacker because the attacker doesn't receive the response, the victim does. As such, CSRF attacks target state-changing requests.&lt;br /&gt;
&lt;br /&gt;
It's sometimes possible to store the CSRF attack on the vulnerable site itself. Such vulnerabilities are called &amp;quot;stored CSRF flaws&amp;quot;. This can be accomplished by simply storing an IMG or IFRAME tag in a field that accepts HTML, or by a more complex cross-site scripting attack. If the attack can store a CSRF attack in the site, the severity of the attack is amplified. In particular, the likelihood is increased because the victim is more likely to view the page containing the attack than some random page on the Internet.  The likelihood is also increased because the victim is sure to be authenticated to the site already.&lt;br /&gt;
&lt;br /&gt;
=== Synonyms ===&lt;br /&gt;
&lt;br /&gt;
CSRF attacks are also known by a number of other names, including XSRF, &amp;quot;Sea Surf&amp;quot;, Session Riding, Cross-Site Reference Forgery, and Hostile Linking. Microsoft refers to this type of attack as a One-Click attack in their threat modeling process and many places in their online documentation.&lt;br /&gt;
&lt;br /&gt;
=== Prevention measures that do '''NOT''' work ===&lt;br /&gt;
&lt;br /&gt;
== Using a secret cookie ==&lt;br /&gt;
Remember that all cookies, even the ''secret'' ones, will be submitted with every request. All authentication tokens will be submitted regardless of whether or not the end-user was tricked into submitting the request. Furthermore, session identifiers are simply used by the application container to associate the request with a specific session object. The session identifier does not verify that the end-user intended to submit the request.&lt;br /&gt;
&lt;br /&gt;
== Only accepting POST requests ==&lt;br /&gt;
Applications can be developed to only accept POST requests for the execution of business logic. The misconception is that since the attacker cannot construct a malicious link, a CSRF attack cannot be executed. Unfortunately, this logic is incorrect. There are numerous methods in which an attacker can trick a victim into submitting a forged POST request, such as a simple form hosted in an attacker's Website with hidden values. This form can be triggered automatically by JavaScript or can be triggered by the victim who thinks the form will do something else.&lt;br /&gt;
&lt;br /&gt;
A number of flawed ideas for defending against CSRF attacks have been developed over time. Here are a few that we recommend you avoid.&lt;br /&gt;
&lt;br /&gt;
== Multi-Step Transactions ==&lt;br /&gt;
&lt;br /&gt;
Multi-Step transactions are not an adequate prevention of CSRF. As long as an attacker can predict or deduce each step of the completed transaction, then CSRF is possible.&lt;br /&gt;
&lt;br /&gt;
== URL Rewriting ==&lt;br /&gt;
&lt;br /&gt;
This might be seen as a useful CSRF prevention technique as the attacker cannot guess the victim's session ID. However, the user’s session ID is exposed in the URL. We don't recommend fixing one security flaw by introducing another.&lt;br /&gt;
&lt;br /&gt;
== HTTPS ==&lt;br /&gt;
&lt;br /&gt;
HTTPS does nothing to defend against CSRF.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===How does the attack work?===&lt;br /&gt;
&lt;br /&gt;
There are numerous ways in which an end user can be tricked into loading information from or submitting information to a web application. In order to execute an attack, we must first understand how to generate a valid malicious request for our victim to execute. Let us consider the following example: Alice wishes to transfer $100 to Bob using the ''bank.com'' web application that is vulnerable to CSRF. Maria, an attacker, wants to trick Alice into sending the money to her instead. The attack will comprise the following steps:&lt;br /&gt;
&lt;br /&gt;
# building an exploit URL or script&lt;br /&gt;
# tricking Alice into executing the action with [[Social Engineering|social engineering]]&lt;br /&gt;
&lt;br /&gt;
====GET scenario====&lt;br /&gt;
&lt;br /&gt;
If the application was designed to primarily use GET requests to transfer parameters and execute actions, the money transfer operation might be reduced to a request like:&lt;br /&gt;
&lt;br /&gt;
 GET &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=BOB&amp;amp;amount=100&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
&lt;br /&gt;
Maria now decides to exploit this web application vulnerability using Alice as her victim. Maria first constructs the following exploit URL which will transfer $100,000 from Alice's account to her account. She takes the original command URL and replaces the beneficiary name with herself, raising the transfer amount significantly at the same time:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[Social Engineering|social engineering]] aspect of the attack tricks Alice into loading this URL when she's logged into the bank application. This is usually done with one of the following techniques:&lt;br /&gt;
&lt;br /&gt;
* sending an unsolicited email with HTML content&lt;br /&gt;
* planting an exploit URL or script on pages that are likely to be visited by the victim while they are also doing online banking&lt;br /&gt;
&lt;br /&gt;
The exploit URL can be disguised as an ordinary link, encouraging the victim to click it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot;&amp;gt;View my Pictures!&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or as a 0x0 fake image:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;img src=&amp;quot;http://bank.com/transfer.do?acct=MARIA&amp;amp;amount=100000&amp;quot; width=&amp;quot;0&amp;quot; height=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this image tag were included in the email, Alice wouldn't see anything. However, the browser ''will still'' submit the request to bank.com without any visual indication that the transfer has taken place.&lt;br /&gt;
&lt;br /&gt;
A real life example of CSRF attack on an application using GET was a [http://xs-sniper.com/blog/2008/04/21/csrf-pwns-your-box/ uTorrent exploit] from 2008 that was used on a mass scale to download malware.&lt;br /&gt;
&lt;br /&gt;
====POST scenario====&lt;br /&gt;
&lt;br /&gt;
The only difference between GET and POST attacks is how the attack is being executed by the victim. Let's assume the bank now uses POST and the vulnerable request looks like this:&lt;br /&gt;
&lt;br /&gt;
 POST &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
 &lt;br /&gt;
 acct=BOB&amp;amp;amount=100&lt;br /&gt;
&lt;br /&gt;
Such a request cannot be delivered using standard A or IMG tags, but can be delivered using a FORM tag:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;form action=&amp;quot;&amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt;&amp;quot; method=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;acct&amp;quot; value=&amp;quot;MARIA&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;amount&amp;quot; value=&amp;quot;100000&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;View my pictures&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This form will require the user to click on the submit button, but this can be also executed automatically using JavaScript:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;body onload=&amp;quot;document.forms[0].submit()&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;form...&lt;br /&gt;
 &lt;br /&gt;
====Other HTTP methods====&lt;br /&gt;
&lt;br /&gt;
Modern web application APIs frequently use other HTTP methods, such as PUT or DELETE. Let's assume the vulnerable bank uses PUT that takes a JSON block as an argument:&lt;br /&gt;
&lt;br /&gt;
 PUT &amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt; HTTP/1.1&lt;br /&gt;
 &lt;br /&gt;
 { &amp;quot;acct&amp;quot;:&amp;quot;BOB&amp;quot;, &amp;quot;amount&amp;quot;:100 }&lt;br /&gt;
&lt;br /&gt;
Such requests can be executed with JavaScript embedded into an exploit page:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
 function put() {&lt;br /&gt;
 	var x = new XMLHttpRequest();&lt;br /&gt;
 	x.open(&amp;quot;PUT&amp;quot;,&amp;quot;&amp;lt;nowiki&amp;gt;http://bank.com/transfer.do&amp;lt;/nowiki&amp;gt;&amp;quot;,true);&lt;br /&gt;
 	x.setRequestHeader(&amp;quot;Content-Type&amp;quot;, &amp;quot;application/json&amp;quot;); &lt;br /&gt;
 	x.send(JSON.stringify({&amp;quot;acct&amp;quot;:&amp;quot;BOB&amp;quot;, &amp;quot;amount&amp;quot;:100})); &lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
 &amp;lt;body onload=&amp;quot;put()&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fortunately, this request will '''not''' be executed by modern web browsers thanks to [[Same-Origin Policy|same-origin policy]] restrictions. This restriction is enabled by default unless the target web site explicitly opens up cross-origin requests from the attacker's (or everyone's) origin by using [[HTML5 Security Cheat Sheet#Cross_Origin_Resource_Sharing|CORS]] with the following header:&lt;br /&gt;
&lt;br /&gt;
 Access-Control-Allow-Origin: *&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--==Related [[Threat Agents]]==&lt;br /&gt;
* TBD&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
==Related [[Attacks]]==&lt;br /&gt;
&lt;br /&gt;
* [[Cross-site Scripting (XSS)]]&lt;br /&gt;
* [[Cross Site History Manipulation (XSHM)]]&lt;br /&gt;
&amp;lt;!--==Related [[Vulnerabilities]]==&lt;br /&gt;
* TBD&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related [[Controls]]==&lt;br /&gt;
&lt;br /&gt;
* Add a per-request nonce to the URL and all forms in addition to the standard session. This is also referred to as &amp;quot;form keys&amp;quot;. Many frameworks (e.g., Drupal.org 4.7.4+) either have or are starting to include this type of protection &amp;quot;built-in&amp;quot; to every form so the programmer does not need to code this protection manually.&lt;br /&gt;
* Add a hash (session id, function name, server-side secret) to all forms.&lt;br /&gt;
* For .NET, add a session identifier to ViewState with MAC (described in detail in [[Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Viewstate_(ASP.NET) | the CSRF Prevention Cheat Sheet]]).&lt;br /&gt;
* Checking the referrer header in the client's HTTP request can prevent CSRF attacks. Ensuring that the HTTP request has come from the original site means that attacks from other sites will not function. It is very common to see referrer header checks used on embedded network hardware due to memory limitations.&lt;br /&gt;
** XSS can be used to bypass both referrer and token based checks simultaneously. For instance, the [http://en.wikipedia.org/wiki/Samy_%28computer_worm%29 Samy worm] used an [[XHR]] to obtain the CSRF token to forge requests.&lt;br /&gt;
* &amp;quot;Although CSRF is fundamentally a problem with the web application, not the user, users can help protect their accounts at poorly designed sites by logging off the site before visiting another, or clearing their browser's cookies at the end of each browser session.&amp;quot; --http://en.wikipedia.org/wiki/Cross-site_request_forgery#_note-1&lt;br /&gt;
* [[Tokenizing]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cgisecurity.com/articles/csrf-faq.shtml The Cross-Site Request Forgery (CSRF/XSRF) FAQ]&lt;br /&gt;
: ''quote: &amp;quot;This paper serves as a living document for Cross-Site Request Forgery issues. This document will serve as a repository of information from existing papers, talks, and mailing list postings and will be updated as new information is discovered.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
* [[Testing for CSRF (OWASP-SM-005)|Testing for CSRF]]&lt;br /&gt;
: CSRF (aka Session riding) paper from the OWASP Testing Guide project (need to integrate)&lt;br /&gt;
&lt;br /&gt;
* [http://www.darkreading.com/document.asp?doc_id=107651&amp;amp;WT.svl=news1_2 CSRF Vulnerability: A 'Sleeping Giant']&lt;br /&gt;
: Overview Paper&lt;br /&gt;
&lt;br /&gt;
* [http://www.owasp.org/index.php/Image:RequestRodeo-MartinJohns.pdf Client Side Protection against Session Riding]&lt;br /&gt;
: Martin Johns and Justus Winter's interesting paper and presentation for the 4th OWASP AppSec Conference which described potential techniques that browsers could adopt to automatically provide CSRF protection - [http://www.owasp.org/index.php/Image:RequestRodeo-MartinJohns.pdf PDF paper]&lt;br /&gt;
&lt;br /&gt;
* [[:Category:OWASP_CSRFGuard_Project|OWASP CSRF Guard]]&lt;br /&gt;
: J2EE, .NET, and PHP Filters which append a unique request token to each form and link in the HTML response in order to provide universal coverage against CSRF throughout your entire application.&lt;br /&gt;
&lt;br /&gt;
* [http://owasp.org/index.php/CSRFProtector_Project OWASP CSRF Protector]&lt;br /&gt;
: a new anti CSRF method to mitigate CSRF in web applications. Currently implemented as a php library &amp;amp; Apache 2.x.x module&lt;br /&gt;
&lt;br /&gt;
* [http://yehg.net/lab/pr0js/view.php/A_Most-Neglected_Fact_About_CSRF.pdf A Most-Neglected Fact About Cross Site Request Forgery (CSRF)  ]&lt;br /&gt;
: Aung Khant, http://yehg.net, explained the danger and impact of CSRF with imperiling scenarios.&lt;br /&gt;
&lt;br /&gt;
* [[:Category:OWASP CSRFTester Project|OWASP CSRF Tester]]&lt;br /&gt;
: The OWASP CSRFTester gives developers the ability to test their applications for CSRF flaws.&lt;br /&gt;
&lt;br /&gt;
* [http://code.google.com/p/pinata-csrf-tool/ Pinata-CSRF-Tool: CSRF POC tool]&lt;br /&gt;
: Pinata makes it easy to create Proof of Concept CSRF pages. Assists in Application Vulnerability Assessment.&lt;br /&gt;
&lt;br /&gt;
[[Category:Exploitation of Authentication]]&lt;br /&gt;
[[Category:Embedded Malicious Code]]&lt;br /&gt;
[[Category:Spoofing]]&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Framework&amp;diff=169620</id>
		<title>Session Management Framework</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Framework&amp;diff=169620"/>
				<updated>2014-03-07T03:44:34Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: created a start&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Session Management Framework=&lt;br /&gt;
==Overview==&lt;br /&gt;
Session management is an important underlying function in modern web applications. Keeping sessions secure is one of the most important things a framework must do to ensure that applications built on that framework do not suffer from security flaws.&lt;br /&gt;
&lt;br /&gt;
==Session Data==&lt;br /&gt;
Session data should be stored server-side and never transmitted to the client unless necessary. The framework should also provide a simple and easy way for the developer to access, add, delete, or modify session data.&lt;br /&gt;
&lt;br /&gt;
==Session ID==&lt;br /&gt;
===Generating===&lt;br /&gt;
The session ID should always be generated by the framework, and no other party should be able to manually select a session ID. The ID should be generated in a crytographically strong fashion. The session ID should always be generated based on random numbers, and it should never be created with any session specific or environment specific data.&lt;br /&gt;
&lt;br /&gt;
===Storage===&lt;br /&gt;
The Session ID should be stored in a cookie which the client then submits to the server with every request. This cookie should have the HTTPONLY and SECURE flags set by default.&lt;br /&gt;
&lt;br /&gt;
The framework should also provide an easy way for the developer to change the name of the session ID cookie to a custom value to avoid fingerprinting. &lt;br /&gt;
&lt;br /&gt;
===Cookie rewriting===&lt;br /&gt;
URL rewriting is not recommended.&lt;br /&gt;
&lt;br /&gt;
==Ending a session==&lt;br /&gt;
The framework should provide a simple method for a developer to remove a session. When that function is called, the session data itself should be purged from server memory, the session ID should no longer be kept as a valid ID, and the cookie should be removed from the client browser.&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169619</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169619"/>
				<updated>2014-03-07T03:33:56Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: naming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[Cheat Sheets]]&lt;br /&gt;
* [[OWASP Framework Security Project]]&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Feb 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data Access Framework]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication Framework&lt;br /&gt;
* [[Session Management Framework]]&lt;br /&gt;
* Framework for Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169618</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169618"/>
				<updated>2014-03-07T03:32:18Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: wikifying link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[Cheat Sheets]]&lt;br /&gt;
* [[OWASP Framework Security Project]]&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Feb 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* [[Session Management]]&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169617</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=169617"/>
				<updated>2014-03-07T03:31:06Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: fixing date&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[Cheat Sheets]]&lt;br /&gt;
* [[OWASP Framework Security Project]]&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Feb 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* Session Management&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168985</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168985"/>
				<updated>2014-02-26T03:35:06Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: adding framework sec project&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[Cheat Sheets]]&lt;br /&gt;
* [[OWASP Framework Security Project]]&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* Session Management&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Java_Security_Frameworks&amp;diff=168984</id>
		<title>Java Security Frameworks</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Java_Security_Frameworks&amp;diff=168984"/>
				<updated>2014-02-26T03:33:51Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: adding hdiv&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A list of third party (i.e. not part of Java SE or EE) security frameworks.&lt;br /&gt;
&lt;br /&gt;
==Enterprise==&lt;br /&gt;
* [[ESAPI|OWASP Enterprise Security API]] a new OWASP project to provide all essential security services under one roof.&lt;br /&gt;
* [http://www.hdiv.org/ HDIV] A web application security framework that provides a number of functions.&lt;br /&gt;
&lt;br /&gt;
== Access Control (Authentication and Authorisation) ==&lt;br /&gt;
* [http://sourceforge.net/projects/jguard jGuard] - jGuard is written in Java. Its goal is to provide a security framework based on JAAS (Java Authentication and Authorization Security). The framework is written for web and standalone applications, to easily provide solutions for access control problems.&lt;br /&gt;
&lt;br /&gt;
== Encryption ==&lt;br /&gt;
* [http://www.bouncycastle.org/ Bouncycastle] - Lightweight Java cryptography APIs&lt;br /&gt;
* [http://www.jasypt.org/ Jasypt] - Jasypt is a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168774</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168774"/>
				<updated>2014-02-23T06:32:58Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: comment this out too&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[Cheat_Sheets]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* Session Management&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168773</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168773"/>
				<updated>2014-02-23T06:21:08Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: just commenting this out till we get something useful to put there&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
 &amp;lt;!--&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP_CISO_Survey]]&lt;br /&gt;
* [[Cheat_Sheets]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* Session Management&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Security_Headers&amp;diff=168772</id>
		<title>Security Headers</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Security_Headers&amp;diff=168772"/>
				<updated>2014-02-23T06:19:04Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: first page for the project has been started&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;HTTP headers which should be included by default. Methods for modifying or removing the headers for specific instances should be provided, but by default there are secure settings which should be enabled unless there are other overriding concerns.&lt;br /&gt;
* X-Frame-Options: SAMEORIGIN [https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options|ref]&lt;br /&gt;
* X-XSS-Protection: 1; mode=block [http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx|ref]&lt;br /&gt;
* X-Content-Type-Options: nosniff &lt;br /&gt;
* Content-Type: text/html; charset=utf-8&lt;br /&gt;
&lt;br /&gt;
Additionally, no headers should be included that needlessly divulge information about the server or it's configuration that an end user wouldn't need.&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168771</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168771"/>
				<updated>2014-02-23T06:05:24Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: removing empty FAQ, adding content&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP_CISO_Survey]]&lt;br /&gt;
* [[Cheat_Sheets]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Security Frameworks=&lt;br /&gt;
List of guides:&lt;br /&gt;
* [[Data access]]&lt;br /&gt;
* Password Storage&lt;br /&gt;
* Authentication&lt;br /&gt;
* Session Management&lt;br /&gt;
* Handling Output&lt;br /&gt;
* [[Security Headers]]&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168770</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168770"/>
				<updated>2014-02-23T05:13:46Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: more updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
[[User:Ari_Elias-Bachrach|Ari Elias-Bachrach]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP_CISO_Survey]]&lt;br /&gt;
* [[Cheat_Sheets]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download when ready&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=FAQs=&lt;br /&gt;
&lt;br /&gt;
; Q1&lt;br /&gt;
: A1&lt;br /&gt;
&lt;br /&gt;
; Q2&lt;br /&gt;
: A2&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
The OWASP security frameworks project is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* Ari Elias-Bachrach&lt;br /&gt;
* Mike McCabe&lt;br /&gt;
* Ken Johnson&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* your name here, just volunteer :-)&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of this project is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* volunteer to write (or help write) a design pattern document&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168769</id>
		<title>OWASP Security Frameworks Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Security_Frameworks_Project&amp;diff=168769"/>
				<updated>2014-02-23T05:03:15Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: added some text, cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Main=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_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;
&lt;br /&gt;
==OWASP Security Frameworks==&lt;br /&gt;
&lt;br /&gt;
The OWASP Security Frameworks Project is a series of design patterns that can be used by language designers and architects to create secure frameworks for developers, thereby relieving developers of the work of implementing security themselves.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Providing a secure environment to a developer will lead to a more secure final product. Developers need to work in an environment which is secure by default and which relieves them of the burden of implementing their own security controls. That task often falls to the developers who create languages, or enterprise architects. We aim to create a library of design patterns and instructions that should be implemented by architects to create secure languages and environments for developers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The project aims to provide language independent advice targeted at enterprise architects and people who design programming languages. The intent is to make security functionality a part of the framework that a developer builds upon, so that the developer doesn't have to implement their own security functions. The ultimate goal is to have as much security as possible built into the programming environment so that developer mistakes and omissions are less likely to lead to security vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
The OWASP Security Framework is free to use. It is licensed under the http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-ShareAlike 3.0 license], so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== What is the OWASP Security Frameworks Project? ==&lt;br /&gt;
&lt;br /&gt;
OWASP Security Frameworks Project provides:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
Link to presentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
Ari Elias-Bachrach&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[OWASP_CISO_Survey]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;&amp;quot; | &lt;br /&gt;
&lt;br /&gt;
== Quick Download ==&lt;br /&gt;
&lt;br /&gt;
* Link to page/download&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
* [22 Nov 2014] Project initiated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In Print ==&lt;br /&gt;
This project can be purchased as a print on demand book from Lulu.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects]]&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-builders-small.png|link=]]  &lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Cc-button-y-sa-small.png|link=http://creativecommons.org/licenses/by-sa/3.0/]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_DOC.jpg|link=]]&lt;br /&gt;
   |}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=FAQs=&lt;br /&gt;
&lt;br /&gt;
; Q1&lt;br /&gt;
: A1&lt;br /&gt;
&lt;br /&gt;
; Q2&lt;br /&gt;
: A2&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
==Volunteers==&lt;br /&gt;
XXX is developed by a worldwide team of volunteers. The primary contributors to date have been:&lt;br /&gt;
&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
==Others==&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
= Road Map and Getting Involved =&lt;br /&gt;
As of February 2014, the priorities are:&lt;br /&gt;
&lt;br /&gt;
The plan is to develop a series of documents that cover the various features an architecture should provide. We'll have a document on XSS prevention, database access, authentication, CSRF prevention, etc. Each one will contain the design patterns that should be implemented in order to provide those functions in a secure manner. They'll each be free standing documents which can eventually be combined together into one large pdf or book when we're &amp;quot;done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Involvement in the development and promotion of XXX is actively encouraged!&lt;br /&gt;
You do not have to be a security expert in order to contribute.&lt;br /&gt;
Some of the ways you can help:&lt;br /&gt;
* xxx&lt;br /&gt;
* xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Project About=&lt;br /&gt;
{{:Projects/OWASP_Security_Frameworks_Project}}  &lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Document]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=DN_BOFinder&amp;diff=167629</id>
		<title>DN BOFinder</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=DN_BOFinder&amp;diff=167629"/>
				<updated>2014-02-07T15:55:12Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DN_BOFinder v0.2 - Feb 2007 &lt;br /&gt;
&lt;br /&gt;
The DN_BOFinder (DotNet Buffer Overflow Finder) is a semi-intelligent tool designed to find Buffer Overflows type vulnerabilities in COM objects used by .NET Assemblies (and mistakes in unsafe .Net code blocks).&lt;br /&gt;
&lt;br /&gt;
This project was created by Dinis Cruz.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The latest version (0.2) can be downloaded from SourceForge: [http://sourceforge.net/project/showfiles.php?group_id=64424&amp;amp;package_id=105632&amp;amp;release_id=519695]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Features ====&lt;br /&gt;
&lt;br /&gt;
Here are some of its features:&lt;br /&gt;
&lt;br /&gt;
* Supports fuzzing of individual methods, *.dll files and entire directories&lt;br /&gt;
* Works by using Reflection to create 'live instances' of classes and then fuzzing each of the exposed methods&lt;br /&gt;
* there are currently 16 different payloads for basic types (int, unint, char) and strings&lt;br /&gt;
* Fully automated use of cdb to find issues (i.e. you can start the fuzzer and go for lunch)&lt;br /&gt;
* use of an 'FuzzedMethods' list for each fuzzed dll to avoid re-fuzzing the same methods&lt;br /&gt;
* stored of exception information in an 'ExceptionData' file (per dll)&lt;br /&gt;
* use of an 'ExcludeList'to list the classes/methods that should be further analyzed&lt;br /&gt;
* auto detection of methods that consume large amounts of memory (currently set to 20M) and auto-detection of methods that 'hang' (some callbacks or windows pop-ups have this behaviour).The methods identified are automatically added to the 'ExcludeList'&lt;br /&gt;
* The results are current quite conservative (i.e. only the really bad exceptions are shown). this means that there might be several exploitable vulnerabilities that are currently reported as 'Normal CLR exception'&lt;br /&gt;
* A big blind spot at the moment is that the current version does not fuzz certain static methods (which can be invoked without need of a constructor (i.e. a live instance))&lt;br /&gt;
* When it finds an interface it tries to find who implements that interface and tries to create an instance of them (supports caching of objects for performance reasons). The problem here is that the class created is not documented, and ideally we should be fuzzing each of those implementations (especially in the cases where that Interface is used as a parameter)&lt;br /&gt;
* When in auto mode, it auto-restarts fuzzing session after a predefined number of seconds (this also helps in long fuzzing sessions since the process is refreshed regularly, which of course might also introduce some blind spots) &lt;br /&gt;
&lt;br /&gt;
* Files:&lt;br /&gt;
** The binary (DN_BOFinder.exe) can be found on the DN_BOFinder_V0.2\binary folder&lt;br /&gt;
** The results will inside the DN_BOFinder_V0.2\binary\_fuzz_results folder (created on first run)&lt;br /&gt;
** The source code is in DN_BOFinder_V0.2\Source Code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====fuzzing modes====&lt;br /&gt;
&lt;br /&gt;
There are 5 operational fuzzing modes:&lt;br /&gt;
* File   	:::  to Fuzz a file (in this mode a CLR crash will also crash the fuzzer)&lt;br /&gt;
* File Auto 	:::   to Fuzz a file automatically (in this mode new processes of DN_BOFinder are started in the 'File' Mode under cdb (Microsoft's Command Line Debugger). The cdb output is analyzed for unhandled exception data which when discovered is appended to the 'ExepctionData'&lt;br /&gt;
* Dir		:::  to fuzz directories (basically invoking 'File Auto' for each *.dll in the target directory&lt;br /&gt;
* Method	::: to fuzz a method directly&lt;br /&gt;
* Method Auto ::: to fuzz a method automatically (this will invoke the method using the number of payloads specified)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Current limitations ====&lt;br /&gt;
* when one of the create parameters value is null, the method is not invoked (since it was throwing a lot of errors). This is a legacy from the first version of this fuzzer (before cdb automation) so it should be possible to remove this now&lt;br /&gt;
* Need to add support for call stack information (and sequence of methods invoked) since sometimes the exception is not thrown by the method we fuzzed (and we need those details to replicate the state of that issue)&lt;br /&gt;
* the fact that we don't fuzz the same method twice creates some blind spots (since some errors occur by state changes in previous methods)&lt;br /&gt;
* the payloads are still quite basic, in a future version the fuzzing of live objects (i.e. variation of it) will be implemented&lt;br /&gt;
* the creation of live instances is still not very cleaver and has problem with more complex types (like the ones that require a file to be loaded before some of its methods make sense). The plan is to implement a new fuzzing mode where we are able to use real objects created during an execution of an real application (for example an win32 gui app or an ASP.NET website) and fuzz them.&lt;br /&gt;
&lt;br /&gt;
====Bugs and to-do-list====&lt;br /&gt;
&lt;br /&gt;
* we should delete the 'ExcludeList'and 'ExceptionData' when nothing is found&lt;br /&gt;
* list the methods/classes that we couldn't fuzz&lt;br /&gt;
* Add a Gui&lt;br /&gt;
* Add code coverage&lt;br /&gt;
* export results in XML format&lt;br /&gt;
* add directory recursive capabilities to the 'Dir' fuzzing mode&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOW-TO use instructions ==&lt;br /&gt;
&lt;br /&gt;
''''Fuzzing MsCorLib''''&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; binary\DN_BOFinder.exe file mscorlib.dll&lt;br /&gt;
&lt;br /&gt;
by default if no path is included, DN_BOFinder will try to find the file in the current directory or in the main .Net 2.0 directory&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a large number of entries that look like these:&lt;br /&gt;
&lt;br /&gt;
 [INFO]: Fuzzing mscorlib.dll (18372 methods, 1264 types): 0 type processed&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; Fuzzing System.Object [0]&amp;lt;&amp;lt;&amp;lt;:&lt;br /&gt;
 ...&lt;br /&gt;
 ***************************************************&lt;br /&gt;
 *********&lt;br /&gt;
 *********   System.Object[] - FuzzIndex: 0&lt;br /&gt;
 *********&lt;br /&gt;
 ***************************************************&lt;br /&gt;
 ...&lt;br /&gt;
 [6:03 AM] &amp;gt; Executing System.Int32.System.IConvertible.ToBoolean(System.IFormatProvider) [0]:&lt;br /&gt;
 [6:03 AM] &amp;gt; Executing System.Int32.System.IConvertible.ToChar(System.IFormatProvider) [0]:&lt;br /&gt;
 [6:03 AM] &amp;gt; Executing System.Int32.System.IConvertible.ToSByte(System.IFormatProvider) [0]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
while this is running, open the \DN_BOFinder_V0.2\binary\_fuzz_results folder and you will see three files in there:&lt;br /&gt;
&lt;br /&gt;
 * mscorlib.dll_ExceptionData.txt     - Will contain details about exeptions discovered (only in auto or dir modes)&lt;br /&gt;
 * mscorlib.dll_ExcludeList.txt       - Will contain a list of methods to exclude (only in auto or dir modes)&lt;br /&gt;
 * mscorlib.dll_FuzzedMethods.txt     - will contain a list of methods and classes that have been fuzzed&lt;br /&gt;
&lt;br /&gt;
now try&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; DN_BOFinder file system.dll&lt;br /&gt;
&lt;br /&gt;
and you should get a crash (of the CLR) in the method:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; Fuzzing System.Text.RegularExpressions.MatchEvaluator [0]&amp;lt;&amp;lt;&amp;lt;:&lt;br /&gt;
&lt;br /&gt;
run it under a debugger:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; cdb DN_BOFinder file system.dll &lt;br /&gt;
 (press g)&lt;br /&gt;
&lt;br /&gt;
and you should get this exception data:&lt;br /&gt;
&lt;br /&gt;
 (d64.bb0): CLR exception - code e0434f4d (first chance)&lt;br /&gt;
 (d64.bb0): CLR exception - code e0434f4d (first chance)&lt;br /&gt;
 (d64.bb0): Access violation - code c0000005 (first chance)&lt;br /&gt;
 First chance exceptions are reported before any exception handling.&lt;br /&gt;
 This exception may be expected and handled.&lt;br /&gt;
 eax=00000000 ebx=00000000 ecx=00000000 edx=00000001 esi=0014d3d0 edi=00000000&lt;br /&gt;
 eip=79eea7c3 esp=0012e944 ebp=0012e9b4 iopl=0         nv up ei pl nz na po nc&lt;br /&gt;
 cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202&lt;br /&gt;
 *** ERROR: Symbol file could not be found.  Defaulted to export symbols for   C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll -&lt;br /&gt;
 mscorwks!IEE+0x13277:&lt;br /&gt;
 79eea7c3 0fb708          movzx   ecx,word ptr [eax]       ds:0023:00000000=????&lt;br /&gt;
 0:000&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which is an error that occurred inside the mscorwks.dll and was the reason the .NET assembly crashed. &lt;br /&gt;
The exeption  mscorwks!IEE+0x13277 is actually quite common, and I think it is a false positive since it looks like part of a method that checks for bad points (which is weird method to check it, but it seems to be quite common on the CLR). I need to load the symbols in my dev laptop (which is always offline btw :) ) to see where mscorwks!IEE+0x13277 resolves to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have an issue you have two choices:&lt;br /&gt;
&lt;br /&gt;
1) add manually the signature of the offending class System.Text.RegularExpressions.MatchEvaluator to the _fuzz_results\system.dll_ExcludeList.txt file or&lt;br /&gt;
&lt;br /&gt;
2) run&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt; DN_BOFinder file auto system.dll&lt;br /&gt;
&lt;br /&gt;
which will do that for you :)&lt;br /&gt;
&lt;br /&gt;
the output of &amp;quot;DN_BOFinder file auto system.dll&amp;quot; should be something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 *********************************************&lt;br /&gt;
 *******&lt;br /&gt;
 *******    DotNet BOFinder v0.2 (12 Mar 2007)&lt;br /&gt;
 *******&lt;br /&gt;
 *********************************************&lt;br /&gt;
 ....&lt;br /&gt;
 Populating ByPassList&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 3 type processed&lt;br /&gt;
 Normal CLR Exception in System.Text.RegularExpressions.MatchEvaluator [0]&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 4 type processed&lt;br /&gt;
 System.Collections.CollectionBase.set_Capacity(Int32) Forced Exception - iPageMemorySize64 Grew by 1048MB&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 23 type processed&lt;br /&gt;
 Normal CLR Exception in System.CodeDom.CodeMemberMethod.add_PopulateParameters(System.EventHandler) [0]&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 41 type processed&lt;br /&gt;
 Normal CLR Exception in System.CodeDom.CodeMemberMethod.remove_PopulateParameters(System.EventHandler) [0]&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 42 type processed&lt;br /&gt;
 Normal CLR Exception in System.CodeDom.CodeMemberMethod.add_PopulateStatements(System.EventHandler) [0]&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 43 type processed&lt;br /&gt;
 Normal CLR Exception in System.CodeDom.CodeMemberMethod.remove_PopulateStatements(System.EventHandler) [0]&lt;br /&gt;
&lt;br /&gt;
so what is happening here is, you get an [INFO] every time a fuzzing session starts (i.e. new process) and we have a bunch of 'Normal CLR Exception' entries (which crash the CLR but I think are false positives (I would actually put money that some of these might be exploitable (most are null pointers)). Note for example that the case I shown above (System.Text.RegularExpressions.MatchEvaluator) is here shown as a 'Normal CLR Exception'&lt;br /&gt;
&lt;br /&gt;
Every time a 'CLR Exception' occurs, its signature is added to the MethodsFuzzed list and the process restarts (only in the cases where the error doesn't match one of my hard-coded signatures the methods are added to the ExcludeList and its data added to the ExceptionData.&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Eventually you start to get some more interesting issues like for example:&lt;br /&gt;
&lt;br /&gt;
 [INFO]: Fuzzing system.dll (12676 methods, 889 types): 167 type processed&lt;br /&gt;
 System.Resources.ResourceManager.GetStream(System.String) [0]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=0126853c ecx=00000000 edx=0126853c esi=0127ef20 edi=00000000&lt;br /&gt;
        eip=039827df esp=0012ec74 ebp=0012ecc0 iopl=0         nv up ei pl zr na pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246&lt;br /&gt;
        039827df 8b01            mov     eax,dword ptr [ecx]  ds:0023:00000000=????????&lt;br /&gt;
        0:000&lt;br /&gt;
&lt;br /&gt;
which you can go to reflector and see its code:&lt;br /&gt;
&lt;br /&gt;
 class: System.Resources.ResourceManager&lt;br /&gt;
 method: public UnmanagedMemoryStream GetStream(string name)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At this stage (after a bit of fuzzing) the system.dll_ExcludeList.txt should look like this:&lt;br /&gt;
&lt;br /&gt;
 System.Collections.CollectionBase.set_Capacity(Int32) Forced Exception - iPageMemorySize64 Grew by 1048MB&lt;br /&gt;
 System.ComponentModel.ComponentResourceManager.ApplyResources(System.Object, System.String) [0]  - via CDB&lt;br /&gt;
 System.Resources.ResourceManager.ReleaseAllResources() [0]  - via CDB&lt;br /&gt;
 System.Resources.ResourceManager.GetString(System.String) [0]  - via CDB&lt;br /&gt;
 System.Resources.ResourceManager.GetObject(System.String) [0]  - via CDB&lt;br /&gt;
 System.Resources.ResourceManager.GetStream(System.String) [0]  - via CDB&lt;br /&gt;
 System.ComponentModel.TypeConverter.ConvertFromInvariantString(System.String) [0]  - via CDB&lt;br /&gt;
&lt;br /&gt;
Note: For non .NET Framework Assemblies (that are not placed on the v2 folder), you will need to pass the full path to the dll to fuzz.&lt;br /&gt;
&lt;br /&gt;
Here for example is fuzzing a dll that is part of the .NET 2.0 SDK&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; dn_boFinder file &amp;quot;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\RequiredPermissions.dll&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This actually an interresting case since if you run it normally, you will not see a lot of exceptions, but if you run it under the cdb&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; cdb dn_boFinder file &amp;quot;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\RequiredPermissions.dll&amp;quot;&lt;br /&gt;
&lt;br /&gt;
you will see a lot exceptions that look like these&lt;br /&gt;
&lt;br /&gt;
 [8:11 PM] &amp;gt; Executing ManagedMD.Utils.SafePointer.op_Implicit(ManagedMD.Utils.SafePointer) [0]: (1ac.634): Access violation &lt;br /&gt;
 - code c0000005 (first chance)&lt;br /&gt;
 First chance exceptions are reported before any exception handling.&lt;br /&gt;
 This exception may be expected and handled.&lt;br /&gt;
 eax=00000000 ebx=0012ed2c ecx=0012ed00 edx=00000000 esi=00181028 edi=00000000&lt;br /&gt;
 eip=03684f95 esp=0012ecf4 ebp=0012ed10 iopl=0         nv up ei pl nz ac pe nc&lt;br /&gt;
 cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010216&lt;br /&gt;
 03684f95 3b4204          cmp     eax,dword ptr [edx+4] ds:0023:00000004=????????&lt;br /&gt;
&lt;br /&gt;
so run it in auto mode to document them &lt;br /&gt;
&lt;br /&gt;
 &amp;gt; dn_boFinder file auto &amp;quot;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\RequiredPermissions.dll&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(these type of cmp are another type of exceptions that I think are false positives)&lt;br /&gt;
&lt;br /&gt;
== fuzzing methods ==&lt;br /&gt;
&lt;br /&gt;
lets go back to the system.dll System.ComponentModel.ComponentResourceManager.ApplyResources(System.Object,System.String) discovered before&lt;br /&gt;
&lt;br /&gt;
the final piece of the puzzle is to see if this method is exploitable (i.e. can we contol the CPU Registers from a variable that we control). So to do that, the easier way is to run just that method with all fuzzed combinations. &lt;br /&gt;
&lt;br /&gt;
And that is what we can do with the method option. (you can also write a simple c# code to do that)&lt;br /&gt;
&lt;br /&gt;
the format is &lt;br /&gt;
&lt;br /&gt;
 DN_BOFinder {full Path to Dll}!{full method signature (with no spaces)}!0 {number of fuzzed items to try (optional)}&lt;br /&gt;
&lt;br /&gt;
so execute:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; DN_BOFinder.exe method auto c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\system.dll!System.ComponentModel.ComponentResourceManager.ApplyResources(System.Object,System.String)!0&lt;br /&gt;
&lt;br /&gt;
which should give you something like:&lt;br /&gt;
&lt;br /&gt;
 *********************************************&lt;br /&gt;
 *******&lt;br /&gt;
 *******    DotNet BOFinder v0.2 (12 Mar 2007)&lt;br /&gt;
 ******* &lt;br /&gt;
 *********************************************&lt;br /&gt;
 ...&lt;br /&gt;
 strDllToLoad: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\system.dll&lt;br /&gt;
 strTypeToCreate: System.ComponentModel.ComponentResourceManager&lt;br /&gt;
 strMethodToFuzz_FullName: System.ComponentModel.ComponentResourceManager.ApplyResources&lt;br /&gt;
 strMethodToFuzz_Name: ApplyResources&lt;br /&gt;
 strMethodToFuzz_Params: (System.Object,System.String)&lt;br /&gt;
  Populating ByPassList&lt;br /&gt;
 System.ComponentModel.ComponentResourceManager.ApplyResources [0]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=012696b8 ecx=00000000 edx=012696b8 esi=01275460 edi=012696b8&lt;br /&gt;
        eip=032d009f esp=0012eb74 ebp=0012ebc0 iopl=0         nv up ei pl zr na pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246&lt;br /&gt;
        032d009f 8b01            mov     eax,dword ptr [ecx]  ds:0023:00000000=????????&lt;br /&gt;
        0:000&lt;br /&gt;
 ...&lt;br /&gt;
 System.ComponentModel.ComponentResourceManager.ApplyResources [1]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=012696b8 ecx=00000000 edx=012696b8 esi=01275460 edi=012696b8&lt;br /&gt;
        eip=032d009f esp=0012eb74 ebp=0012ebc0 iopl=0         nv up ei pl zr na pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246&lt;br /&gt;
        032d009f 8b01            mov     eax,dword ptr [ecx]  ds:0023:00000000=????????&lt;br /&gt;
        0:000 &lt;br /&gt;
 ...&lt;br /&gt;
 (other results omited)&lt;br /&gt;
&lt;br /&gt;
so here one can see that the value of  the CPU registers don't really change, which might mean that this is a false positive&lt;br /&gt;
&lt;br /&gt;
==== interop.MediaPlayer ====&lt;br /&gt;
&lt;br /&gt;
To see a better example of this, create a wrapper for the MediaPlayer control in a default xp sp2 installation in Visual Studio (i.e. the file Interop.MediaPlayer.dll) and fuzz it.&lt;br /&gt;
&lt;br /&gt;
After a while you will get these two exceptions:&lt;br /&gt;
&lt;br /&gt;
 MediaPlayer.RadioPlayerClass.BindRadioMemory() [0]  - via CDB&lt;br /&gt;
        eax=7ffdf000 ebx=1d3063a8 ecx=1d363167 edx=00000000 esi=0039b6e4 edi=00000000&lt;br /&gt;
        eip=1d363175 esp=0012ed4c ebp=0012ed74 iopl=0         nv up ei pl nz na po nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=        &lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx - &lt;br /&gt;
        msdxm!RunDll+0x2f6e5:&lt;br /&gt;
        1d363175 66c7076c00      mov     word ptr [edi],6Ch       ds:0023:00000000=????&lt;br /&gt;
        0:000&lt;br /&gt;
 ...&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister(Int32) [0]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=1d308fc0 ecx=03a40004 edx=001eeaca esi=003978f0 edi=f0000001&lt;br /&gt;
        eip=1d3639f6 esp=0012ece0 ebp=0012ed04 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx - &lt;br /&gt;
        msdxm!RunDll+0x2ff66:&lt;br /&gt;
        1d3639f6 8b07            mov     eax,dword ptr [edi]  ds:0023:f0000001=????????&lt;br /&gt;
        0:000&lt;br /&gt;
&lt;br /&gt;
the first one, MediaPlayer.RadioPlayerClass.BindRadioMemory(), seems to be one that is caused by some change of state on a previous fuzzed method, but the 2nd one looks much more interresting: MediaPlayer.RadioServerClass.Unregister(Int32)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's fuzz it using the auto method system:&lt;br /&gt;
&lt;br /&gt;
DN_BOFinder.exe method auto d:\...\...\...\...\Interop.MediaPlayer.dll!MediaPlayer.RadioServerClass.Unregister(Int32)!0 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 *********************************************&lt;br /&gt;
 *******&lt;br /&gt;
 *******    DotNet BOFinder v0.2 (12 Mar 2007)&lt;br /&gt;
 *******&lt;br /&gt;
 *********************************************&lt;br /&gt;
 ... &lt;br /&gt;
 strDllToLoad: d:\...\...\...\...\Interop.MediaPlayer.dll&lt;br /&gt;
 strTypeToCreate: MediaPlayer.RadioServerClass&lt;br /&gt;
 strMethodToFuzz_FullName: MediaPlayer.RadioServerClass.Unregister&lt;br /&gt;
 strMethodToFuzz_Name: Unregister&lt;br /&gt;
 strMethodToFuzz_Params: (Int32)&lt;br /&gt;
 Populating ByPassList&lt;br /&gt;
 Fuzzing 15 objects&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister [0]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=1d308fc0 ecx=034a0004 edx=001c7d3a esi=00397030 edi=f0000001&lt;br /&gt;
        eip=1d3639f6 esp=0012ed40 ebp=0012ed64 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx -&lt;br /&gt;
        msdxm!RunDll+0x2ff66:&lt;br /&gt;
        1d3639f6 8b07            mov     eax,dword ptr [edi]  ds:0023:f0000001=????????&lt;br /&gt;
        0:000&lt;br /&gt;
 ....&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister [1]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=1d308fc0 ecx=034a0004 edx=001a4c32 esi=00397030 edi=fff00001&lt;br /&gt;
        eip=1d3639f6 esp=0012ed40 ebp=0012ed64 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx -&lt;br /&gt;
        msdxm!RunDll+0x2ff66:&lt;br /&gt;
        1d3639f6 8b07            mov     eax,dword ptr [edi]  ds:0023:fff00001=????????&lt;br /&gt;
        0:000&lt;br /&gt;
 ....&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister [6]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=1d308fc0 ecx=034a0004 edx=001a4bca esi=00397030 edi=0fffffff&lt;br /&gt;
        eip=1d3639f6 esp=0012ed40 ebp=0012ed64 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx -&lt;br /&gt;
        msdxm!RunDll+0x2ff66:&lt;br /&gt;
        1d3639f6 8b07            mov     eax,dword ptr [edi]  ds:0023:0fffffff=????????&lt;br /&gt;
        0:000&lt;br /&gt;
 ...&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister [7]  - via CDB&lt;br /&gt;
        eax=72006300 ebx=1d308fc0 ecx=034a0004 edx=001c7d3a esi=00397030 edi=00ffffff&lt;br /&gt;
        eip=1d3639f8 esp=0012ed40 ebp=0012ed64 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx -&lt;br /&gt;
        msdxm!RunDll+0x2ff68:&lt;br /&gt;
        1d3639f8 8b5808          mov     ebx,dword ptr [eax+8] ds:0023:72006308=????????&lt;br /&gt;
        0:000&lt;br /&gt;
 ...&lt;br /&gt;
 MediaPlayer.RadioServerClass.Unregister [9]  - via CDB&lt;br /&gt;
        eax=00000000 ebx=1d308fc0 ecx=034a0004 edx=001c2392 esi=00397030 edi=0000ffff&lt;br /&gt;
        eip=1d3639f6 esp=0012ed40 ebp=0012ed64 iopl=0         nv up ei pl zr ac pe nc&lt;br /&gt;
        cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010256&lt;br /&gt;
        *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\System32\msdxm.ocx -&lt;br /&gt;
        msdxm!RunDll+0x2ff66:&lt;br /&gt;
        1d3639f6 8b07            mov     eax,dword ptr [edi]  ds:0023:0000ffff=????????&lt;br /&gt;
        0:000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and notice that we have direct control of EAX.&lt;br /&gt;
&lt;br /&gt;
Now since you can only invoke this Interop.MediaPlayer.dll from Full Trust, this is not technically a vulnerability :)&lt;br /&gt;
&lt;br /&gt;
== Development notes ==&lt;br /&gt;
&lt;br /&gt;
1) to create and invoke private methods change in the utils/reflection.cs file&lt;br /&gt;
&lt;br /&gt;
	public static BindingFlags bfPublicNonPublicFlag = BindingFlags.Public;&lt;br /&gt;
	&lt;br /&gt;
	with&lt;br /&gt;
&lt;br /&gt;
	public static BindingFlags bfBindingFlags_InsSta = bfPublicNonPublicFlag | BindingFlags.Instance | BindingFlags.Static;&lt;br /&gt;
&lt;br /&gt;
 {add more}&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Ari_Elias-Bachrach&amp;diff=147548</id>
		<title>User:Ari Elias-Bachrach</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Ari_Elias-Bachrach&amp;diff=147548"/>
				<updated>2013-03-11T19:00:44Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: redo user page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''These days I spend most of my time:'''&lt;br /&gt;
* Delivering secure code training for Java developers&lt;br /&gt;
* Delivering secure coding training for .net developers&lt;br /&gt;
* Application assessments&lt;br /&gt;
* Explaining issues to developers and locating actionable solutions&lt;br /&gt;
&lt;br /&gt;
'''And a smaller amount of time:'''&lt;br /&gt;
* Evaluating and deploying WAFs&lt;br /&gt;
* Independent research (current project: password policies)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want my resume, check my [http://www.linkedin.com/in/bachrach linkedin profile]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Codereview-Error-Handling&amp;diff=112652</id>
		<title>Codereview-Error-Handling</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Codereview-Error-Handling&amp;diff=112652"/>
				<updated>2011-06-22T20:23:32Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: minor cleanup, a LOT more is needed.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Codereview-Input Validation | lblprev=Input Validation&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Codereview-Deployment | lblnext=Secure Deployment&lt;br /&gt;
}}&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Error Handling==&lt;br /&gt;
Error Handling is important in a number of ways. It may affect the state of the application, or leak system information to a user. The initial failure to prevent the error may cause the application to traverse into an insecure state. Weak error handling also aids the attacker, as the errors returned may assist them in constructing correct attack vectors. A generic error page for most errors is recommended. This approach makes it more difficult for attackers to identify signatures of potentially successful attacks. There are methods which can circumvent systems with leading error handling practices which should be kept in mind; Attacks such as blind SQL injection using booleanization or response time characteristics can be used to address such generic responses. &lt;br /&gt;
&lt;br /&gt;
The other key area relating to error handling is the premise of &amp;quot;fail securely&amp;quot;. Errors induced should not leave the application in an insecure state. Resources should be locked down and released, sessions terminated (if required), and calculations or business logic should be halted (depending on the type of error, of course). &lt;br /&gt;
&lt;br /&gt;
An important aspect of secure application development is to prevent information leakage. Error messages give an attacker great insight into the inner workings of an application. &lt;br /&gt;
&lt;br /&gt;
''The purpose of reviewing the Error Handling code is to assure that the application fails safely under all possible error conditions, expected and unexpected. No sensitive information is presented to the user when an error occurs. ''&lt;br /&gt;
&lt;br /&gt;
For example, SQL injection is much tougher to successfully execute without some healthy error messages. It lessens the attack footprint, and an attacker would have to resort to using “blind SQL injection” which is more difficult and time consuming. &lt;br /&gt;
&lt;br /&gt;
A well-planned error/exception handling strategy is important for three reasons:&lt;br /&gt;
&lt;br /&gt;
#	Good error handling does not give an attacker any information which is a means to an end, attacking the application&lt;br /&gt;
#	A proper centralised error strategy is easier to maintain and reduces the chance of any uncaught errors “Bubbling up” to the front end of an application.&lt;br /&gt;
#	Information leakage can lead to social engineering exploits.&lt;br /&gt;
&lt;br /&gt;
Some development languages provide checked exceptions, which means that the compiler shall complain if an exception for a particular API call is not caught. Java and C# are good examples of this. Languages like C++ and C do not provide this safety net. Languages with checked exception handling still are prone to information leakage, as not all types of errors are checked for. &lt;br /&gt;
&lt;br /&gt;
When an exception or error is thrown, we also need to log this occurrence. Sometimes this is due to bad development, but it can be the result of an attack or some other service your application relies on failing. &lt;br /&gt;
&lt;br /&gt;
All code paths that can cause an exception to be thrown should check for success in order for the exception not to be thrown. &lt;br /&gt;
&lt;br /&gt;
• To avoid a NullPointerException we should check if the object being accessed is not null. &lt;br /&gt;
&lt;br /&gt;
===Error Handling Should Be Centralized if Possible===&lt;br /&gt;
&lt;br /&gt;
When reviewing code it is recommended that you assess the commonality within the application from a error/exception handling perspective. Frameworks have error handling resources which can be exploited to assist in secure programming, and such resources within the framework should be reviewed to assess if the error handling is &amp;quot;wired-up&amp;quot; correctly. &lt;br /&gt;
&lt;br /&gt;
* A generic error page should be used for all exceptions if possible. &lt;br /&gt;
&lt;br /&gt;
This prevents the attacker from identifying internal responses to error states. This also makes it more difficult for automated tools to identify successful attacks.&lt;br /&gt;
&lt;br /&gt;
'''Declarative Exception Handling'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;exception   key=”bank.error.nowonga” &lt;br /&gt;
                    path=”/NoWonga.jsp” &lt;br /&gt;
                    type=”mybank.account.NoCashException”/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could be found in the struts-config.xml file, a key file when reviewing the wired-up struts environment&lt;br /&gt;
&lt;br /&gt;
===Java Servlets and JSP===&lt;br /&gt;
&lt;br /&gt;
Specification can be done in web.xml in order to handle unhandled exceptions. When Unhandled exceptions occur, but are not caught in code, the user is forwarded to a generic error page: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;error-page&amp;gt;&lt;br /&gt;
       &amp;lt;exception-type&amp;gt;UnhandledException&amp;lt;/exception-type&amp;gt;&lt;br /&gt;
       &amp;lt;location&amp;gt;GenericError.jsp&amp;lt;/location&amp;gt;&lt;br /&gt;
 &amp;lt;/error-page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also in the case of HTTP 404 or HTTP 500 errors during the review you may find: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;error-page&amp;gt;&lt;br /&gt;
  &amp;lt;error-code&amp;gt;500&amp;lt;/error-code&amp;gt;&lt;br /&gt;
  &amp;lt;location&amp;gt;GenericError.jsp&amp;lt;/location&amp;gt;&lt;br /&gt;
 &amp;lt;/error-page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Failing Securely===&lt;br /&gt;
Types of errors:&lt;br /&gt;
*The result of business logic conditions not being met.&lt;br /&gt;
*The result of the environment wherein the business logic resides fails.&lt;br /&gt;
*The result of upstream or downstream systems upon which the application depends fail.&lt;br /&gt;
*Technical hardware / physical failure.&lt;br /&gt;
&lt;br /&gt;
Failures are never expected, but they do occur. In the event of a failure, it is important not to leave the &amp;quot;doors&amp;quot; of the application open and the keys to other &amp;quot;rooms&amp;quot; within the application sitting on the table. In the course of a logical workflow, which is designed based upon requirements, errors may occur which can be programmatically handled, such as a connection pool not being available, or a downstream server not being contactable. &lt;br /&gt;
&lt;br /&gt;
Such areas of failure should be examined during the course of the code review. It should be examined if all resources should be released in the case of a failure and during the thread of execution if there is any potential for resource leakage, resources being memory, connection pools, file handles etc. &lt;br /&gt;
&lt;br /&gt;
The review of code should also include pinpointing areas where the user session should be terminated or invalidated. Sometimes errors may occur which do not make any logical sense from a business logic perspective or a technical standpoint; &lt;br /&gt;
&lt;br /&gt;
e.g: &amp;quot;A logged in user looking to access an account which is not registered to that user and such data could not be inputted in the normal fashion.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Such conditions reflect possible malicious activity. Here we should review if the code is in any way defensive and kills the user’s session object and forwards the user to the login page. (Keep in mind that the session object should be examined upon every HTTP request).&lt;br /&gt;
&lt;br /&gt;
===Information Burial===&lt;br /&gt;
Swallowing exceptions into an empty catch() block is not advised as an audit trail of the cause of the exception would be incomplete.&lt;br /&gt;
&lt;br /&gt;
==Generic Error Messages==&lt;br /&gt;
We should use a localized description string in every exception, a friendly error reason such as “System Error – Please try again later”. When the user sees an error message, it will be derived from this description string of the exception that was thrown, and never from the exception class which may contain a stack trace, line number where the error occurred, class name, or method name. &lt;br /&gt;
&lt;br /&gt;
Do not expose sensitive information in exception messages. Information such as paths on the local file system is considered privileged information; any internal system information should be hidden from the user. As mentioned before, an attacker could use this information to gather private user information from the application or components that make up the app. &lt;br /&gt;
&lt;br /&gt;
Don’t put people’s names or any internal contact information in error messages. Don’t put any “human” information, which would lead to a level of familiarity and a social engineering exploit.&lt;br /&gt;
&lt;br /&gt;
==How to Locate the Potentially Vulnerable Code==&lt;br /&gt;
&lt;br /&gt;
===JAVA===&lt;br /&gt;
IIn Java we have the concept of an error object; the Exception object. This lives in the Java package java.lang and is derived from the Throwable object. Exceptions are thrown when an abnormal occurrence has occurred. Another object derived from Throwable is the Error object, which is thrown when something more serious occurs. &lt;br /&gt;
&lt;br /&gt;
Information leakage can occur when developers use some exception methods, which ‘bubble’ to the user UI due to a poor error handling strategy. The methods are as follows: &lt;br /&gt;
&lt;br /&gt;
printStackTrace()&amp;lt;br&amp;gt;&lt;br /&gt;
getStackTrace()&lt;br /&gt;
&lt;br /&gt;
Also important to know is that the output of these methods is printed in System console, the same as System.out.println(e) where there is an Exception. Be sure to not redirect the outputStream to PrintWriter object of JSP, by convention called &amp;quot;out&amp;quot;. Ex. printStackTrace(out); &lt;br /&gt;
&lt;br /&gt;
Also another object to look at is the java.lang.system package:&lt;br /&gt;
&lt;br /&gt;
setErr() and the System.err field.&lt;br /&gt;
&lt;br /&gt;
===.NET===&lt;br /&gt;
In .NET a System.Exception object exists. Commonly used child objects such as ApplicationException and SystemException are used. It is not recommended that you throw or catch a SystemException this is thrown by runtime. &lt;br /&gt;
&lt;br /&gt;
When an error occurs, either the system or the currently executing application reports it by throwing an exception containing information about the error, similar to Java. Once thrown, an exception is handled by the application or by the default exception handler. This Exception object contains similar methods to the Java implementation such as: &lt;br /&gt;
&lt;br /&gt;
StackTrace &amp;lt;br&amp;gt;&lt;br /&gt;
Source &amp;lt;br&amp;gt;&lt;br /&gt;
Message &amp;lt;br&amp;gt;&lt;br /&gt;
HelpLink &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In .NET we need to look at the error handling strategy from the point of view of global error handling and the handling of unexpected errors. This can be done in many ways and this article is not an exhaustive list. Firstly, an Error Event is thrown when an unhandled exception is thrown. &lt;br /&gt;
&lt;br /&gt;
This is part of the TemplateControl class. &lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUITemplateControlClassErrorTopic.asp&lt;br /&gt;
&lt;br /&gt;
Error handling can be done in three ways in .NET&lt;br /&gt;
&lt;br /&gt;
*In the web.config file's customErrors section. &lt;br /&gt;
*In the global.asax file's Application_Error sub. &lt;br /&gt;
*On the aspx or associated codebehind page in the Page_Error sub&lt;br /&gt;
&lt;br /&gt;
The order of error handling events in .NET is as follows: &lt;br /&gt;
#	On the Page in the Page_Error sub.&lt;br /&gt;
#	The global.asax Application_Error sub &lt;br /&gt;
#	The web.config file &lt;br /&gt;
&lt;br /&gt;
It is recommended to look in these areas to understand the error strategy of the application.&lt;br /&gt;
&lt;br /&gt;
===Classic ASP===&lt;br /&gt;
Unlike Java and .NET, classic ASP pages do not have structured error handling in try-catch blocks. Instead they have a specific object called &amp;quot;err&amp;quot;. This make error handling in a classic ASP pages hard to do and prone to design errors on error handlers, causing race conditions and information leakage. Also, as ASP uses VBScript (a subtract of Visual Basic), sentences like &amp;quot;On Error GoTo label&amp;quot; are not available.&lt;br /&gt;
&lt;br /&gt;
==Vulnerable Patterns for Error Handling==&lt;br /&gt;
&lt;br /&gt;
===Page_Error===&lt;br /&gt;
&lt;br /&gt;
Page_Error is page level handling which is run on the server side.&lt;br /&gt;
Below is an example but the error information is a little too informative and hence bad practice.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script language=&amp;quot;C#&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 Sub Page_Error(Source As Object, E As EventArgs)&lt;br /&gt;
 Dim message As String = &amp;lt;Font Color=&amp;quot;red&amp;quot;&amp;gt;Request.Url.ToString()&amp;amp; Server.GetLastError().ToString()&amp;lt;/font&amp;gt;&lt;br /&gt;
 Response.Write(message) // display message &lt;br /&gt;
 End Sub&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The text in the example above has a number of issues: Firstly, it redisplays the HTTP request to the user in the form of Request.Url.ToString() Assuming there has been no data validation prior to this point, we are vulnerable to cross site scripting attacks!! Secondly, the error message and stack trace is displayed to the user using Server.GetLastError().ToString() which divulges internal information regarding the application. &lt;br /&gt;
&lt;br /&gt;
After the Page_Error is called, the Application_Error sub is called.&lt;br /&gt;
&lt;br /&gt;
===Global.asax===&lt;br /&gt;
&lt;br /&gt;
When an error occurs, the Application_Error sub is called. In this method we can log the error and redirect to another page. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ Import Namespace=&amp;quot;System.Diagnostics&amp;quot; %&amp;gt;&lt;br /&gt;
   &amp;lt;script language=&amp;quot;C#&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
     void Application_Error(Object sender, EventArgs e) {&lt;br /&gt;
          String Message = &amp;quot;\n\nURL: http://localhost/&amp;quot; + Request.Path&lt;br /&gt;
                           + &amp;quot;\n\nMESSAGE:\n &amp;quot; + Server.GetLastError().Message&lt;br /&gt;
                           + &amp;quot;\n\nSTACK TRACE:\n&amp;quot; + Server.GetLastError().StackTrace;&lt;br /&gt;
          // Insert into Event Log&lt;br /&gt;
          EventLog Log = new EventLog();&lt;br /&gt;
          Log.Source = LogName;&lt;br /&gt;
          Log.WriteEntry(Message, EventLogEntryType.Error);&lt;br /&gt;
        Server.Redirect(Error.htm) // this shall also clear the error&lt;br /&gt;
     }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above is an example of code in Global.asax and the Application_Error method. The error is logged and then the user is redirected. Unvalidated parameters are being logged here in the form of Request.Path. Care must be taken not to log or redisplay unvalidated input from any external source.&lt;br /&gt;
&lt;br /&gt;
===Web.config===&lt;br /&gt;
Web.config has custom error tags which can be used to handle errors. This is called last and if Page_error or Application_error is called and has functionality, that functionality shall be executed first. As long as the previous two handling mechanisms do not redirect or clear (Response.Redirect or a Server.ClearError), this will be called and you shall be forwarded to the page defined in web.config. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;customErrors defaultRedirect=&amp;quot;error.html&amp;quot; mode=&amp;quot;On|Off|RemoteOnly&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;error statusCode=&amp;quot;statuscode&amp;quot; redirect=&amp;quot;url&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/customErrors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The “On&amp;quot; directive means that custom errors are enabled. If no defaultRedirect is specified, users see a generic error. The &amp;quot;Off&amp;quot; directive means that custom errors are disabled. This allows the displaying of detailed errors. &amp;quot;RemoteOnly&amp;quot; specifies that custom errors are shown only to remote clients, and ASP.NET errors are shown to the local host. This is the default. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;customErrors mode=&amp;quot;On&amp;quot; defaultRedirect=&amp;quot;error.html&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;error statusCode=&amp;quot;500&amp;quot; redirect=&amp;quot;err500.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;notHere.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;error statusCode=&amp;quot;403&amp;quot; redirect=&amp;quot;notAuthz.aspx&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/customErrors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Leading Practice for Error Handling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Try &amp;amp; Catch (Java/ .NET)===&lt;br /&gt;
Code that might throw exceptions should be in a try block and code that handles exceptions in a catch block. The catch block is a series of statements beginning with the keyword catch, followed by an exception type and an action to be taken. These are very similar in Java and .NET &lt;br /&gt;
&lt;br /&gt;
'''Example:'''&lt;br /&gt;
&lt;br /&gt;
'''Java Try-Catch:'''&lt;br /&gt;
&lt;br /&gt;
 public class DoStuff {&lt;br /&gt;
     public static void Main() {&lt;br /&gt;
         try {&lt;br /&gt;
             StreamReader sr = File.OpenText(&amp;quot;stuff.txt&amp;quot;);&lt;br /&gt;
             Console.WriteLine(&amp;quot;Reading line {0}&amp;quot;, sr.ReadLine());    &lt;br /&gt;
         }&lt;br /&gt;
         catch(Exception e) {&lt;br /&gt;
             Console.WriteLine(&amp;quot;An error occurred. Please leave to room”);&lt;br /&gt;
 	 logerror(“Error: “, e);&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''.NET Try–Catch'''&lt;br /&gt;
&lt;br /&gt;
 public void run() {&lt;br /&gt;
             while (!stop) {&lt;br /&gt;
                 try {&lt;br /&gt;
 &lt;br /&gt;
                     // Perform work here&lt;br /&gt;
 &lt;br /&gt;
                 } catch (Throwable t) {&lt;br /&gt;
                     // Log the exception and continue&lt;br /&gt;
 		WriteToUser(“An Error has occurred, put the kettle on”);&lt;br /&gt;
                     logger.log(Level.SEVERE, &amp;quot;Unexception exception&amp;quot;, t);&lt;br /&gt;
                 }&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
&lt;br /&gt;
In general, it is best practice to catch a specific type of exception rather than use the basic catch(Exception) or catch(Throwable) statement in the case of Java. &lt;br /&gt;
&lt;br /&gt;
In classic ASP there are two ways to do error handling, the first is using the err object with an On Error Resume Next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Public Function IsInteger (ByVal Number)	 &lt;br /&gt;
   Dim Res, tNumber&lt;br /&gt;
   Number = Trim(Number)&lt;br /&gt;
   tNumber=Number		&lt;br /&gt;
   On Error Resume Next	                     'If an error occurs continue execution&lt;br /&gt;
   Number = CInt(Number) 	             'if Number is a alphanumeric string a Type Mismatch error will occur&lt;br /&gt;
   Res = (err.number = 0) 	             'If there are no errors then return true&lt;br /&gt;
   On Error GoTo 0			     'If an error occurs stop execution and display error&lt;br /&gt;
   re.Pattern = &amp;quot;^[\+\-]? *\d+$&amp;quot;	     'only one +/- and digits are allowed&lt;br /&gt;
   IsInteger = re.Test(tNumber) And Res&lt;br /&gt;
 End Function&lt;br /&gt;
 &lt;br /&gt;
The second is using an error handler on an error page (http://support.microsoft.com/kb/299981).&lt;br /&gt;
 &lt;br /&gt;
 Dim ErrObj&lt;br /&gt;
 set ErrObj = Server.GetLastError()&lt;br /&gt;
 'Now use ErrObj as the regular err object&lt;br /&gt;
&lt;br /&gt;
===Releasing resources and good housekeeping===&lt;br /&gt;
If the language in question has a finally method, use it. The finally method is guaranteed to always be called. The finally method can be used to release resources referenced by the method that threw the exception. This is very important. An example would be if a method gained a database connection from a pool of connections, and an exception occurred without finally, the connection object shall not be returned to the pool for some time (until the timeout). This can lead to pool exhaustion. finally() is called even if no exception is thrown. &lt;br /&gt;
&lt;br /&gt;
 try {&lt;br /&gt;
        System.out.println(&amp;quot;Entering try statement&amp;quot;);&lt;br /&gt;
        out = new PrintWriter(new FileWriter(&amp;quot;OutFile.txt&amp;quot;));&lt;br /&gt;
      //Do Stuff….&lt;br /&gt;
 &lt;br /&gt;
    } catch (Exception e) {&lt;br /&gt;
        System.err.println(&amp;quot;Error occurred!”);&lt;br /&gt;
 &lt;br /&gt;
    } catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Input exception &amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
    } finally {&lt;br /&gt;
 &lt;br /&gt;
        if (out != null) { &lt;br /&gt;
            out.close(); // RELEASE RESOURCES&lt;br /&gt;
        } &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
A Java example showing finally() being used to release system resources.&lt;br /&gt;
&lt;br /&gt;
===Classic ASP===&lt;br /&gt;
For Classic ASP pages it is recommended to enclose all cleaning in a function and call it into an error handling statement after an &amp;quot;On Error Resume Next&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Centralised exception handling (Struts Example)===&lt;br /&gt;
Building an infrastructure for consistent error reporting proves more difficult than error handling. Struts provides the ActionMessages and ActionErrors classes for maintaining a stack of error messages to be reported, which can be used with JSP tags like &amp;lt;html: error&amp;gt; to display these error messages to the user. &lt;br /&gt;
&lt;br /&gt;
To report a different severity of a message in a different manner (like error, warning, or information) the following tasks are required: &lt;br /&gt;
&lt;br /&gt;
# Register, instantiate the errors under the appropriate severity&lt;br /&gt;
# Identify these messages and show them in a consistent manner.&lt;br /&gt;
&lt;br /&gt;
Struts ActionErrors class makes error handling quite easy:&lt;br /&gt;
&lt;br /&gt;
 ActionErrors errors = new ActionErrors()&lt;br /&gt;
 errors.add(&amp;quot;fatal&amp;quot;, new ActionError(&amp;quot;....&amp;quot;)); &lt;br /&gt;
 errors.add(&amp;quot;error&amp;quot;, new ActionError(&amp;quot;....&amp;quot;)); &lt;br /&gt;
 errors.add(&amp;quot;warning&amp;quot;, new ActionError(&amp;quot;....&amp;quot;));&lt;br /&gt;
 errors.add(&amp;quot;information&amp;quot;, new ActionError(&amp;quot;....&amp;quot;)); &lt;br /&gt;
 saveErrors(request,errors); // Important to do this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have added the errors, we display them by using tags in the HTML page. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;logic:messagePresent property=&amp;quot;error&amp;quot;&amp;gt; &lt;br /&gt;
 &amp;lt;html:messages property=&amp;quot;error&amp;quot; id=&amp;quot;errMsg&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;bean:write name=&amp;quot;errMsg&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/html:messages&amp;gt;&lt;br /&gt;
 &amp;lt;/logic:messagePresent &amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Classic ASP===&lt;br /&gt;
For classic ASP pages you need to do some IIS configuration, follow the same link for more information http://support.microsoft.com/kb/299981&lt;br /&gt;
&lt;br /&gt;
{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Codereview-Input Validation | lblprev=Input Validation&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Codereview-Deployment | lblnext=Secure Deployment&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Reviewing_Code_for_Cross-site_scripting&amp;diff=112651</id>
		<title>Reviewing Code for Cross-site scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Reviewing_Code_for_Cross-site_scripting&amp;diff=112651"/>
				<updated>2011-06-22T20:03:02Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: readability improvements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Reviewing Code for Data Validation | lblprev=&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Reviewing Code for Cross-Site Request Forgery | lblnext=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
Cross-site scripting (XSS) attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application reflects user input without validation or encoding.&lt;br /&gt;
&lt;br /&gt;
==Related Security Activities==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Description of Cross-site Scripting Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the OWASP article on [[Cross-site Scripting (XSS)]] Vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
===How to Avoid Cross-site scripting  Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the [[:Category:OWASP Guide Project|OWASP Development Guide]] article on [[Phishing]].&lt;br /&gt;
&lt;br /&gt;
See the [[:Category:OWASP Guide Project|OWASP Development Guide]] article on [[Data Validation]].&lt;br /&gt;
&lt;br /&gt;
===How to Test for Cross-site scripting  Vulnerabilities===&lt;br /&gt;
&lt;br /&gt;
See the [[:Category:OWASP Testing Project|OWASP Testing Guide]] article on how to [[Testing for Cross site scripting|Test for Cross site scripting]] Vulnerabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Vulnerable Code example==&lt;br /&gt;
If the text inputted by the user is reflected back without proper encoding, the browser will interpret the inputted script as part of the mark up, and execute the code accordingly. &lt;br /&gt;
&lt;br /&gt;
To mitigate this type of vulnerability we need to perform a number of security tasks in our code: &lt;br /&gt;
&lt;br /&gt;
# Validate data&lt;br /&gt;
# Encode unsafe output&lt;br /&gt;
 &lt;br /&gt;
 import org.apache.struts.action.*; &lt;br /&gt;
 import org.apache.commons.beanutils.BeanUtils; &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest; &lt;br /&gt;
 import javax.servlet.http.HttpServletResponse; &lt;br /&gt;
 &lt;br /&gt;
 public final class InsertEmployeeAction extends Action { &lt;br /&gt;
 &lt;br /&gt;
 public ActionForward execute(ActionMapping mapping, ActionForm form,&lt;br /&gt;
     HttpServletRequest request, HttpServletResponse response) throws Exception{ &lt;br /&gt;
 &lt;br /&gt;
 // Setting up objects and vairables.&lt;br /&gt;
 &lt;br /&gt;
 Obj1 service = new Obj1(); &lt;br /&gt;
 ObjForm objForm = (ObjForm) form; &lt;br /&gt;
 InfoADT adt = new InfoADT (); &lt;br /&gt;
 BeanUtils.copyProperties(adt, objForm); &lt;br /&gt;
 &lt;br /&gt;
 	String searchQuery = objForm.getqueryString();&lt;br /&gt;
 	String payload = objForm.getPayLoad();&lt;br /&gt;
 try { &lt;br /&gt;
 service.doWork(adt);  / /do something with the data&lt;br /&gt;
 ActionMessages messages = new ActionMessages(); &lt;br /&gt;
 ActionMessage message = new ActionMessage(&amp;quot;success&amp;quot;, adt.getName() ); &lt;br /&gt;
 messages.add( ActionMessages.GLOBAL_MESSAGE, message ); &lt;br /&gt;
 saveMessages( request, messages ); &lt;br /&gt;
 request.setAttribute(&amp;quot;Record&amp;quot;, adt); &lt;br /&gt;
 return (mapping.findForward(&amp;quot;success&amp;quot;));&lt;br /&gt;
 }&lt;br /&gt;
 catch( DatabaseException de ) &lt;br /&gt;
 {&lt;br /&gt;
 ActionErrors errors = new ActionErrors(); &lt;br /&gt;
 ActionError error = new ActionError(&amp;quot;error.employee.databaseException&amp;quot; + “Payload: “+payload);&lt;br /&gt;
 errors.add( ActionErrors.GLOBAL_ERROR, error ); &lt;br /&gt;
 saveErrors( request, errors ); &lt;br /&gt;
 return (mapping.findForward(&amp;quot;error: &amp;quot;+ searchQuery)); &lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The text above shows some common mistakes in the development of this struts action class. First, the data passed in the HttpServletRequest is placed into a parameter without being validated. &lt;br /&gt;
&lt;br /&gt;
Focusing on XSS we can see that this action class returns a message, ActionMessage, if the function is successful. If an error the code in the Try/Catch block is executed, the data contained in the HttpServletRequest is returned to the user, unvalidated and exactly in the format in which the user inputted it. &lt;br /&gt;
&lt;br /&gt;
 import java.io.*; &lt;br /&gt;
 import javax.servlet.http.*; &lt;br /&gt;
 import javax.servlet.*; &lt;br /&gt;
 &lt;br /&gt;
 public class HelloServlet extends HttpServlet &lt;br /&gt;
 { &lt;br /&gt;
 public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException &lt;br /&gt;
 { &lt;br /&gt;
 &lt;br /&gt;
 String input = req.getHeader(“USERINPUT”);&lt;br /&gt;
 &lt;br /&gt;
 PrintWriter out = res.getWriter(); &lt;br /&gt;
 out.println(input);  // echo User input.&lt;br /&gt;
 out.close(); 	&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following is a second example of an XSS vulnerable function. Echoing un-validated user input back to the browser provides a large vulnerability footprint. &lt;br /&gt;
&lt;br /&gt;
===.NET Example (ASP.NET version 1.1 ASP.NET version 2.0)===&lt;br /&gt;
&lt;br /&gt;
The server side code for a VB.NET application may have similar functionality.&lt;br /&gt;
&lt;br /&gt;
 ' SearchResult.aspx.vb &lt;br /&gt;
 Imports System &lt;br /&gt;
 Imports System.Web &lt;br /&gt;
 Imports System.Web.UI &lt;br /&gt;
 Imports System.Web.UI.WebControls &lt;br /&gt;
 &lt;br /&gt;
 Public Class SearchPage Inherits System.Web.UI.Page &lt;br /&gt;
 &lt;br /&gt;
 Protected txtInput As TextBox &lt;br /&gt;
 Protected cmdSearch As Button &lt;br /&gt;
 Protected lblResult As Label Protected &lt;br /&gt;
 &lt;br /&gt;
 Sub cmdSearch _Click(Source As Object, _ e As EventArgs) &lt;br /&gt;
 	&lt;br /&gt;
 // Do Search…..&lt;br /&gt;
 	// …………&lt;br /&gt;
 &lt;br /&gt;
 lblResult.Text=&amp;quot;You Searched for: &amp;quot; &amp;amp; txtInput.Text &lt;br /&gt;
 &lt;br /&gt;
 // Display Search Results…..&lt;br /&gt;
 // …………&lt;br /&gt;
 &lt;br /&gt;
 End Sub &lt;br /&gt;
 End Class&lt;br /&gt;
&lt;br /&gt;
This is a VB.NET example of a vulnerable piece of search functionality which echoes back the data inputted by the user. To mitigate against this, we need proper data validation and in the case of stored XSS attacks, we need to encode known bad input (as mentioned before). Note that this code might not be vulnerable if the developers use a proper declarative validation (ASPX regexp validator or routine, and validateRequest not set to False).&lt;br /&gt;
&lt;br /&gt;
===Classic ASP Example===&lt;br /&gt;
Classic ASP is also XSS prone, just like most Web technologies.&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;%&lt;br /&gt;
    ...&lt;br /&gt;
    Response.Write &amp;quot;&amp;lt;div class='label'&amp;gt;Please confirm your data&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&amp;quot; &lt;br /&gt;
    Response.Write &amp;quot;Name: &amp;quot; &amp;amp; Request.Form(&amp;quot;UserFullName&amp;quot;)&lt;br /&gt;
    ...&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Protecting against XSS==&lt;br /&gt;
In the .NET framework there are some in-built security functions which can assist in data validation and HTML encoding, namely, ASP.NET 1.1 '''request validation '''feature and '''HttpUtility.HtmlEncode'''.&lt;br /&gt;
&lt;br /&gt;
Microsoft in their wisdom state that you should not rely solely on ASP.NET request validation and that it should be used in conjunction with your own data validation, such as regular expressions (mentioned below). &lt;br /&gt;
&lt;br /&gt;
The request validation feature is disabled on an individual page by specifying in the page directive.&lt;br /&gt;
&lt;br /&gt;
  '''&amp;lt;%@ Page validateRequest=&amp;quot;false&amp;quot; %&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
or by setting '''ValidateRequest=&amp;quot;false&amp;quot;''' on the '''@ Pages''' element. &lt;br /&gt;
&lt;br /&gt;
or in the '''web.config''' file:&lt;br /&gt;
&lt;br /&gt;
You can disable request validation by adding a &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;'''pages'''&amp;gt; element with '''validateRequest=&amp;quot;false&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
So when reviewing code, make sure the validateRequest directive is enabled and if not, investigate what method of data validation is being used, if any. Check that ASP.NET Request validation is enabled in  '''Machine.config'''.&lt;br /&gt;
Request validation is enabled by ASP.NET by default. You can see the following default setting in the '''Machine.config''' file.&lt;br /&gt;
&lt;br /&gt;
  '''&amp;lt;pages validateRequest=&amp;quot;true&amp;quot; ... /&amp;gt; '''&lt;br /&gt;
&lt;br /&gt;
'''HTML Encoding:'''&lt;br /&gt;
&lt;br /&gt;
Content to be displayed can easily be encoded using the HtmlEncode function. This is done by calling:&lt;br /&gt;
&lt;br /&gt;
  '''Server.HtmlEncode(string)'''&lt;br /&gt;
&lt;br /&gt;
Using the HTML encoder example for a form:&lt;br /&gt;
&lt;br /&gt;
Text Box: &amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; ValidateRequest=&amp;quot;false&amp;quot; %&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt; &lt;br /&gt;
  void searchBtn _Click(object sender, EventArgs e) { &lt;br /&gt;
  Response.Write(HttpUtility.HtmlEncode(inputTxt.Text)); } &lt;br /&gt;
  &amp;lt;/script&amp;gt; &lt;br /&gt;
  &amp;lt;html&amp;gt; &lt;br /&gt;
  &amp;lt;body&amp;gt; &lt;br /&gt;
  &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt; &lt;br /&gt;
  &amp;lt;asp:TextBox ID=&amp;quot;inputTxt&amp;quot; Runat=&amp;quot;server&amp;quot; TextMode=&amp;quot;MultiLine&amp;quot; Width=&amp;quot;382px&amp;quot; Height=&amp;quot;152px&amp;quot;&amp;gt; &lt;br /&gt;
  &amp;lt;/asp:TextBox&amp;gt; &lt;br /&gt;
  &amp;lt;asp:Button ID=&amp;quot;searchBtn&amp;quot; Runat=&amp;quot;server&amp;quot; Text=&amp;quot;Submit&amp;quot; OnClick=&amp;quot; searchBtn _Click&amp;quot; /&amp;gt; &lt;br /&gt;
  &amp;lt;/form&amp;gt; &lt;br /&gt;
  &amp;lt;/body&amp;gt; &lt;br /&gt;
  &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Classic ASP pages the encoding function is used pretty much the same as in ASP.NET&lt;br /&gt;
&lt;br /&gt;
 Response.Write Server.HtmlEncode(inputTxt.Text)&lt;br /&gt;
&lt;br /&gt;
===Stored Cross Site Script===&lt;br /&gt;
'''Using HTML encoding to encode potentially unsafe output.'''&lt;br /&gt;
&lt;br /&gt;
Malicious scripts can be stored/persisted in a database and will not execute until retrieved by a user. This has been seen in bulletin boards and some early webmail applications. This incubated attack can sit dormant for a long period of time until a user decides to view the page where the injected script is present. At this point the script executes on the user’s browser.&lt;br /&gt;
&lt;br /&gt;
The original source of input for the injected script may be from another vulnerable application, which is common in enterprise architectures. Therefore the application at hand may have good input data validation but the data persisted may not have been entered via this application per se, but via another application. &lt;br /&gt;
&lt;br /&gt;
In this case we cannot be 100% sure the data to be displayed to the user is safe (as it could have found its way in via another path in the enterprise). The approach to mitigate against this is to ensure that data sent to the browser with the purpose of being displayed literally is not going to be interpreted by the browser as mark-up.&lt;br /&gt;
&lt;br /&gt;
We encode known bad to mitigate against this “enemy within”. This, in effect, assures that the browser interprets any special characters as data and markup. &lt;br /&gt;
How is this done?&lt;br /&gt;
HTML encoding usually means '''&amp;amp;lt;''' becomes '''&amp;amp;amp;lt;''', '''&amp;amp;gt;''' becomes '''&amp;amp;amp;gt;''', '''&amp;amp;amp;''' becomes '''&amp;amp;amp;amp;''', and '''&amp;amp;quot;''' becomes '''&amp;amp;amp;quot;'''.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
! From	!! To&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;lt;	|| &amp;amp;amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;gt;	|| &amp;amp;amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;#40;	|| &amp;amp;amp;&amp;amp;#35;40;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;#41;	|| &amp;amp;amp;&amp;amp;#35;41;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;#35;	|| &amp;amp;amp;&amp;amp;#35;35;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;	|| &amp;amp;amp;amp;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;quot;|| &amp;amp;amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So, for example, if the application has a string &amp;quot;&amp;lt;script&amp;gt;&amp;quot; and it wants a browser to display it as &amp;quot;&amp;lt;script&amp;gt;&amp;quot;, it can first HTML-encode it to the form &amp;quot;&amp;amp;amp;lt;script&amp;amp;amp;gt;&amp;quot; before including it in the web page that gets sent to the browser.&lt;br /&gt;
&lt;br /&gt;
{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Reviewing Code for Data Validation | lblprev=&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Reviewing Code for Cross-Site Request Forgery | lblnext=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet&amp;diff=100110</id>
		<title>XSS (Cross Site Scripting) Prevention Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet&amp;diff=100110"/>
				<updated>2011-01-12T20:54:00Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: make link look nicer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
This article provides a simple positive model for preventing [[XSS]] using output escaping/encoding properly. While there are a huge number of XSS attack vectors, following a few simple rules can completely defend against this serious attack. This article does not explore the technical or business impact of XSS. Suffice it to say that it can lead to an attacker gaining the ability to do anything a victim can do through their browser.&lt;br /&gt;
&lt;br /&gt;
These rules apply to all the different varieties of XSS. Both [[XSS#Stored_and_Reflected_XSS_Attacks | reflected and stored XSS]] can be addressed by performing the appropriate escaping on the server-side. The use of an escaping/encoding library like the one in [[ESAPI]] is strongly recommended as there are many special cases. [[DOM Based XSS]] can be addressed by applying these rules on the client on untrusted data.&lt;br /&gt;
&lt;br /&gt;
For a great cheatsheet on the attack vectors related to XSS, please refer to the excellent [http://ha.ckers.org/xss.html XSS Cheat Sheet] by RSnake. More background on browser security and the various browsers can be found in the [http://code.google.com/p/browsersec/ Browser Security Handbook].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untrusted Data ==&lt;br /&gt;
&lt;br /&gt;
Untrusted data is most often data that comes from the HTTP request, in the form of URL parameters, form fields, headers, or cookies. But data that comes from databases, web services, and other sources is frequently untrusted from a security perspective.  That is, it might not have been perfectly validated. The [[Searching for Code in J2EE/Java|OWASP Code Review Guide]] has a decent list of methods that return untrusted data in various languages, but you should be careful about your own methods as well.&lt;br /&gt;
&lt;br /&gt;
Untrusted data should always be treated as though it contains an attack. That means you should not send it '''anywhere''' without taking steps to make sure that any attacks are detected and neutralized. As applications get more and more interconnected, the likelihood of a buried attack being decoded or executed by a downstream interpreter increases rapidly.&lt;br /&gt;
&lt;br /&gt;
Traditionally, [[Data Validation|input validation]] has been the preferred approach for handling untrusted data. However, input validation is not a great solution for injection attacks. First, input validation is typically done when the data is received, before the destination is known. That means that we don't know which characters might be significant in the target interpreter.  Second, and possibly even more importantly, applications must allow potentially harmful characters in. For example, should poor Mr. O'Malley be prevented from registering in the database simply because SQL considers ' a special character?&lt;br /&gt;
&lt;br /&gt;
While input validation is important and should always be performed, it is not a complete solution for injection attacks. It's better to think of input validation as [[Defense in depth|defense in depth]] and use '''escaping''' as described below as the primary defense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Escaping (aka Output Encoding) ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;[http://www.w3.org/TR/charmod/#sec-Escaping Escaping]&amp;quot; is a technique used to ensure that characters are treated as data, not as characters that are relevant to the interpreter's parser. There are lots of different types of escaping, sometimes confusingly called output &amp;quot;encoding.&amp;quot;  Some of these techniques define a special &amp;quot;escape&amp;quot; character, and other techniques have a more sophisticated syntax that involves several characters.&lt;br /&gt;
&lt;br /&gt;
Do not confuse output escaping with the notion of Unicode character [http://www.w3.org/TR/charmod/#sec-Digital encoding], which involves mapping a Unicode character to a sequence of bits. This level of encoding is automatically decoded, and does '''not''' defuse attacks. However, if there are misunderstandings about the intended charset between the server and browser, it may cause unintended characters to be communicated, possibly enabling XSS attacks. This is why it is still important to [http://www.w3.org/TR/charmod/#sec-Encodings specify] the Unicode character encoding (charset), such as UTF-8, for all communications.&lt;br /&gt;
&lt;br /&gt;
Escaping is the primary means to make sure that untrusted data can't be used to convey an injection attack. There is '''no harm''' in escaping data properly - it will still render in the browser properly. Escaping simply lets the interpreter know that the data is not intended to be executed, and therefore prevents attacks from working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Injection Theory ==&lt;br /&gt;
&lt;br /&gt;
[[Injection Flaws|Injection]] is an attack that involves breaking out of a data context and switching into a code context through the use of special characters that are significant in the interpreter being used. A data context is like &amp;amp;lt;div&amp;gt;data context&amp;lt;/div&amp;gt;. If the attacker's data gets placed into the data context, they might break out like this &amp;amp;lt;div&amp;gt;data &amp;amp;lt; script&amp;gt;alert(&amp;quot;attack&amp;quot;)&amp;lt;/script&amp;gt; context&amp;lt;/div&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
XSS is a form of injection where the interpreter is the browser and attacks are buried in an HTML document. HTML is easily the worst mashup of code and data of all time, as there are so many possible places to put code and so many different valid encodings. HTML is particularly difficult because it is not only hierarchical, but also contains many different parsers (XML, HTML, JavaScript, VBScript, CSS, URL, etc...).&lt;br /&gt;
&lt;br /&gt;
To really understand what's going on with XSS, you have to consider injection into the hierarchical structure of the [http://www.w3schools.com/HTMLDOM/default.asp HTML DOM]. Given a place to insert data into an HTML document (that is, a place where a developer has allowed untrusted data to be included in the DOM), there are two ways to inject code:&lt;br /&gt;
&lt;br /&gt;
;Injecting UP:The most common way is to close the current context and start a new code context.  For example, this is what you do when you close an HTML attribute with a &amp;quot;&amp;gt; and start a new &amp;amp;lt;script&amp;gt; tag. This attack closes the original context (going up in the hierarchy) and then starts a new tag that will allow script code to execute. Remember that you may be able to skip many layers up in the hierarchy when trying to break out of your current context. For example, a &amp;amp;lt;/script&amp;gt; tag may be able to terminate a script block even if it is injected inside a quoted string inside a method call inside the script. This happens because the HTML parser runs before the JavaScript parser.&lt;br /&gt;
&lt;br /&gt;
;Injecting DOWN:The less common way to perform XSS injection is to introduce a code subcontext without closing the current context. For example, if the attacker is able to change &amp;amp;lt;img src=&amp;quot;...UNTRUSTED DATA HERE...&amp;quot; /&amp;gt; into &amp;amp;lt; img src=&amp;quot;javascript:alert(document.cookie)&amp;quot; /&amp;gt; they do not have to break out of the HTML attribute context.  Instead, they introduce a subcontext that allows scripting within the src attribute (in this case a javascript url). Another example is the expression() functionality in CSS properties. Even though you may not be able to escape a quoted CSS property to inject up, you may be able to introduce something like xss:expression(document.write(document.cookie)) without ever leaving the current context.&lt;br /&gt;
&lt;br /&gt;
There's also the possibility of injecting directly in the current context. For example, if you take untrusted input and put it directly into a JavaScript context. While insane, accepting code from an attacker is more common than you might think in modern applications. Generally it is impossible to secure untrusted code with escaping (or anything else). If you do this, your application is just a conduit for attacker code to get running in your users' browsers.&lt;br /&gt;
&lt;br /&gt;
The rules in this document have been designed to prevent both UP and DOWN varieties of XSS injection. To prevent injecting up, you must escape the characters that would allow you to close the current context and start a new one. To prevent attacks that jump up several levels in the DOM hierarchy, you must also escape all the characters that are significant in all enclosing contexts.  To prevent injecting down, you must escape any characters that can be used to introduce a new sub-context within the current context.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A Positive XSS Prevention Model ==&lt;br /&gt;
&lt;br /&gt;
This article treats an HTML page like a template, with slots where a developer is allowed to put untrusted data. These slots cover the vast majority of the common places where a developer might want to put untrusted data. Putting untrusted data in other places in the HTML is not allowed. This is a &amp;quot;whitelist&amp;quot; model, that denies everything that is not specifically allowed.&lt;br /&gt;
&lt;br /&gt;
Given the way browsers parse HTML, each of the different types of slots has slightly different security rules. When you put untrusted data into these slots, you need to take certain steps to make sure that the data does not break out of that slot into a context that allows code execution. In a way, this approach treats an HTML document like a parameterized database query - the data is kept in specific places and is isolated from code contexts with escaping.&lt;br /&gt;
&lt;br /&gt;
This document sets out the most common types of slots and the rules for putting untrusted data into them safely. Based on the various specifications, known XSS vectors, and a great deal of manual testing with all the popular browsers, we have determined that the rule proposed here are safe.&lt;br /&gt;
&lt;br /&gt;
The slots are defined and a few examples of each are provided. Developers SHOULD NOT put data into any other slots without a very careful analysis to ensure that what they are doing is safe. Browser parsing is extremely tricky and many innocuous looking characters can be significant in the right context.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why Can't I Just HTML Entity Encode Untrusted Data? ==&lt;br /&gt;
&lt;br /&gt;
HTML entity encoding is okay for untrusted data that you put in the body of the HTML document, such as inside a &amp;amp;lt;div&amp;gt; tag.  It even sort of works for untrusted data that goes into attributes, particularly if you're religious about using quotes around your attributes.  But HTML entity encoding doesn't work if you're putting untrusted data inside a &amp;amp;lt;script&amp;gt; tag anywhere, or an event handler attribute like onmouseover, or inside CSS, or in a URL.  So even if you use an HTML entity encoding method everywhere, you are still most likely vulnerable to XSS.  '''You MUST use the escape syntax for the part of the HTML document you're putting untrusted data into.'''  That's what the rules below are all about.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== You Need a Security Encoding Library ==&lt;br /&gt;
&lt;br /&gt;
Writing these encoders is not tremendously difficult, but there are quite a few hidden pitfalls. For example, you might be tempted to use some of the escaping shortcuts like \&amp;quot; in JavaScript. However, these values are dangerous and may be misinterpreted by the nested parsers in the browser. You might also forget to escape the escape character, which attackers can use to neutralize your attempts to be safe. OWASP recommends using a security-focused encoding library to make sure these rules are properly implemented.&lt;br /&gt;
&lt;br /&gt;
The OWASP [[ESAPI]] project has created an escaping library in a variety of languages including Java, .NET, PHP, Classic ASP, Cold Fusion, Python, and Haskell. The ESAPI library can be used for escaping as described here and also for decoding (aka canonicalization), which is critical for input validation.  Microsoft provides an encoding library named [http://www.codeplex.com/AntiXSS AntiXSS].&lt;br /&gt;
&lt;br /&gt;
= XSS Prevention Rules = &lt;br /&gt;
&lt;br /&gt;
The following rules are intended to prevent all XSS in your application. While these rules do not allow absolute freedom in putting untrusted data into an HTML document, they should cover the vast majority of common use cases. You do not have to allow '''all''' the rules in your organization. Many organizations may find that '''allowing only Rule #1 and Rule #2 are sufficient for their needs'''. Please add a note to the discussion page if there is an additional context that is often required and can be secured with escaping.&lt;br /&gt;
&lt;br /&gt;
Do NOT simply escape the list of example characters provided in the various rules. It is NOT sufficient to escape only that list. Blacklist approaches are quite fragile.  The whitelist rules here have been carefully designed to provide protection even against future vulnerabilities introduced by browser changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== RULE #0 - Never Insert Untrusted Data Except in Allowed Locations ==&lt;br /&gt;
&lt;br /&gt;
The first rule is to '''deny all''' - don't put untrusted data into your HTML document unless it is within one of the slots defined in Rule #1 through Rule #5. The reason for Rule #0 is that there are so many strange contexts within HTML that the list of escaping rules gets very complicated. We can't think of any good reason to put untrusted data in these contexts.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;script&amp;gt;'''...NEVER PUT UNTRUSTED DATA HERE...'''&amp;lt;/script&amp;gt;   directly in a script&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;!--'''...NEVER PUT UNTRUSTED DATA HERE...'''--&amp;gt;             inside an HTML comment&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;div '''...NEVER PUT UNTRUSTED DATA HERE...'''=test /&amp;gt;       in an attribute name&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;'''NEVER PUT UNTRUSTED DATA HERE...''' href=&amp;quot;/test&amp;quot; /&amp;gt;   in a tag name&lt;br /&gt;
&lt;br /&gt;
Most importantly, never accept actual JavaScript code from an untrusted source and then run it. For example, a parameter named &amp;quot;callback&amp;quot; that contains a JavaScript code snippet.  No amount of escaping can fix that.&lt;br /&gt;
&lt;br /&gt;
== RULE #1 - HTML Escape Before Inserting Untrusted Data into HTML Element Content ==&lt;br /&gt;
&lt;br /&gt;
Rule #1 is for when you want to put untrusted data directly into the HTML body somewhere. This includes inside normal tags like div, p, b, td, etc. Most web frameworks have a method for HTML escaping for the characters detailed below. However, this is '''absolutely not sufficient for other HTML contexts.'''  You need to implement the other rules detailed here as well.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;body&amp;gt;'''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;lt;/body&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;div&amp;gt;'''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  any other normal HTML elements&lt;br /&gt;
&lt;br /&gt;
Escape the following characters with HTML entity encoding to prevent switching into any execution context, such as script, style, or event handlers. Using hex entities is recommended in the spec. In addition to the 5 characters significant in XML (&amp;amp;, &amp;lt;, &amp;gt;, &amp;quot;, '), the forward slash is included as it helps to end an HTML entity.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp; --&amp;gt; &amp;amp;amp;amp;&lt;br /&gt;
  &amp;lt; --&amp;gt; &amp;amp;amp;lt;&lt;br /&gt;
  &amp;gt; --&amp;gt; &amp;amp;amp;gt;&lt;br /&gt;
  &amp;quot; --&amp;gt; &amp;amp;amp;quot;&lt;br /&gt;
  ' --&amp;gt; &amp;amp;amp;#x27;     &amp;amp;apos; is not recommended&lt;br /&gt;
  / --&amp;gt; &amp;amp;amp;#x2F;     forward slash is included as it helps end an HTML entity&lt;br /&gt;
&lt;br /&gt;
See the [http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/HTMLEntityCodec.java ESAPI reference implementation] of HTML entity escaping and unescaping.&lt;br /&gt;
&lt;br /&gt;
  String safe = ESAPI.encoder().encodeForHTML( request.getParameter( &amp;quot;input&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== RULE #2 - Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes ==&lt;br /&gt;
&lt;br /&gt;
Rule #2 is for putting untrusted data into typical attribute values like width, name, value, etc. This should not be used for complex attributes like href, src, style, or any of the event handlers like onmouseover.  It is extremely important that event handler attributes should follow Rule #3 for HTML JavaScript Data Values.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;div attr='''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;gt;content&amp;lt;/div&amp;gt;     inside UNquoted attribute&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;div attr=''''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...''''&amp;gt;content&amp;lt;/div&amp;gt;   inside single quoted attribute&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;div attr=&amp;quot;'''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;quot;&amp;gt;content&amp;lt;/div&amp;gt;   inside double quoted attribute&lt;br /&gt;
&lt;br /&gt;
Except for alphanumeric characters, escape all characters with ASCII values less than 256 with the &amp;amp;amp;#xHH; format (or a named entity if available) to prevent switching out of the attribute. The reason this rule is so broad is that developers frequently leave attributes unquoted.  Properly quoted attributes can only be escaped with the corresponding quote. Unquoted attributes can be broken out of with many characters, including [space] % * + , - / ; &amp;lt; = &amp;gt; ^ and |.&lt;br /&gt;
&lt;br /&gt;
See the [http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/HTMLEntityCodec.java ESAPI reference implementation] of HTML entity escaping and unescaping.&lt;br /&gt;
&lt;br /&gt;
  String safe = ESAPI.encoder().encodeForHTMLAttribute( request.getParameter( &amp;quot;input&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== RULE #3 - JavaScript Escape Before Inserting Untrusted Data into HTML JavaScript Data Values ==&lt;br /&gt;
&lt;br /&gt;
Rule #3 concerns the JavaScript event handlers that are specified on various HTML elements. The only safe place to put untrusted data into these event handlers as a quoted &amp;quot;data value.&amp;quot;  Including untrusted data inside any other code block is quite dangerous, as it is very easy to switch into an execution context, so use with caution.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;script&amp;gt;alert(''''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''')&amp;amp;lt;/script&amp;gt;     inside a quoted string&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;script&amp;gt;x=''''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...''''&amp;amp;lt;/script&amp;gt;          one side of a quoted expression&lt;br /&gt;
  &lt;br /&gt;
  &amp;amp;lt;div onmouseover=&amp;quot;x=''''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...''''&amp;quot;&amp;amp;lt;/div&amp;gt;  inside quoted event handler&lt;br /&gt;
&lt;br /&gt;
Please note there are some JavaScript functions that can never safely use untrusted data as input - &amp;lt;b&amp;gt;EVEN IF JAVASCRIPT ESCAPED&amp;lt;/b&amp;gt;! &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  &amp;amp;lt;script&amp;gt;&lt;br /&gt;
  window.setInterval(''''...EVEN IF YOU ESCAPE UNTRUSTED DATA YOU ARE XSSED HERE...'''');&lt;br /&gt;
  &amp;amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Except for alphanumeric characters, escape all characters less than 256 with the \xHH format to prevent switching out of the data value into the script context or into another attribute. Do not use any escaping shortcuts like \&amp;quot; because the quote character may be matched by the HTML attribute parser which runs first.  If an event handler is quoted, breaking out requires the corresponding quote. The reason this rule is so broad is that developers frequently leave event handler attributes unquoted.  Properly quoted attributes can only be escaped with the corresponding quote. Unquoted attributes can be broken out of with many characters including [space] % * + , - / ; &amp;lt; = &amp;gt; ^ and |. Also, a &amp;lt;/script&amp;gt; closing tag will close a script block even though it is inside a quoted string because the HTML parser runs before the JavaScript parser.&lt;br /&gt;
&lt;br /&gt;
See the [http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/JavaScriptCodec.java ESAPI reference implementation] of JavaScript escaping and unescaping.&lt;br /&gt;
&lt;br /&gt;
  String safe = ESAPI.encoder().encodeForJavaScript( request.getParameter( &amp;quot;input&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
== RULE #4 - CSS Escape Before Inserting Untrusted Data into HTML Style Property Values ==&lt;br /&gt;
&lt;br /&gt;
Rule #4 is for when you want to put untrusted data into a stylesheet or a style tag. CSS is surprisingly powerful, and can be used for numerous attacks. Therefore, it's important that you only use untrusted data in a property '''value''' and not into other places in style data. You should stay away from putting untrusted data into complex properties like url, behavior, and custom (-moz-binding). You should also not put untrusted data into IE’s expression property value which allows JavaScript.&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;style&amp;gt;selector { property : '''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''; } &amp;amp;lt;/style&amp;gt;     property value&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;amp;lt;style&amp;gt;selector { property : &amp;amp;quot;'''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;amp;quot;; } &amp;amp;lt;/style&amp;gt;   property value&amp;lt;br/&amp;gt;&lt;br /&gt;
  &amp;amp;lt;span style=&amp;amp;quot;property : '''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'''&amp;amp;quot;&amp;gt;text&amp;amp;lt;/style&amp;gt;       property value&lt;br /&gt;
&lt;br /&gt;
Except for alphanumeric characters, escape all characters with ASCII values less than 256 with the \HH escaping format. Do not use any escaping shortcuts like \&amp;quot; because the quote character may be matched by the HTML attribute parser which runs first. Prevent switching out of the property value and into another property or attribute. Also prevent switching into an expression or other property value that allows scripting. If attribute is quoted, breaking out requires the corresponding quote.  All attributes should be quoted but your encoding should be strong enough to prevent XSS when untrusted data is placed in unquoted contexts. Unquoted attributes can be broken out of with many characters including [space] % * + , - / ; &amp;lt; = &amp;gt; ^ and |.  Also, the &amp;lt;/style&amp;gt; tag will close the style block even though it is inside a quoted string because the HTML parser runs before the JavaScript parser. Please note that we recommend aggressive CSS encoding to prevent XSS attacks for both quoted and unquoted attributes.&lt;br /&gt;
&lt;br /&gt;
See the [http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/CSSCodec.java ESAPI reference implementation] of CSS escaping and unescaping.&lt;br /&gt;
&lt;br /&gt;
  String safe = ESAPI.encoder().encodeForCSS( request.getParameter( &amp;quot;input&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
== RULE #5 - URL Escape Before Inserting Untrusted Data into HTML URL Parameter Values ==&lt;br /&gt;
&lt;br /&gt;
Rule #5 is for when you want to put untrusted data into HTTP GET parameter value. &lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;a href=&amp;quot;http&amp;amp;#x3a;&amp;amp;#x2f;&amp;amp;#x2f;www.somesite.com&amp;amp;#x3f;test&amp;amp;#x3d;'''...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...&amp;quot;'''&amp;gt;link&amp;amp;lt;/a &amp;gt;       &lt;br /&gt;
&lt;br /&gt;
Except for alphanumeric characters, escape all characters with ASCII values less than 256 with the %HH escaping format.  Including untrusted data in data: URLs should not be allowed as there is no good way to disable attacks with escaping to prevent switching out of the URL. All attributes should be quoted. Unquoted attributes can be broken out of with many characters including [space] % * + , - / ; &amp;lt; = &amp;gt; ^ and |. Note that entity encoding is useless in this context.&lt;br /&gt;
&lt;br /&gt;
See the [http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/PercentCodec.java ESAPI reference implementation] of URL escaping and unescaping.&lt;br /&gt;
&lt;br /&gt;
  String safe = ESAPI.encoder().encodeForURL( request.getParameter( &amp;quot;input&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
WARNING: Do not encode complete or relative URL's with URL encoding! If untrusted input is meant to be placed into href, src or other URL-based attributes, it should be validated to make sure it does not point to an unexpected protocol, especially Javascript links. URL's should then be encoded based on the context of display like any other piece of data. For example, user driven URL's in HREF links should be attribute encoded. For example:&lt;br /&gt;
&lt;br /&gt;
  String userURL = request.getParameter( &amp;quot;userURL&amp;quot; )&lt;br /&gt;
  boolean isValidURL = ESAPI.validator().isValidInput(&amp;quot;URLContext&amp;quot;, userURL, &amp;quot;URL&amp;quot;, 255, false); &lt;br /&gt;
  if (isValidURL) {  &lt;br /&gt;
      &amp;lt;a href=&amp;quot;&amp;lt;%=encoder.encodeForHTMLAttribute(userURL)%&amp;gt;&amp;quot;&amp;gt;link&amp;lt;/a&amp;gt;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
== RULE #6 - Use an HTML Policy engine to validate or clean user-driven HTML in an outbound way ==&lt;br /&gt;
&lt;br /&gt;
   import org.owasp.validator.html.*;&lt;br /&gt;
   Policy policy = Policy.getInstance(POLICY_FILE_LOCATION);&lt;br /&gt;
   AntiSamy as = new AntiSamy();&lt;br /&gt;
   CleanResults cr = as.scan(dirtyInput, policy);&lt;br /&gt;
   MyUserDAO.storeUserProfile(cr.getCleanHTML()); // some custom function&lt;br /&gt;
&lt;br /&gt;
== RULE #7 - Prevent DOM-based XSS  ==&lt;br /&gt;
&lt;br /&gt;
For details on what DOM-based XSS is, and defenses against this type of XSS flaw, please see the OWASP article on [[DOM_Based_XSS | DOM-based XSS]].&lt;br /&gt;
&lt;br /&gt;
= Encoding Information =&lt;br /&gt;
[http://code.google.com/p/owasp-development-guide/wiki/WebAppSecDesignGuide_D6 OWASP Development Guide]&lt;br /&gt;
&lt;br /&gt;
= Additional XSS Defense (HTTPOnly cookie flag)=&lt;br /&gt;
&lt;br /&gt;
Preventing all XSS flaws in an application is hard, as you can see. To help mitigate the impact of an XSS flaw on your site, OWASP also recommends you set the HTTPOnly flag on your session cookie and any custom cookies you have that are not accessed by any Javascript you wrote. This cookie flag is typically on by default in .NET apps, but in other languages you have to set it manually.&lt;br /&gt;
&lt;br /&gt;
For more details on the HTTPOnly cookie flag, including what it does, and how to use it, see the OWASP article on [[HTTPOnly]].&lt;br /&gt;
&lt;br /&gt;
=Related Articles=&lt;br /&gt;
&lt;br /&gt;
'''XSS Attack Cheat Sheet'''&lt;br /&gt;
&lt;br /&gt;
The following article describes how to exploit different kinds of XSS Vulnerabilities that this article was created to help you avoid:&lt;br /&gt;
&lt;br /&gt;
* RSnake: &amp;quot;XSS Cheat Sheet&amp;quot; - http://ha.ckers.org/xss.html&lt;br /&gt;
&lt;br /&gt;
'''Description of XSS Vulnerabilities'''&lt;br /&gt;
&lt;br /&gt;
* OWASP article on [[XSS]] Vulnerabilities&lt;br /&gt;
&lt;br /&gt;
'''How to Review Code for Cross-site scripting Vulnerabilities'''&lt;br /&gt;
&lt;br /&gt;
* [[:Category:OWASP Code Review Project|OWASP Code Review Guide]] article on [[Reviewing Code for Cross-site scripting]] Vulnerabilities&lt;br /&gt;
&lt;br /&gt;
'''How to Test for Cross-site scripting  Vulnerabilities'''&lt;br /&gt;
&lt;br /&gt;
* [[:Category:OWASP Testing Project|OWASP Testing Guide]] article on [[Testing for Cross site scripting]] Vulnerabilities&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation}}&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Jeff Williams - jeff.williams[at]aspectsecurity.com&lt;br /&gt;
&lt;br /&gt;
Jim Manico - jim[at]manico.net &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Application Security Verification Standard Project]]&lt;br /&gt;
[[Category:OWASP Enterprise Security API]]&lt;br /&gt;
[[Category:How To]]&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Testing_for_Stack_Overflow&amp;diff=91772</id>
		<title>Testing for Stack Overflow</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Testing_for_Stack_Overflow&amp;diff=91772"/>
				<updated>2010-10-21T19:01:53Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: spelling only&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:OWASP Testing Guide v3}}&lt;br /&gt;
&lt;br /&gt;
== Brief Summary ==&lt;br /&gt;
This section discusses an overflow test that focuses on how to manipulate the program stack.&lt;br /&gt;
&lt;br /&gt;
== Description of the Issue == &lt;br /&gt;
[[Stack overflow|Stack overflows]] occur when variable size data is copied into fixed length buffers located on the program stack without any bounds checking.   &lt;br /&gt;
Vulnerabilities of this class are generally considered to be of high severity since their exploitation would mostly permit arbitrary code execution or Denial of Service. Rarely found in interpreted platforms, code written in C and similar languages is often ridden with instances of this vulnerability. An extract from the buffer overflow section of OWASP Development Guide 2.0 states that:&lt;br /&gt;
&lt;br /&gt;
'' Almost every platform, with the following notable exceptions:''&lt;br /&gt;
*'' J2EE – as long as native methods or system calls are not invoked''&lt;br /&gt;
*'' .NET – as long as /unsafe or unmanaged code is not invoked (such as the use of P/Invoke or COM Interop)''&lt;br /&gt;
*'' PHP – as long as external programs and vulnerable PHP extensions written in C or C++ are not called ''&lt;br /&gt;
''can suffer from stack overflow issues. ''&lt;br /&gt;
&lt;br /&gt;
Stack overflow vulnerabilities often allow an attacker to directly take control of the instruction pointer and, therefore, alter the execution of the program and execute arbitrary code. Besides  overwriting the instruction pointer, similar results can also be obtained by overwriting other variables and structures, like Exception Handlers, which are located on the stack.&lt;br /&gt;
&lt;br /&gt;
== Black Box testing and example ==&lt;br /&gt;
The key to testing an application for stack overflow vulnerabilities is supplying overly large input data as compared to what is expected. &lt;br /&gt;
However, subjecting the application to arbitrarily large data is not sufficient. It becomes necessary to inspect the application’s execution flow and responses to ascertain whether an overflow has actually been triggered or not. Therefore, the steps required to locate and validate stack overflows would be to attach a debugger to the target application or process, generate malformed input for the application, subject the application to malformed input, and inspect responses in a debugger. The debugger allows the tester to view the execution flow and the state of the registers when the vulnerability gets triggered.&lt;br /&gt;
&lt;br /&gt;
On the other hand, a more passive form of testing can be employed, which involves inspecting assembly code of the application by using disassemblers. In this case, various sections are scanned for signatures of vulnerable assembly fragments. This is often termed as reverse engineering and is a tedious process.&lt;br /&gt;
&lt;br /&gt;
As a simple example, consider the following technique employed while testing an executable “sample.exe” for stack overflows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  char buff[20];&lt;br /&gt;
  printf(&amp;quot;copying into buffer&amp;quot;);   &lt;br /&gt;
  strcpy(buff,argv[1]);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File sample.exe is launched in a debugger, in our case OllyDbg.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:stack overflow vulnerability.gif]]&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Since the application is expecting command line arguments, a large sequence of characters such as ‘A’, can be supplied in the argument field shown above.&lt;br /&gt;
&lt;br /&gt;
On opening the executable with the supplied arguments and continuing execution the following results are obtained.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:stack overflow vulnerability 2.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown in the registers window of the debugger, the EIP or Extended Instruction Pointer, which points to the next instruction to be executed, contains the value ‘41414141’. ‘41’ is a hexadecimal representation for the character ‘A’ and therefore the string ‘AAAA’ translates to 41414141.&lt;br /&gt;
&lt;br /&gt;
This clearly demonstrates how input data can be used to overwrite the instruction pointer with user-supplied values and control program execution. A stack overflow can also allow overwriting of stack-based structures like SEH (Structured Exception Handler) to control code execution and bypass certain stack protection mechanisms.&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, other methods of testing such vulnerabilities include reverse engineering the application binaries, which is a complex and tedious process, and using fuzzing techniques.&lt;br /&gt;
&lt;br /&gt;
== Gray Box testing and example == &lt;br /&gt;
&lt;br /&gt;
When reviewing code for stack overflows, it is advisable to search for calls to insecure library functions like gets(), strcpy(), strcat() etc which do not validate the length of source strings and blindly copy data into fixed size buffers.&lt;br /&gt;
&lt;br /&gt;
For example consider the following function:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void log_create(int severity, char *inpt) {&lt;br /&gt;
&lt;br /&gt;
char b[1024];&lt;br /&gt;
&lt;br /&gt;
if (severity == 1)&lt;br /&gt;
{&lt;br /&gt;
strcat(b,”Error occurred on”);&lt;br /&gt;
strcat(b,&amp;quot;:&amp;quot;);&lt;br /&gt;
strcat(b,inpt); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FILE *fd = fopen (&amp;quot;logfile.log&amp;quot;, &amp;quot;a&amp;quot;);&lt;br /&gt;
fprintf(fd, &amp;quot;%s&amp;quot;, b);&lt;br /&gt;
fclose(fd);&lt;br /&gt;
&lt;br /&gt;
. . . . . .&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From above, the line strcat(b,inpt) will result in a stack overflow if inpt exceeds 1024 bytes. Not only does this demonstrate an insecure usage of strcat, it also shows how important it is to examine the length of strings referenced by a character pointer that is passed as an argument to a function; In this case the length of string referenced by char *inpt. Therefore it is always a good idea to trace back the source of function arguments and ascertain string lengths while reviewing code. &lt;br /&gt;
&lt;br /&gt;
Usage of the relatively safer strncpy() can also lead to stack overflows since it only restricts the number of bytes copied into the destination buffer. If the size argument that is used to accomplish this is generated dynamically based on user input or calculated inaccurately within loops, it is possible to overflow stack buffers.  For example:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void func(char *source)&lt;br /&gt;
{&lt;br /&gt;
Char dest[40];&lt;br /&gt;
…&lt;br /&gt;
size=strlen(source)+1&lt;br /&gt;
….&lt;br /&gt;
strncpy(dest,source,size) &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where source is user controllable data. A good example would be the samba trans2open stack overflow vulnerability (http://www.securityfocus.com/archive/1/317615). &lt;br /&gt;
&lt;br /&gt;
Vulnerabilities can also appear in URL and address parsing code. In such cases, a function like memccpy() is usually employed which copies data into a destination buffer from source until a specified character is not encountered. Consider the function: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void func(char *path)&lt;br /&gt;
{&lt;br /&gt;
char servaddr[40];&lt;br /&gt;
…&lt;br /&gt;
memccpy(servaddr,path,'\');&lt;br /&gt;
….&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case the information contained in path could be greater than 40 bytes before ‘\’ can be encountered. If so it will cause a stack overflow. A similar vulnerability was located in Windows RPCSS subsystem (MS03-026). The vulnerable code copied server names from UNC paths into a fixed size buffer until a ‘\’ was encountered. The length of the server name in this case was controllable by users.&lt;br /&gt;
&lt;br /&gt;
Apart from manually reviewing code for stack overflows, static code analysis tools can also be of great assistance. Although they tend to generate a lot of false positives and would barely be able to locate a small portion of defects, they certainly help in reducing the overhead associated with finding low hanging fruits, like strcpy() and sprintf() bugs. A variety of tools like RATS, Flawfinder and ITS4 are available for analyzing C-style languages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
'''Whitepapers'''&amp;lt;br&amp;gt;&lt;br /&gt;
* Defeating Stack Based Buffer Overflow Prevention Mechanism of Windows 2003 Server - http://www.ngssoftware.com/papers/defeating-w2k3-stack-protection.pdf&lt;br /&gt;
* Aleph One: &amp;quot;Smashing the Stack for Fun and Profit&amp;quot; - http://www.phrack.org/issues.html?issue=49&amp;amp;id=14#article&lt;br /&gt;
* Tal Zeltzer: &amp;quot;Basic stack overflow exploitation on Win32&amp;quot; - http://www.securityforest.com/wiki/index.php/Exploit:_Stack_Overflows_-_Basic_stack_overflow_exploiting_on_win32&lt;br /&gt;
* Tal Zeltzer&amp;quot;Exploiting Default SEH to increase Exploit Stability&amp;quot; - &lt;br /&gt;
http://www.securityforest.com/wiki/index.php/Exploit:_Stack_Overflows_-_Exploiting_default_seh_to_increase_stability&lt;br /&gt;
* The Samba trans2open stack overflow vulnerability - http://www.securityfocus.com/archive/1/317615&lt;br /&gt;
* Windows RPC DCOM vulnerability details - http://www.xfocus.org/documents/200307/2.html&lt;br /&gt;
&lt;br /&gt;
'''Tools'''&amp;lt;br&amp;gt;&lt;br /&gt;
* OllyDbg: &amp;quot;A windows based debugger used for analyzing buffer overflow vulnerabilities&amp;quot; - http://www.ollydbg.de&lt;br /&gt;
* Spike, A fuzzer framework that can be used to explore vulnerabilities and perform length testing - http://www.immunitysec.com/downloads/SPIKE2.9.tgz&lt;br /&gt;
* Brute Force Binary Tester (BFB), A proactive binary checker - http://bfbtester.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
[[Category:FIXME|link not working&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Metasploit, A rapid exploit development and Testing frame work - http://www.metasploit.com/projects/Framework/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Using_the_Java_Secure_Socket_Extensions&amp;diff=91771</id>
		<title>Using the Java Secure Socket Extensions</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Using_the_Java_Secure_Socket_Extensions&amp;diff=91771"/>
				<updated>2010-10-21T19:00:32Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: spelling only&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Status==&lt;br /&gt;
Requires review&lt;br /&gt;
&lt;br /&gt;
''The code included in this article has not been reviewed and should not be used without proper analysis. If you have reviewed the included code (or portions of it), please post your findings back to this page or to: stephen [at] corsaire.com.''&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
===What is SSL ?=== &lt;br /&gt;
SSL - Secure Socket Layer is an Application layer cryptographic protocol developed by Netscape for securing communication over the Internet.&lt;br /&gt;
The security services provided by SSL are&lt;br /&gt;
# Confidentiality through Encryption of data using Symmetric Key Encryption Algorithms&lt;br /&gt;
# Non - Repudiation of Origin / Origin Integrity through Digital Signatures using Asymmetric key Encryption Algorithms or Public Key Cryptographic Algorithms&lt;br /&gt;
# Data Integrity through Hashing using Message Digest or Hashing Algorithms&lt;br /&gt;
&lt;br /&gt;
===What is JSSE ?===&lt;br /&gt;
JSSE is the acronym of Jave Secure Socket Extensions. As the name implies it is a set of Java API's which provides SSL / TLS functionality. &lt;br /&gt;
JSSE follows a Provider Architecture wherein the functionality specified in the Service Provider Interface can be implemented by any Service Provider. JSSE comes bundled with a default service provider named SunJSSE. JSSE was an optional package on jdk ##x and ##x. Since jdk ##x, JSSE comes pre-configured with the standard jdk package&lt;br /&gt;
&lt;br /&gt;
===The JSSE  Implementation of SSL===&lt;br /&gt;
JSSE provides an implementation for creating SSLSocket (used by clients) and SSLServerSocket (used by server).&lt;br /&gt;
====Algorithm for creating SSL Client socket====&lt;br /&gt;
# Determine the SSL Server Name and port in which the SSL server is listening&lt;br /&gt;
# Register the JSSE provider&lt;br /&gt;
# Create an instance of SSLSocketFactory&lt;br /&gt;
# Create an instance of SSLSocket&lt;br /&gt;
# Create an OutputStream object to write to the SSL Server&lt;br /&gt;
# Create an InputStream object to receive messages back from the SSL Server&lt;br /&gt;
&lt;br /&gt;
====Algorithm for creating SSL Server socket====&lt;br /&gt;
# Register the JSSE provider&lt;br /&gt;
# Set System property for keystore by specifying the keystore which contains the server certificate&lt;br /&gt;
# Set System property for the password of the keystore which contains the server certificate&lt;br /&gt;
# Create an instance of SSLServerSocketFactory&lt;br /&gt;
# Create an instance of SSLServerSocket by specifying the port to which the SSL Server socket needs to bind with&lt;br /&gt;
# Initialize an object of SSLSocket&lt;br /&gt;
# Create InputStream object to read data sent by clients&lt;br /&gt;
# Create an OutputStream object to write data back to clients.&lt;br /&gt;
&lt;br /&gt;
===SSL Handshake Protocol===&lt;br /&gt;
The SSL handshake protocol happens between the client and the server and comprises of 4 rounds that enable peers to agree on keys, ciphers and MAC algorithms. The handshake is explained below with the parameters captured in the debug mode during the execution of SSLClient and SSLServer java files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Round 1 : Create the SSL connection between the Client and the Server====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	C -&amp;gt; S {ver || randomcookie1 || sessionid || Cipher Suites || Compression Methods }&lt;br /&gt;
*** ClientHello, TLSv1&lt;br /&gt;
RandomCookie:  GMT: 1165141617 bytes = { 250, 20, 142, 231, 143, 78, 72, 52, 254, 46, 199, 39, 146, 23, 238, 5, 108, 171, 75, 192, 78, 173, 26, 151, 89, 86, 58, 197 }&lt;br /&gt;
Session ID:  {}&lt;br /&gt;
Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]&lt;br /&gt;
Compression Methods:  { 0 }&lt;br /&gt;
	S -&amp;gt; C {ver || randomcookie2 || session_id || cipher || compression }&lt;br /&gt;
*** ServerHello, TLSv1&lt;br /&gt;
RandomCookie:  GMT: 1165141617 bytes = { 33, 91, 78, 189, 156, 183, 142, 253, 119, 155, 22, 193, 46, 0, 50, 153, 168, 170, 19, 220, 68, 97, 98, 3, 36, 228, 103, 117 }&lt;br /&gt;
Session ID:  {69, 115, 166, 113, 102, 3, 65, 68, 227, 239, 225, 34, 115, 49, 73, 69, 174, 111, 222, 219, 119, 162, 5, 11, 77, 149, 181, 24, 38, 98, 5, 204}&lt;br /&gt;
Cipher Suite: SSL_RSA_WITH_RC4_128_MD5&lt;br /&gt;
Compression Method: 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Round 2 : Server authenticates itself====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	S -&amp;gt; C {server_cert}&lt;br /&gt;
***&lt;br /&gt;
%% Created:  [Session-1, SSL_RSA_WITH_RC4_128_MD5]&lt;br /&gt;
** SSL_RSA_WITH_RC4_128_MD5&lt;br /&gt;
[read] MD5 and SHA1 hashes:  len = 74&lt;br /&gt;
0000: 02 00 00 46 03 01 45 73   A6 71 21 5B 4E BD 9C B7  ...F..Es.q![N...&lt;br /&gt;
0010: 8E FD 77 9B 16 C1 2E 00   32 99 A8 AA 13 DC 44 61  ..w.....#....Da&lt;br /&gt;
0020: 62 03 24 E4 67 75 20 45   73 A6 71 66 03 41 44 E3  b.$.gu Es.qf.AD.&lt;br /&gt;
0030: EF E1 22 73 31 49 45 AE   6F DE DB 77 A2 05 0B 4D  ..&amp;quot;s1IE.o..w...M&lt;br /&gt;
0040: 95 B5 18 26 62 05 CC 00   04 00                    ...&amp;amp;b.....&lt;br /&gt;
&lt;br /&gt;
	S -&amp;gt; C {public key modulus || exponent || {hash (randomcookie1 || randomcookie2 || public key modulus || exponent )} signed by Server}&lt;br /&gt;
*** Certificate chain&lt;br /&gt;
chain [0] = [&lt;br /&gt;
[&lt;br /&gt;
  Version: V1&lt;br /&gt;
  Subject: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
  Signature Algorithm: MD5withRSA, OID = ######4&lt;br /&gt;
&lt;br /&gt;
  Key:  Sun RSA public key, 1024 bits&lt;br /&gt;
  modulus: 125799608853960565468693082080524019040787802862173204033354805928537584240351554241990082493719007271501637788649255493925650447292814949263542483518710211756489915623917992726468465059340034326131973495929283930754477403752766287367308326998219377123365800989254595407827915805528431637337980240073881550879&lt;br /&gt;
  public exponent: 65537&lt;br /&gt;
  Validity: [From: Sun Nov 26 06:33:42 EST 2006,&lt;br /&gt;
               To: Wed Apr 12 07:33:42 EDT 2034]&lt;br /&gt;
  Issuer: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
  SerialNumber: [    45697b96]&lt;br /&gt;
&lt;br /&gt;
]&lt;br /&gt;
  Algorithm: [MD5withRSA]&lt;br /&gt;
  Signature:&lt;br /&gt;
0000: 1A 35 AD 99 24 0A 8C 09   58 0C FC B4 B3 F8 3F DC  .#.$...X.....?.&lt;br /&gt;
0010: 44 BF 56 A2 3A 5D E5 DF   0D CF D2 59 51 F2 6E 1C  D.V.:].....YQ.n.&lt;br /&gt;
0020: 2A C0 03 9B 7C 3F 8B 53   C8 E9 16 A7 BC 28 23 C1  *....?.S.....(#.&lt;br /&gt;
0030: 67 F3 E4 05 D9 55 13 65   2E E3 80 BA A3 0A 9C F6  g....U.e........&lt;br /&gt;
0040: A1 50 46 90 D7 E0 8F 50   6C E4 00 5D 3F F8 D0 62  .PF....Pl..]?..b&lt;br /&gt;
0050: D2 A9 47 DF 65 3B 02 E8   1C 04 8A 3C 7B 19 B3 EB  ..G.e;.....&amp;lt;....&lt;br /&gt;
0060: B6 50 23 6E C6 8A 49 95   6E 38 70 D2 2B 40 31 A5  .P#n..I.n8p.+@#&lt;br /&gt;
0070: FE 3F 44 EF 3A E4 12 69   46 D1 4F A0 83 40 F7 F3  .?D.:..iF.O..@..&lt;br /&gt;
]&lt;br /&gt;
***&lt;br /&gt;
	S -&amp;gt; C { cert_type || good_cert_authorities}&lt;br /&gt;
	S -&amp;gt; C {end_round_2}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Round 3 : Client validates the Server certificate====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	C -&amp;gt; S {client_cert}&lt;br /&gt;
	C -&amp;gt; S {pre master secret} &lt;br /&gt;
*** ClientKeyExchange, RSA PreMasterSecret, TLSv1&lt;br /&gt;
Random Secret:  { 3, 1, 161, 37, 5, 17, 154, 202, 73, 33, 75, 50, 61, 242, 44, 252, 232, 80, 161, 185, 2, 61, 154, 54, 177, 192, 141, 235, 95, 174, 219, 216, 251, 150, 189, 99, 188, 180, 15, 253, 28, 168, 85, 124, 17, 124, 218, 101 }&lt;br /&gt;
	C -&amp;gt; S {hash(master secret || padding value || hash(messages || master secret || padding value))}&lt;br /&gt;
    where messages refers to concatenation messages exchanged from 1 through #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Round 4 : Acknowledgment between Client and the Server====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	The client updates the session and connection information to reflect the cipher it uses and then sends a “finished” message&lt;br /&gt;
SESSION KEYGEN:&lt;br /&gt;
PreMaster Secret:&lt;br /&gt;
0000: 03 01 A1 25 05 11 9A CA   49 21 4B 32 3D F2 2C FC  ...%....I!K2=.,.&lt;br /&gt;
0010: E8 50 A1 B9 02 3D 9A 36   B1 C0 8D EB 5F AE DB D8  .P...=.#..._...&lt;br /&gt;
0020: FB 96 BD 63 BC B4 0F FD   1C A8 55 7C 11 7C DA 65  ...c......U....e&lt;br /&gt;
CONNECTION KEYGEN:&lt;br /&gt;
Client Nonce:&lt;br /&gt;
0000: 45 73 A6 71 FA 14 8E E7   8F 4E 48 34 FE 2E C7 27  Es.q.....NH#..'&lt;br /&gt;
0010: 92 17 EE 05 6C AB 4B C0   4E AD 1A 97 59 56 3A C5  ....l.K.N...YV:.&lt;br /&gt;
Server Nonce:&lt;br /&gt;
0000: 45 73 A6 71 21 5B 4E BD   9C B7 8E FD 77 9B 16 C1  Es.q![N.....w...&lt;br /&gt;
0010: 2E 00 32 99 A8 AA 13 DC   44 61 62 03 24 E4 67 75  ..#....Dab.$.gu&lt;br /&gt;
Master Secret:&lt;br /&gt;
0000: B5 AF 35 36 65 B8 2E A9   F0 5C C1 A7 BD 85 98 92  ..56e....\......&lt;br /&gt;
0010: 64 61 B6 B9 7D 86 AB C7   72 CA 67 9A E1 C1 C4 3F  da......r.g....?&lt;br /&gt;
0020: C5 8B 67 1A 49 C9 6E B2   FC AB 65 96 EA 7E 67 8C  ..g.I.n...e...g.&lt;br /&gt;
Client MAC write Secret:&lt;br /&gt;
0000: A4 C0 36 E3 9A D3 8B 67   AA 51 D6 78 59 BF 0A 5E  ..#...g.Q.xY..^&lt;br /&gt;
Server MAC write Secret:&lt;br /&gt;
0000: F7 D0 65 1D 4C 0E 81 0F   1F 76 86 D7 91 68 37 50  ..e.L....v...h7P&lt;br /&gt;
Client write key:&lt;br /&gt;
0000: A6 C5 F0 7D FE 1C 0E 58   85 00 A5 02 AE 08 B5 0E  .......X........&lt;br /&gt;
Server write key:&lt;br /&gt;
0000: 20 D3 07 A2 02 02 34 67   2C C3 5A 50 7C 0F 87 CB   .....4g,.ZP....&lt;br /&gt;
... no IV for cipher&lt;br /&gt;
[read] MD5 and SHA1 hashes:  len = 134&lt;br /&gt;
0000: 10 00 00 82 00 80 10 D4   F8 1C 1D 96 62 B2 59 DD  ............b.Y.&lt;br /&gt;
0010: D6 F8 F1 0F A5 5E 75 0F   4F 3D 5B 56 2C 6A 24 FD  .....^u.O=[V,j$.&lt;br /&gt;
0020: 4A 90 D4 3A F3 3F 7E 22   D2 00 18 3B 7D 3F CD 02  J..:.?.&amp;quot;...;.?..&lt;br /&gt;
0030: 0C E1 11 7C 12 59 D8 A3   85 8D CB 23 B7 90 1C 59  .....Y.....#...Y&lt;br /&gt;
0040: 94 65 5F 7E 8E 46 6D A9   7D FC 54 5D 81 DC 69 82  .e_..Fm...T]..i.&lt;br /&gt;
0050: 1A EE 1A A5 F1 52 66 A6   43 34 EE E0 F7 12 36 CF  .....Rf.C#...#&lt;br /&gt;
0060: 7A 38 48 5A C9 8E 11 CB   AE 7A 36 2D FD 0B CD 1A  z8HZ.....z6-....&lt;br /&gt;
0070: 0B F1 45 1E C6 71 D9 57   39 80 75 BF D6 68 43 15  ..E..q.W#u..hC.&lt;br /&gt;
0080: FE 4D 67 DC 2F BD                                  .Mg./.&lt;br /&gt;
[Raw read]: length = 5&lt;br /&gt;
0000: 14 03 01 00 01                                     .....&lt;br /&gt;
[Raw read]: length = 1&lt;br /&gt;
0000: 01                                                 .&lt;br /&gt;
main, READ: TLSv1 Change Cipher Spec, length = 1&lt;br /&gt;
[Raw read]: length = 5&lt;br /&gt;
0000: 16 03 01 00 20                                     ....&lt;br /&gt;
[Raw read]: length = 32&lt;br /&gt;
0000: C7 D8 CC 69 F7 F7 7F 00   29 F6 23 C8 DD 11 50 33  ...i....).#...P3&lt;br /&gt;
0010: 89 BB 91 21 BD 05 24 8C   5B 77 33 9D 78 0A B4 3C  ...!..$.[w#x..&amp;lt;&lt;br /&gt;
main, READ: TLSv1 Handshake, length = 32&lt;br /&gt;
Padded plaintext after DECRYPTION:  len = 32&lt;br /&gt;
0000: 14 00 00 0C 01 B0 24 0D   BC AD E7 E9 DC CB E4 17  ......$.........&lt;br /&gt;
0010: F9 FF 44 03 B2 00 37 12   9C A2 16 62 2E 9E 3C 33  ..D...#...b..&amp;lt;3&lt;br /&gt;
*** Finished&lt;br /&gt;
verify_data:  { 1, 176, 36, 13, 188, 173, 231, 233, 220, 203, 228, 23 }&lt;br /&gt;
&lt;br /&gt;
	Server responds back with a “change cipher spec” message and updates its session and connection information accordingly and sends a finish message.&lt;br /&gt;
SESSION KEYGEN:&lt;br /&gt;
PreMaster Secret:&lt;br /&gt;
0000: 03 01 A1 25 05 11 9A CA   49 21 4B 32 3D F2 2C FC  ...%....I!K2=.,.&lt;br /&gt;
0010: E8 50 A1 B9 02 3D 9A 36   B1 C0 8D EB 5F AE DB D8  .P...=.#..._...&lt;br /&gt;
0020: FB 96 BD 63 BC B4 0F FD   1C A8 55 7C 11 7C DA 65  ...c......U....e&lt;br /&gt;
CONNECTION KEYGEN:&lt;br /&gt;
Client Nonce:&lt;br /&gt;
0000: 45 73 A6 71 FA 14 8E E7   8F 4E 48 34 FE 2E C7 27  Es.q.....NH#..'&lt;br /&gt;
0010: 92 17 EE 05 6C AB 4B C0   4E AD 1A 97 59 56 3A C5  ....l.K.N...YV:.&lt;br /&gt;
Server Nonce:&lt;br /&gt;
0000: 45 73 A6 71 21 5B 4E BD   9C B7 8E FD 77 9B 16 C1  Es.q![N.....w...&lt;br /&gt;
0010: 2E 00 32 99 A8 AA 13 DC   44 61 62 03 24 E4 67 75  ..#....Dab.$.gu&lt;br /&gt;
Master Secret:&lt;br /&gt;
0000: B5 AF 35 36 65 B8 2E A9   F0 5C C1 A7 BD 85 98 92  ..56e....\......&lt;br /&gt;
0010: 64 61 B6 B9 7D 86 AB C7   72 CA 67 9A E1 C1 C4 3F  da......r.g....?&lt;br /&gt;
0020: C5 8B 67 1A 49 C9 6E B2   FC AB 65 96 EA 7E 67 8C  ..g.I.n...e...g.&lt;br /&gt;
Client MAC write Secret:&lt;br /&gt;
0000: A4 C0 36 E3 9A D3 8B 67   AA 51 D6 78 59 BF 0A 5E  ..#...g.Q.xY..^&lt;br /&gt;
Server MAC write Secret:&lt;br /&gt;
0000: F7 D0 65 1D 4C 0E 81 0F   1F 76 86 D7 91 68 37 50  ..e.L....v...h7P&lt;br /&gt;
Client write key:&lt;br /&gt;
0000: A6 C5 F0 7D FE 1C 0E 58   85 00 A5 02 AE 08 B5 0E  .......X........&lt;br /&gt;
Server write key:&lt;br /&gt;
0000: 20 D3 07 A2 02 02 34 67   2C C3 5A 50 7C 0F 87 CB   .....4g,.ZP....&lt;br /&gt;
... no IV for cipher&lt;br /&gt;
main, WRITE: TLSv1 Change Cipher Spec, length = 1&lt;br /&gt;
[Raw write]: length = 6&lt;br /&gt;
0000: 14 03 01 00 01 01                                  ......&lt;br /&gt;
*** Finished&lt;br /&gt;
verify_data:  { 1, 176, 36, 13, 188, 173, 231, 233, 220, 203, 228, 23 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once the handshake is complete, secure communication can commence.&lt;br /&gt;
&lt;br /&gt;
==The Need for Keytool==&lt;br /&gt;
The server needs to generate a certificate and a private key associated with its certificate. This certificate would be sent to the clients who wishes to communicate with the server. These functionalities of Key generation, Key management , certificate management are taken care by a tool provided by Sun known as keytool. Keytool uses keystores to store the public / private keys as well as certificates. &lt;br /&gt;
keystores are datastores implemented as files. Private keys are protected with passwords.&lt;br /&gt;
&lt;br /&gt;
===Algorithms supported by Keytool===&lt;br /&gt;
Keytool supports any algorithm implemented by the registered cryptographic service providers. Default key pair generation algorithm is DSA with a keysize of 1024 bits. The signature algorithm is derived from the algorithm of the private keys. DSA gets coupled with SHA1 by default and so &amp;quot;SHA1withDSA&amp;quot; would be used. RSA gets coupled with MD5 and so &amp;quot;MD5withRSA&amp;quot; would be used.&lt;br /&gt;
&lt;br /&gt;
===Some of the frequently used functions of keytool are:===&lt;br /&gt;
==== Generating keys using keytools====&lt;br /&gt;
Key pairs can be generated using keytool with the following command and options&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$bash # keytool -genkey -alias testkey -keystore testkeystore.ks&lt;br /&gt;
Enter keystore password:  testpwd&lt;br /&gt;
What is your first and last name?&lt;br /&gt;
  [Unknown]:  Tom&lt;br /&gt;
What is the name of your organizational unit?&lt;br /&gt;
  [Unknown]:  security&lt;br /&gt;
What is the name of your organization?&lt;br /&gt;
  [Unknown]:  ABC Inc&lt;br /&gt;
What is the name of your City or Locality?&lt;br /&gt;
  [Unknown]:  Fort Meade&lt;br /&gt;
What is the name of your State or Province?&lt;br /&gt;
  [Unknown]:  MA&lt;br /&gt;
What is the two-letter country code for this unit?&lt;br /&gt;
  [Unknown]:  US&lt;br /&gt;
Is CN=Tom, OU=security, O=ABC Inc, L=Fort Meade, ST=MA, C=US correct?&lt;br /&gt;
  [no]:  y&lt;br /&gt;
&lt;br /&gt;
Enter key password for &amp;lt;testkey&amp;gt;&lt;br /&gt;
        (RETURN if same as keystore password):&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* The option ''-genkey'' is used to generate the keys. &lt;br /&gt;
* ''-alias'' specifies the name of the key. This can be verified by the command keytool -list -keystore testkeystore.ks&lt;br /&gt;
* ''-keystore'' is the name of the keystore to where the key needs to be added. If no keystore name is specified, the generated keys will be added to the default keystore. The default keystore gets autogenerated when the first key is created and is  located in the users home directory with an &amp;quot;.keystore&amp;quot; extension.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following defaults would be applied during the genkey process:&lt;br /&gt;
		* keyalg - defaults to DSA&lt;br /&gt;
		* keysize - defaults to 1024 bits&lt;br /&gt;
		* validity - defaults to 90 days&lt;br /&gt;
&lt;br /&gt;
====Importing certificates into keystore from .cer files====&lt;br /&gt;
A certificate represented usually by a .cer file is imported into the keystore so that it gets added to the list of trusted certificates.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$bash # keytool -import -keystore testkeystore.ks -file ssltest.cer&lt;br /&gt;
Enter keystore password:  testpwd&lt;br /&gt;
Owner: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
Issuer: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
Serial number: 45697b96&lt;br /&gt;
Valid from: Sun Nov 26 06:33:42 EST 2006 until: Wed Apr 12 07:33:42 EDT 2034&lt;br /&gt;
Certificate fingerprints:&lt;br /&gt;
         MD5:  BD:AA:A5:77:AC:92:17:0E:D3:6E:E2:8F:2B:12:A5:6C&lt;br /&gt;
         SHA1: 2F:BF:88:E1:2F:26:B9:C3:64:5E:C5:7F:F4:BF:43:7F:37:3D:BE:C5&lt;br /&gt;
Trust this certificate? [no]:  yes&lt;br /&gt;
Certificate was added to keystore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The certificate ssltest.cer is successfully imported into the keystore. The serial number generated is unique to this certificate and is useful during certificate revocations. When a certificate is revoked, the serial number gets added to the CRL (Certificate revocation list).&lt;br /&gt;
'''Warning:'''&lt;br /&gt;
'''Before importing a certificate, validate if the certificate really belongs to the entity it claims to represent.'''&lt;br /&gt;
====Use the keytool -printcert -file ssltest.cer to view the contents of the certificate====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$bash # keytool -printcert -file ssltest.cer&lt;br /&gt;
Owner: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
Issuer: CN=Jane P, OU=Network Admins, O=NewCo, L=Denver, ST=CO, C=US&lt;br /&gt;
Serial number: 45697b96&lt;br /&gt;
Valid from: Sun Nov 26 06:33:42 EST 2006 until: Wed Apr 12 07:33:42 EDT 2034&lt;br /&gt;
Certificate fingerprints:&lt;br /&gt;
         MD5:  BD:AA:A5:77:AC:92:17:0E:D3:6E:E2:8F:2B:12:A5:6C&lt;br /&gt;
         SHA1: 2F:BF:88:E1:2F:26:B9:C3:64:5E:C5:7F:F4:BF:43:7F:37:3D:BE:C5&lt;br /&gt;
&lt;br /&gt;
# Verify from the Issuer of the certificate if the Certificate fingerprint matches.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exporting certificates from keystore to files====&lt;br /&gt;
To export a certificate from a keystore to a file, the following command could be used&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$bash # keytool -export -alias testkey -keystore testkeystore.ks -file testkey.cer&lt;br /&gt;
Enter keystore password:  testpwd&lt;br /&gt;
Certificate stored in file &amp;lt;testkey.cer&amp;gt;&lt;br /&gt;
Now you can verify the contents of the exported certificate using the command.&lt;br /&gt;
$bash # keytool -printcert -file testkey.cer&lt;br /&gt;
Owner: CN=Tom, OU=security, O=ABC Inc, L=Fort Meade, ST=MA, C=US&lt;br /&gt;
Issuer: CN=Tom, OU=security, O=ABC Inc, L=Fort Meade, ST=MA, C=US&lt;br /&gt;
Serial number: 45736152&lt;br /&gt;
Valid from: Sun Dec 03 18:44:18 EST 2006 until: Sat Mar 03 18:44:18 EST 2007&lt;br /&gt;
Certificate fingerprints:&lt;br /&gt;
         MD5:  8F:D3:EA:E7:B0:CF:9C:03:16:2F:3F:C9:6C:BC:5A:D4&lt;br /&gt;
         SHA1: 03:2B:C6:BD:D9:82:31:08:F1:88:3C:35:AD:8D:F9:C3:90:5E:53:6F&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Examples==&lt;br /&gt;
===SSLClient.java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package org.owasp.crypto;&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
&lt;br /&gt;
import javax.net.ssl.*;&lt;br /&gt;
import com.sun.net.ssl.*;&lt;br /&gt;
import com.sun.net.ssl.internal.ssl.Provider;&lt;br /&gt;
import java.security.Security;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * @author Joe Prasanna Kumar&lt;br /&gt;
 * This program simulates a client socket program which communicates with the SSL Server&lt;br /&gt;
 * &lt;br /&gt;
 * Algorithm:&lt;br /&gt;
 * 1. Determine the SSL Server Name and port in which the SSL server is listening&lt;br /&gt;
 * 2. Register the JSSE provider&lt;br /&gt;
 * 3. Create an instance of SSLSocketFactory&lt;br /&gt;
 * 4. Create an instance of SSLSocket&lt;br /&gt;
 * 5. Create an OutputStream object to write to the SSL Server&lt;br /&gt;
 * 6. Create an InputStream object to receive messages back from the SSL Server&lt;br /&gt;
 * &lt;br /&gt;
 */ &lt;br /&gt;
&lt;br /&gt;
public class SSLClient {&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * @param args&lt;br /&gt;
	 */&lt;br /&gt;
	public static void main(String[] args) throws Exception{&lt;br /&gt;
		String strServerName = &amp;quot;localhost&amp;quot;; // SSL Server Name&lt;br /&gt;
		int intSSLport = 4443; // Port where the SSL Server is listening&lt;br /&gt;
		PrintWriter out = null;&lt;br /&gt;
        BufferedReader in = null;&lt;br /&gt;
&lt;br /&gt;
		{&lt;br /&gt;
			// Registering the JSSE provider&lt;br /&gt;
			Security.addProvider(new Provider());&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		try {&lt;br /&gt;
			// Creating Client Sockets&lt;br /&gt;
			SSLSocketFactory sslsocketfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();&lt;br /&gt;
			SSLSocket sslSocket = (SSLSocket)sslsocketfactory.createSocket(strServerName,intSSLport);&lt;br /&gt;
&lt;br /&gt;
         	// Initializing the streams for Communication with the Server&lt;br /&gt;
         	out = new PrintWriter(sslSocket.getOutputStream(), true);&lt;br /&gt;
         	in = new BufferedReader(new InputStreamReader(sslSocket.getInputStream()));&lt;br /&gt;
&lt;br /&gt;
			BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;
			String userInput = &amp;quot;Hello Testing &amp;quot;;&lt;br /&gt;
			out.println(userInput);&lt;br /&gt;
&lt;br /&gt;
			while ((userInput = stdIn.readLine()) != null) {&lt;br /&gt;
			    out.println(userInput);&lt;br /&gt;
			    System.out.println(&amp;quot;echo: &amp;quot; + in.readLine());&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
				out.println(userInput);&lt;br /&gt;
&lt;br /&gt;
				// Closing the Streams and the Socket&lt;br /&gt;
				out.close();&lt;br /&gt;
				in.close();&lt;br /&gt;
				stdIn.close();&lt;br /&gt;
				sslSocket.close();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		catch(Exception exp)&lt;br /&gt;
		{&lt;br /&gt;
			System.out.println(&amp;quot; Exception occurred .... &amp;quot; +exp);&lt;br /&gt;
			exp.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SSLServer.java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package org.owasp.crypto;&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.security.Security;&lt;br /&gt;
import java.security.PrivilegedActionException;&lt;br /&gt;
&lt;br /&gt;
import javax.net.ssl.*;&lt;br /&gt;
import com.sun.net.ssl.*;&lt;br /&gt;
import com.sun.net.ssl.internal.ssl.Provider;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * @author Joe Prasanna Kumar&lt;br /&gt;
 * This program simulates an SSL Server listening on a specific port for client requests&lt;br /&gt;
 * &lt;br /&gt;
 * Algorithm:&lt;br /&gt;
 * 1. Regsiter the JSSE provider&lt;br /&gt;
 * 2. Set System property for keystore by specifying the keystore which contains the server certificate&lt;br /&gt;
 * 3. Set System property for the password of the keystore which contains the server certificate&lt;br /&gt;
 * 4. Create an instance of SSLServerSocketFactory&lt;br /&gt;
 * 5. Create an instance of SSLServerSocket by specifying the port to which the SSL Server socket needs to bind with&lt;br /&gt;
 * 6. Initialize an object of SSLSocket&lt;br /&gt;
 * 7. Create InputStream object to read data sent by clients&lt;br /&gt;
 * 8. Create an OutputStream object to write data back to clients.&lt;br /&gt;
 * &lt;br /&gt;
 */ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class SSLServer {&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * @param args&lt;br /&gt;
	 */&lt;br /&gt;
&lt;br /&gt;
	public static void main(String[] args) throws Exception{&lt;br /&gt;
&lt;br /&gt;
		int intSSLport = 4443; // Port where the SSL Server needs to listen for new requests from the client&lt;br /&gt;
&lt;br /&gt;
		{&lt;br /&gt;
			// Registering the JSSE provider&lt;br /&gt;
			Security.addProvider(new Provider());&lt;br /&gt;
&lt;br /&gt;
			//Specifying the Keystore details&lt;br /&gt;
			System.setProperty(&amp;quot;javax.net.ssl.keyStore&amp;quot;,&amp;quot;server.ks&amp;quot;);&lt;br /&gt;
			System.setProperty(&amp;quot;javax.net.ssl.keyStorePassword&amp;quot;,&amp;quot;JsEkey@4&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
			// Enable debugging to view the handshake and communication which happens between the SSLClient and the SSLServer&lt;br /&gt;
			// System.setProperty(&amp;quot;javax.net.debug&amp;quot;,&amp;quot;all&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		try {&lt;br /&gt;
				// Initialize the Server Socket&lt;br /&gt;
				SSLServerSocketFactory sslServerSocketfactory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();&lt;br /&gt;
				SSLServerSocket sslServerSocket = (SSLServerSocket)sslServerSocketfactory.createServerSocket(intSSLport);&lt;br /&gt;
				SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept();&lt;br /&gt;
&lt;br /&gt;
				// Create Input / Output Streams for communication with the client&lt;br /&gt;
				while(true)&lt;br /&gt;
				{&lt;br /&gt;
				PrintWriter out = new PrintWriter(sslSocket.getOutputStream(), true);&lt;br /&gt;
		        BufferedReader in = new BufferedReader(&lt;br /&gt;
						new InputStreamReader(&lt;br /&gt;
								sslSocket.getInputStream()));&lt;br /&gt;
		        String inputLine, outputLine;&lt;br /&gt;
&lt;br /&gt;
		        while ((inputLine = in.readLine()) != null) {&lt;br /&gt;
		             out.println(inputLine);&lt;br /&gt;
		             System.out.println(inputLine);&lt;br /&gt;
		        }&lt;br /&gt;
&lt;br /&gt;
		        // Close the streams and the socket&lt;br /&gt;
		        out.close();&lt;br /&gt;
		        in.close();&lt;br /&gt;
		        sslSocket.close();&lt;br /&gt;
		        sslServerSocket.close();&lt;br /&gt;
&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		catch(Exception exp)&lt;br /&gt;
		{&lt;br /&gt;
			PrivilegedActionException priexp = new PrivilegedActionException(exp);&lt;br /&gt;
			System.out.println(&amp;quot; Priv exp --- &amp;quot; + priexp.getMessage());&lt;br /&gt;
&lt;br /&gt;
			System.out.println(&amp;quot; Exception occurred .... &amp;quot; +exp);&lt;br /&gt;
			exp.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* Computer Security – Arts and Science - Matt Bishop&lt;br /&gt;
* Core Security Patterns – Christopher Steele, Ray Lai and Ramesh Nagappan&lt;br /&gt;
* http://java.sun.com/j2se/##2/docs/tooldocs/windows/keytool.html&lt;br /&gt;
* http://blogs.borland.com/krish/archive/2005/07/28/#aspx&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=The_Owasp_Orizon_Framework&amp;diff=91770</id>
		<title>The Owasp Orizon Framework</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=The_Owasp_Orizon_Framework&amp;diff=91770"/>
				<updated>2010-10-21T18:58:19Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: spelling only&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Code Auditor Workbench Tool | lblprev=&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=The Owasp Code Review Top 9 | lblnext=&lt;br /&gt;
}}&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
A lot of open source projects exist in the wild, performing static code review analysis. This is good, it means that source code testing for security issues is becoming a constraint. &lt;br /&gt;
&lt;br /&gt;
Such tools bring a lot of valuable points:&lt;br /&gt;
* community support&lt;br /&gt;
* source code freely available to anyone&lt;br /&gt;
* costs&lt;br /&gt;
&lt;br /&gt;
On the other side, these tools don't share the most valuable point among them: the security knowledge. All these tools have their own security library, containing a lot of checks, without sharing such knowledge. &lt;br /&gt;
&lt;br /&gt;
In 2006, the Owasp Orizon project was born to provide a common underlying layer to all opensource projects concerning static analysis. &lt;br /&gt;
&lt;br /&gt;
Orizon project includes:&lt;br /&gt;
* a set of APIs that developers can use to build their own security tool performing static analysis.&lt;br /&gt;
* a security library with checks to apply to source code.&lt;br /&gt;
* a tool, Milk, which is able to static analyze a source code using Orizon Framework.&lt;br /&gt;
&lt;br /&gt;
== The Owasp Orizon Architecture ==&lt;br /&gt;
In the following picture, the Owasp Orizon version 1.0 architecture is shown. As you may see, the framework is organized in engines that perform tasks over the source code and a block of tools that are deployed out of the box in order to use the APIs in a real world static analysis. &lt;br /&gt;
&lt;br /&gt;
[[Image:Owasp_Orizon_Architecture_v1.0.png|400px|The Owasp Orizon v1.0 architecture]]&lt;br /&gt;
&lt;br /&gt;
With all such elements, a developer can be scared to use the framework; that's why a special entity called SkyLine was created. Before going further into SkyLine analysis, it's very important to understand all the elements Orizon is made of. &lt;br /&gt;
&lt;br /&gt;
=== Your personal butler: the SkyLine class ===&lt;br /&gt;
Named '''core''' in the architectural picture, the SkyLine object is one of the most valuable services in Orizon version 1.0. &lt;br /&gt;
&lt;br /&gt;
The idea behind SkyLine is simple: as the Orizon architecture becomes wider, regular developers may be scared about understanding a lot of APIs in order to build their security tool, so we can help them providing  &amp;quot;per service&amp;quot; support. &lt;br /&gt;
&lt;br /&gt;
Using SkyLine object, developers can request services from the Orizon framework waiting for their accomplishment. &lt;br /&gt;
&lt;br /&gt;
The main SkyLine input is: &lt;br /&gt;
&lt;br /&gt;
 '''public boolean launch(String service)'''&lt;br /&gt;
&lt;br /&gt;
Passing the requested service as string parameter, the calling program will receive a boolean true return value if the service can be accomplished or a false value otherwise. &lt;br /&gt;
&lt;br /&gt;
The service name is compared to the ones understood by the framework: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''private int goodService(String service) {&lt;br /&gt;
 '''  int ret = -1;&lt;br /&gt;
 '''  if (service.equalsIgnoreCase(&amp;quot;init&amp;quot;))&lt;br /&gt;
 '''      ret = Cons.OC_SERVICE_INIT_FRAMEWORK;&lt;br /&gt;
 '''  if (service.equalsIgnoreCase(&amp;quot;translate&amp;quot;))&lt;br /&gt;
 '''      ret = Cons.OC_SERVICE_INIT_TRANSLATE;&lt;br /&gt;
 '''  if (service.equalsIgnoreCase(&amp;quot;static_analysis&amp;quot;))&lt;br /&gt;
 '''      ret = Cons.OC_SERVICE_STATIC_ANALYSIS;&lt;br /&gt;
 '''  if (service.equalsIgnoreCase(&amp;quot;score&amp;quot;))&lt;br /&gt;
 '''      ret = Cons.OC_SERVICE_SCORE;&lt;br /&gt;
 '''  return ret;&lt;br /&gt;
 '''}&lt;br /&gt;
&lt;br /&gt;
The secondary feature introduced in this first major framework release is the support for command line option given to the user. &lt;br /&gt;
&lt;br /&gt;
If the calling program passes command line option to Orizon framework using SkyLine, the framework will be tuned accordingly to the given values. &lt;br /&gt;
&lt;br /&gt;
This example will explain better: &lt;br /&gt;
&lt;br /&gt;
 '''public static void main(String[] args) {&lt;br /&gt;
 '''   String fileName = &amp;quot;&amp;quot;;&lt;br /&gt;
 '''   OldRecipe r;&lt;br /&gt;
 '''   DefaultLibrary dl;&lt;br /&gt;
 '''&lt;br /&gt;
 '''   SkyLine skyLine = new SkyLine(args);&lt;br /&gt;
&lt;br /&gt;
That's all folks! Internally, the SkyLine constructor, when it creates a code review session,  uses the values it was able to understand from command line. &lt;br /&gt;
&lt;br /&gt;
The command line format must follow this convention &lt;br /&gt;
&lt;br /&gt;
 ''' -o orizon_key=value&lt;br /&gt;
or the long format&lt;br /&gt;
 ''' --orizon orizon_key=value&lt;br /&gt;
&lt;br /&gt;
And these are the keys that the framework cares about:&lt;br /&gt;
* &amp;quot;input-name&amp;quot;&lt;br /&gt;
* &amp;quot;input-kind&amp;quot;&lt;br /&gt;
* &amp;quot;working-dir&amp;quot;&lt;br /&gt;
* &amp;quot;lang&amp;quot;&lt;br /&gt;
* &amp;quot;recurse&amp;quot;&lt;br /&gt;
* &amp;quot;output-format&amp;quot;&lt;br /&gt;
* &amp;quot;scan-type&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
The org.owasp.orizon.Cons class contains a detailed section about these keys with some comments and with their default value.	&lt;br /&gt;
&lt;br /&gt;
The only side effect is that calling program can use -o flag for its purpose.&lt;br /&gt;
 &lt;br /&gt;
SkyLine is contained in the org.owasp.orizon package.&lt;br /&gt;
&lt;br /&gt;
=== Give me something to remind: the Session class ===&lt;br /&gt;
Another big feature introduced in Owasp Orizon version 1.0 is the code review session concept. One of the missing features in earlier versions was the capability to track the state of the code review process. &lt;br /&gt;
&lt;br /&gt;
A Session class instance contains all the properties specified using SkyLine and it is their owner giving access to properties upon request. It contains a SessionInfo array containing information about each file being reviewed. &lt;br /&gt;
&lt;br /&gt;
Ideally, a user tool will never call Session directly, but it must use SkyLine as interface. Of course anyone is free to override this suggestion. &lt;br /&gt;
&lt;br /&gt;
Looking at the launch() method code, inside the SkyLine class, you can look how session instance is prompted to execute services. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''public boolean launch(String service) {&lt;br /&gt;
 '''   int code, stats;&lt;br /&gt;
 '''   boolean ret = false;&lt;br /&gt;
 '''&lt;br /&gt;
 '''   if ( (code = goodService(service)) == -1)&lt;br /&gt;
 '''      return log.error(&amp;quot;unknown service: &amp;quot; + service);&lt;br /&gt;
 '''   switch (code) {&lt;br /&gt;
 '''       // init service&lt;br /&gt;
 '''       case Cons.OC_SERVICE_INIT_FRAMEWORK:&lt;br /&gt;
 '''            ret = session.init();&lt;br /&gt;
 '''            break;&lt;br /&gt;
 '''       // translation service&lt;br /&gt;
 '''       case Cons.OC_SERVICE_INIT_TRANSLATE:&lt;br /&gt;
 '''            stats = session.collectStats();&lt;br /&gt;
 '''            if (stats &amp;gt; 0) {&lt;br /&gt;
 '''               log.warning(stats + &amp;quot; files failed in collecting statistics.&amp;quot;);&lt;br /&gt;
 '''               ret = false;&lt;br /&gt;
 '''            } else&lt;br /&gt;
 '''               ret = true;&lt;br /&gt;
 '''            break;&lt;br /&gt;
 '''       // static analysis service&lt;br /&gt;
 '''       case Cons.OC_SERVICE_STATIC_ANALYSIS:&lt;br /&gt;
 '''            ret = session.staticReview();&lt;br /&gt;
 '''            break;&lt;br /&gt;
 '''       // score service&lt;br /&gt;
 '''       case Cons.OC_SERVICE_SCORE:&lt;br /&gt;
 '''            break;&lt;br /&gt;
 '''       default:&lt;br /&gt;
 '''            return log.error(&amp;quot;unknown service: &amp;quot; + service);&lt;br /&gt;
 '''       }&lt;br /&gt;
 '''       return ret;&lt;br /&gt;
 '''}&lt;br /&gt;
&lt;br /&gt;
Internally, the Session instance will ask each SessionInfo object to execute services. Let us consider the Session class method that executes the static analysis service. &lt;br /&gt;
&lt;br /&gt;
 '''/**&lt;br /&gt;
 '''  * Starts a static analysis over the files being reviewed&lt;br /&gt;
 '''  * &lt;br /&gt;
 '''  * @return &amp;lt;i&amp;gt;true&amp;lt;/i&amp;gt; if static analysis can be performed or &amp;lt;i&amp;gt;false&amp;lt;/i&amp;gt;&lt;br /&gt;
 '''  *         if one or more files fail being analyzed.&lt;br /&gt;
 '''  */&lt;br /&gt;
 '''public boolean staticReview() {&lt;br /&gt;
 '''   boolean ret = true;&lt;br /&gt;
 '''   if (!active)&lt;br /&gt;
 '''      return log.error(&amp;quot;can't perform a static analysis over an inactive session.&amp;quot;);&lt;br /&gt;
 '''   for (int i = 0; i &amp;lt; sessions.length; i++) {&lt;br /&gt;
 '''       if (! sessions[i].staticReview())&lt;br /&gt;
 '''          ret = false;&lt;br /&gt;
 '''   }&lt;br /&gt;
 '''   return ret;&lt;br /&gt;
 '''}&lt;br /&gt;
&lt;br /&gt;
Where sessions variable is declared as:&lt;br /&gt;
 '''private SessionInfo[] sessions;&lt;br /&gt;
&lt;br /&gt;
As you may see, the Session object delegates service accomplishment to SessionInfo once collecting the final results. &lt;br /&gt;
&lt;br /&gt;
In fact, SessionInfo objects are the ones talking with Orizon internals performing the real work. &lt;br /&gt;
&lt;br /&gt;
The following method is stolen from org.owasp.orizon.SessionInfo class. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''/**&lt;br /&gt;
 '''  * Perform a static analysis over the given file&lt;br /&gt;
 '''  * &lt;br /&gt;
 '''  * A full static analysis is a mix from:&lt;br /&gt;
 '''  * &lt;br /&gt;
 '''  *  * local analysis (control flow)&lt;br /&gt;
 '''  *  * global analysis (call graph)&lt;br /&gt;
 '''  *  * taint propagation&lt;br /&gt;
 '''  *  * statistics&lt;br /&gt;
 '''  * &lt;br /&gt;
 '''  * &lt;br /&gt;
 '''  * @return &amp;lt;i&amp;gt;true&amp;lt;/i&amp;gt; if the file being reviewed doesn't violate any&lt;br /&gt;
 '''  *         security check, &amp;lt;i&amp;gt;false&amp;lt;/i&amp;gt; otherwise.&lt;br /&gt;
 '''  */&lt;br /&gt;
 '''  public boolean staticReview() {&lt;br /&gt;
 '''     boolean ret = false;&lt;br /&gt;
 '''     s = new Source(getStatFileName());&lt;br /&gt;
 '''     ret = s.analyzeStats();&lt;br /&gt;
 '''     ...&lt;br /&gt;
 '''     return ret;&lt;br /&gt;
 '''  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Translation Factory ===&lt;br /&gt;
One of the Owasp Orizon goals is to be independent from the source language being analyzed. This means that Owasp Orizon will support: &lt;br /&gt;
* Java&lt;br /&gt;
* C, C++&lt;br /&gt;
* C#&lt;br /&gt;
* Perl&lt;br /&gt;
* ...&lt;br /&gt;
Such support is granted using an intermediate file format to describe the source code and used to apply the security checks. Such format is XML language. &lt;br /&gt;
&lt;br /&gt;
A source code, before static analysis is started, is translated into XML. Starting from version 1.0, each source code is translated in 4 XML files: &lt;br /&gt;
&lt;br /&gt;
* an XML file containing statistical information&lt;br /&gt;
* an XML file containing variables tracking information&lt;br /&gt;
* an XML file containing program control flow (local analysis)&lt;br /&gt;
* an XML file containing call graph (global analysis)&lt;br /&gt;
&lt;br /&gt;
At the time this document is written (Owasp Orizon v1.0pre1, September 2008), only the Java programming language is supported, however other programming language will follow soon. &lt;br /&gt;
&lt;br /&gt;
Translation phase is requested from org.owasp.orizon.SessionInfo.inspect() method. Depending on the source file language, the appropriate Translator is called and the scan() method is called. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ''' /**&lt;br /&gt;
 '''   * Inspects the source code, building AST trees&lt;br /&gt;
 '''   * @return&lt;br /&gt;
 '''   */&lt;br /&gt;
 '''   public boolean inspect() {&lt;br /&gt;
 '''      boolean ret = false;&lt;br /&gt;
 '''      switch (language) {&lt;br /&gt;
 '''         case Cons.O_JAVA:&lt;br /&gt;
 '''             t = new JavaTranslator();&lt;br /&gt;
 '''             if (!t.scan(getInFileName())) &lt;br /&gt;
 '''                return log.error(&amp;quot;can't scan &amp;quot; + getInFileName() + &amp;quot;.&amp;quot;);&lt;br /&gt;
 '''                ret = true;&lt;br /&gt;
 '''         break;&lt;br /&gt;
 '''         default:&lt;br /&gt;
 '''             log.error(&amp;quot;can't inspect language: &amp;quot; + Cons.name(language));&lt;br /&gt;
 '''         break;&lt;br /&gt;
 '''      }&lt;br /&gt;
 '''      return ret;&lt;br /&gt;
 '''   }&lt;br /&gt;
&lt;br /&gt;
Scan method is an abstract method defined in org.owasp.orizon.translator.DefaultTranslator class and declared as the following: &lt;br /&gt;
&lt;br /&gt;
 ''' public abstract boolean scan(String in);&lt;br /&gt;
&lt;br /&gt;
Every class implementing DefaultTranslator must implement how to scan the source file and build ASTs in this method. &lt;br /&gt;
&lt;br /&gt;
Aside from scan() method, there are four abstract method needful to create XML input files. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ''' public abstract boolean statService(String in, String out);&lt;br /&gt;
 ''' public abstract boolean callGraphService(String in, String out);&lt;br /&gt;
 ''' public abstract boolean dataFlowService(String in, String out);&lt;br /&gt;
 ''' public abstract boolean controlFlowService(String in, String out);&lt;br /&gt;
&lt;br /&gt;
All these methods are called in the translator() method, the one implemented directly from DefaultTranslator class. &lt;br /&gt;
&lt;br /&gt;
 ''' public final boolean translate(String in, String out, int service) {&lt;br /&gt;
 '''    if (!isGoodService(service))&lt;br /&gt;
 '''       return false;&lt;br /&gt;
 '''    if (!scanned)&lt;br /&gt;
 '''       if (!scan(in))&lt;br /&gt;
 '''          return log.error(in+ &amp;quot;: scan has been failed&amp;quot;);&lt;br /&gt;
 '''    switch (service) {&lt;br /&gt;
 '''      case Cons.OC_TRANSLATOR_STAT:&lt;br /&gt;
 '''          return statService(in, out);&lt;br /&gt;
 '''      case Cons.OC_TRANSLATOR_CF:&lt;br /&gt;
 '''          return controlFlowService(in, out);&lt;br /&gt;
 '''      case Cons.OC_TRANSLATOR_CG:&lt;br /&gt;
 '''          return callGraphService(in, out);&lt;br /&gt;
 '''      case Cons.OC_TRANSLATOR_DF:&lt;br /&gt;
 '''          return dataFlowService(in, out);&lt;br /&gt;
 '''      default:&lt;br /&gt;
 '''          return log.error(&amp;quot;unknown service code&amp;quot;);&lt;br /&gt;
 '''    }&lt;br /&gt;
 ''' }&lt;br /&gt;
&lt;br /&gt;
So, when a language specific translator is prompted for translate() method, this recalls the language specific service methods. &lt;br /&gt;
&lt;br /&gt;
Every translator contains as private field, a language specific scanner containing ASTs to be used in input file generation. &lt;br /&gt;
&lt;br /&gt;
Consider org.owasp.orizon.translator.java.JavaTranslator class, it is declared as follows: &lt;br /&gt;
&lt;br /&gt;
 ''' public class JavaTranslator extends DefaultTranslator {&lt;br /&gt;
 '''   static SourcePositions positions;&lt;br /&gt;
 '''   private JavaScanner j;&lt;br /&gt;
 '''   ...&lt;br /&gt;
&lt;br /&gt;
JavaScanner is a class from org.owasp.orizon.translator.java package and it uses Sun JDK 6 Compiler API to scan a Java file creating in memory ASTs. Trees are created in scan() method, implemented for Java source language as follow: &lt;br /&gt;
&lt;br /&gt;
 ''' public final boolean scan(String in) {&lt;br /&gt;
 '''    boolean ret = false;&lt;br /&gt;
 '''    String[] parms = { in };&lt;br /&gt;
 '''    Trees trees;&lt;br /&gt;
 ''' 		&lt;br /&gt;
 '''    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();&lt;br /&gt;
 '''    if (compiler == null) &lt;br /&gt;
 '''       return log.error(&amp;quot;I can't find a suitable JAVA compiler. Is a JDK installed?&amp;quot;);&lt;br /&gt;
 ''' 	&lt;br /&gt;
 '''    DiagnosticCollector&amp;lt;JavaFileObject&amp;gt; diagnostics = new DiagnosticCollector&amp;lt;JavaFileObject&amp;gt;();&lt;br /&gt;
 '''    StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);&lt;br /&gt;
 '''    Iterable&amp;lt;? extends JavaFileObject&amp;gt; fileObjects = fileManager.getJavaFileObjects(parms);&lt;br /&gt;
 '''&lt;br /&gt;
 '''    JavacTask task = (com.sun.source.util.JavacTask) compiler.getTask(null,fileManager, diagnostics, null, null, fileObjects);&lt;br /&gt;
 '''&lt;br /&gt;
 '''    try {&lt;br /&gt;
 '''        trees = Trees.instance(task);&lt;br /&gt;
 '''        positions = trees.getSourcePositions();&lt;br /&gt;
 '''        Iterable&amp;lt;? extends CompilationUnitTree&amp;gt; asts = task.parse();&lt;br /&gt;
 '''        for (CompilationUnitTree ast : asts) {&lt;br /&gt;
 '''            j = new JavaScanner(positions, ast);&lt;br /&gt;
 '''            j.scan(ast, null);&lt;br /&gt;
 '''        }&lt;br /&gt;
 '''        scanned = true;&lt;br /&gt;
 '''        return true;&lt;br /&gt;
 '''    } catch (IOException e) {&lt;br /&gt;
 '''        return log.fatal(&amp;quot;an exception occurred while translate &amp;quot; + in + &amp;quot;: &amp;quot; +e.getLocalizedMessage());&lt;br /&gt;
 '''    }&lt;br /&gt;
 ''' }&lt;br /&gt;
&lt;br /&gt;
===Statistical Gathering ===&lt;br /&gt;
To implement statistic information gathering, DefaultTranslator abstract method statService() must be implemented. In the following example, the method is the JavaTranslator's. Statistics information is stored in the JavaScanner object itself and retrieved by getStats() method. &lt;br /&gt;
&lt;br /&gt;
 ''' public final boolean statService(String in, String out) {&lt;br /&gt;
 '''    boolean ret = false;&lt;br /&gt;
 ''' 		&lt;br /&gt;
 '''    if (!scanned)&lt;br /&gt;
 '''       return log.error(in + &amp;quot;: call scan() before asking translation...&amp;quot;);&lt;br /&gt;
 '''    log.debug(&amp;quot;. Entering statService(): collecting stats for: &amp;quot; + in);&lt;br /&gt;
 '''    try {&lt;br /&gt;
 '''        createXmlFile(out);&lt;br /&gt;
 '''        xmlInit();&lt;br /&gt;
 '''        xml(&amp;quot;&amp;lt;source name=\&amp;quot;&amp;quot; + in+&amp;quot;\&amp;quot; &amp;gt;&amp;quot;);&lt;br /&gt;
 '''        xml(j.getStats());&lt;br /&gt;
 '''        xml(&amp;quot;&amp;lt;/source&amp;gt;&amp;quot;);&lt;br /&gt;
 '''        xmlEnd();&lt;br /&gt;
 '''&lt;br /&gt;
 '''    } catch (FileNotFoundException e) {&lt;br /&gt;
 '''    } catch (UnsupportedEncodingException e) {&lt;br /&gt;
 '''    } catch (IOException e) {&lt;br /&gt;
 '''        ret = log.error(&amp;quot;an exception occurred: &amp;quot; + e.getMessage());&lt;br /&gt;
 '''    }&lt;br /&gt;
 '''    ret = true;&lt;br /&gt;
 '''    log.debug(&amp;quot;stats written into: &amp;quot; + out);&lt;br /&gt;
 '''    log.debug(&amp;quot;. Leaving statService()&amp;quot;);&lt;br /&gt;
 '''    return ret;&lt;br /&gt;
 ''' }&lt;br /&gt;
&lt;br /&gt;
== Reference == &lt;br /&gt;
&lt;br /&gt;
To anyone interested in Owasp Orizon framework, you can use the following links:&lt;br /&gt;
* main page @ Owasp: [[::Category:OWASP_Orizon_Project|OWASP Orizon Project]]&lt;br /&gt;
* main site @ SourceForge: [http://orizon.sourceforge.net http://orizon.sourceforge.net]&lt;br /&gt;
* blog: [http://orizon.sourceforget.net/blog http://orizon.sourceforge.net/blog]&lt;br /&gt;
* author page @ Owasp: [http://www.owasp.org/index.php/User:Thesp0nge http://www.owasp.org/index.php/User:Thesp0nge]&lt;br /&gt;
&lt;br /&gt;
You can drop also a line to Orizon author: [mailto:thesp0nge@owasp.org thesp0nge@owasp.org]&lt;br /&gt;
 '''foo'''&lt;br /&gt;
&lt;br /&gt;
{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Code Auditor Workbench Tool | lblprev=&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=The Owasp Code Review Top 9 | lblnext=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Codereview-Input_Validation&amp;diff=91764</id>
		<title>Codereview-Input Validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Codereview-Input_Validation&amp;diff=91764"/>
				<updated>2010-10-21T17:23:35Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: readability improvements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Codereview-Session-Management | lblprev=Session Management&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Codereview-Error-Handling | lblnext=Error Handling&lt;br /&gt;
}}&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Input validation is one of the most effective technical controls for application security. It can mitigate numerous vulnerabilities including cross-site scripting, various forms of injection, and some buffer overflows. Input validation is more than checking form field values. The chapter on transactional analysis talks about this. &lt;br /&gt;
&lt;br /&gt;
===Data Validation===&lt;br /&gt;
All external input to the system should undergo input validation. The validation rules are defined by the business requirements for the application. If possible, an exact match validator should be implemented. Exact match only permits data that conforms to an expected value. A &amp;quot;Known good&amp;quot; approach (white-list), which is a little weaker, but more flexible, is common. Known good only permits characters/ASCII ranges defined within a white-list. Such a range is defined by the business requirements of the input field. The other approaches to data validation are &amp;quot;known bad,&amp;quot; which is a black list of &amp;quot;bad characters&amp;quot;. This approach is not future proof and would need maintenance. &amp;quot;Encode bad&amp;quot; would be very weak, as it would simply encode characters considered &amp;quot;bad&amp;quot; to a format which should not affect the functionality of the application.&lt;br /&gt;
&lt;br /&gt;
===Business Validation===&lt;br /&gt;
Business validation is concerned with business logic. An understanding of the business logic is required prior to reviewing the code which performs such logic. Business validation could be used to limit the value range or a transaction inputted by a user or reject input which does not make too much business sense. Reviewing code for business validation can also include rounding errors or floating point issues which may give rise to issues such as integer overflows which can dramatically damage the bottom line. &lt;br /&gt;
&lt;br /&gt;
===Canonicalization===&lt;br /&gt;
Canonicalization is the process by which various equivalent forms of a name can be resolved to a single standard name, or the &amp;quot;canonical&amp;quot; name. &lt;br /&gt;
&lt;br /&gt;
The most popular encodings are UTF-8, UTF-16, and so on (which are described in detail in RFC 2279). A single character, such as a period/full-stop (.), may be represented in many different ways: ASCII 2E, Unicode C0 AE, and many others. &lt;br /&gt;
&lt;br /&gt;
With the myriad ways of encoding user input, a web application's filters can be easily circumvented if they're not carefully built. &lt;br /&gt;
&lt;br /&gt;
===Bad Example===&lt;br /&gt;
 public static void main(String[] args) {&lt;br /&gt;
     File x = new File(&amp;quot;/cmd/&amp;quot; + args[1]);&lt;br /&gt;
     String absPath = x.getAbsolutePath();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Good Example===&lt;br /&gt;
 public static void main(String[] args) throws IOException {&lt;br /&gt;
     File x = new File(&amp;quot;/cmd/&amp;quot; + args[1]);&lt;br /&gt;
     String canonicalPath = x.getCanonicalPath();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
'''See Reviewing code for Data Validation (in this guide)'''&lt;br /&gt;
[[Reviewing_Code_for_Data_Validation|Reviewing code for Data Validation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''See the OWASP ESAPI Project'''&lt;br /&gt;
&lt;br /&gt;
The [[ESAPI|OWASP ESAPI]] project provides a reference implementation of a security API which can assist in providing security controls to an application.&lt;br /&gt;
&lt;br /&gt;
{{LinkBar&lt;br /&gt;
  | useprev=PrevLink | prev=Codereview-Session-Management | lblprev=Session Management&lt;br /&gt;
  | usemain=MainLink | main=OWASP Code Review Guide Table of Contents | lblmain=Table of Contents&lt;br /&gt;
  | usenext=NextLink | next=Codereview-Error-Handling | lblnext=Error Handling&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Code Review Project]]&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Ari_Elias-Bachrach&amp;diff=91755</id>
		<title>User:Ari Elias-Bachrach</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Ari_Elias-Bachrach&amp;diff=91755"/>
				<updated>2010-10-21T16:07:12Z</updated>
		
		<summary type="html">&lt;p&gt;Ari Elias-Bachrach: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ari is a CISSP and CEH. He has a BS in computer science from Washington University in St. Louis, and a MS in computer science with a focus on information security from The George Washington University. Previously he worked for the federal government, followed by a stint in the private sector as a consultant performing external penetration testing and web application reviews. Now he works as an in-house information security engineer focusing on web applications.&lt;/div&gt;</summary>
		<author><name>Ari Elias-Bachrach</name></author>	</entry>

	</feed>