<?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=Jmanico</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=Jmanico"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Jmanico"/>
		<updated>2026-04-21T15:01:50Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Staff-Projects/DefCon_27_Event&amp;diff=252989</id>
		<title>Staff-Projects/DefCon 27 Event</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Staff-Projects/DefCon_27_Event&amp;diff=252989"/>
				<updated>2019-07-12T19:11:56Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: defcon volunteer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
DEFCON 27 Hacking Conference  &lt;br /&gt;
* '''When:''' August 8-11, 2019&lt;br /&gt;
* '''Vendor Room Hours are:'''&lt;br /&gt;
** '''''Aug. 8th''''' - '''Thursday SETUP ONLY''' &lt;br /&gt;
*** 9 am Vendor Setup Available - 9 pm Room Closes&lt;br /&gt;
** '''''Aug. 9 &amp;amp; 10''''' - Friday and Saturday  &lt;br /&gt;
*** Vendors can enter at 9 am &lt;br /&gt;
*** 10 am to 7 pm  Doors Open to Attendees&lt;br /&gt;
** '''''Aug. 11th''''' - Sunday &lt;br /&gt;
*** Vendors can enter at 9 am&lt;br /&gt;
*** 10 am - 3 pm Doors Open to Attendees&lt;br /&gt;
*** 4 PM Tax Paperwork Due&lt;br /&gt;
*** 8 PM Load Out Complete&lt;br /&gt;
* '''Where:''' Paris, Bally's, &amp;amp; Planet Hollywood, Las Vegas&lt;br /&gt;
* OWASP Board requested and approved the conference&lt;br /&gt;
&lt;br /&gt;
Three volunteers at the booth at all times&lt;br /&gt;
&lt;br /&gt;
= Project Links =&lt;br /&gt;
&lt;br /&gt;
* Event Link: https://www.defcon.org/index.html&lt;br /&gt;
* Floor Plan: https://www.owasp.org/index.php/File:DC27_Vendor_room_final.jpg&lt;br /&gt;
* Tickets are $300 CASH at the door.&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
&lt;br /&gt;
Community Outreach initiative &lt;br /&gt;
&lt;br /&gt;
= Milestones =&lt;br /&gt;
&lt;br /&gt;
* 2019-02-28, DONE - [https://drive.google.com/open?id=14fH4iiMoo1XBCjKWoteQ_q9UL5EIxQ2GaQS_bB8U Vendor application] submitted [Lisa] &lt;br /&gt;
* 2019-03-30, DONE  - Granted approval of vendor application by [DEFCON NO confirmation provided just email]&lt;br /&gt;
* 2019-04-01, DONE - Submitted a proposed budget for the event for approval [Lisa]&lt;br /&gt;
* 2019-04-04, DONE - Booth invoice submitted for payment [https://owasporg.atlassian.net/browse/OSD-2318 OSD-2318] payment sent ACH April 17, 2019 [Lisa/Mike/Virtual]&lt;br /&gt;
* 2019-06-14, Art Due from Artist [Jon McCoy]&lt;br /&gt;
** [https://drive.google.com/drive/u/0/folders/1G-L3xrh_3MvkeB_VKZgvVR5dxdJT3gib DEFCON 26 Artwork] (2018 historical data) &lt;br /&gt;
* 2019-06-14, DONE - Second invoice for balance due t-shirt artwork processed for payment [https://owasporg.atlassian.net/browse/OSD-2502 OSD-2502][Approved 6/17/2019] &lt;br /&gt;
* 2019-06-14, DONE - Printer contacted - quote on 1 t-shirt design, 6ft 3 sided tablecloth&lt;br /&gt;
* 2019-06-27, DONE - Final order to the printer including 2 designs, all black t-shirt, and adj qty with shipping info [DONE 6/26/2019 Lisa] &lt;br /&gt;
* 2019-06-28, DONE - Dragongraphics invoice entered for payment [https://owasporg.atlassian.net/browse/OSD-2542 OSD-2542] &lt;br /&gt;
* 2019-07-01, Final Art selected [DONE- T-shirt approved 6/17/19] STILL WAITING ON STICKER NEW ARTWORK &amp;amp; HANDOUTS&lt;br /&gt;
* 2019-07-10, Flyers(handouts) &amp;amp; sticker ordered [Lisa]&lt;br /&gt;
* 2019-08-08, DEFCON Booth Move-in&lt;br /&gt;
* Volunteers identified - Board Members attending&lt;br /&gt;
&lt;br /&gt;
= Badge Plan =&lt;br /&gt;
9 Badges were purchased by the Foundation - Jon responsible to staff the booth. &lt;br /&gt;
* Conference/Exhibition Pass: Jim Manico&lt;br /&gt;
* Conference/Exhibition Pass: DAY 1 VOLUNTEER&lt;br /&gt;
* Conference/Exhibition Pass: DAY 2 VOLUNTEER&lt;br /&gt;
* Conference/Exhibition Pass: DAY 2 VOLUNTEER&lt;br /&gt;
* Conference/Exhibition Pass: DAY 3 VOLUNTEER&lt;br /&gt;
* Conference/Exhibition Pass: DAY 3 VOLUNTEER&lt;br /&gt;
* Conference/Exhibition Pass: Staff/Harold&lt;br /&gt;
* Conference/Exhibition Pass: Staff/Mike&lt;br /&gt;
&lt;br /&gt;
= Leadership =&lt;br /&gt;
&lt;br /&gt;
* Lisa Jones [OWASP Staff] &lt;br /&gt;
* Mike McCamon [Execitive Director of OWASP Foundation -  Approval authority]&lt;br /&gt;
* Jon McCoy [OWASP Member jonmccoy@owasp.org] requested approval from the board to do the event and received approval for $ 3,500 for artwork. (2018 $2,500 spent on artwork for this event)&lt;br /&gt;
&lt;br /&gt;
[[Category:Staff Projects]]&lt;br /&gt;
&lt;br /&gt;
=Name &amp;amp; URLs=&lt;br /&gt;
&lt;br /&gt;
* Name: DEFCON 27&lt;br /&gt;
* URL: https://www.defcon.org/index.html&lt;br /&gt;
* Cash at the door- $300.00  &lt;br /&gt;
* Exhibition Information: Vendors must stay at Bally's or Paris Hotels in order to take advantage of the packaging center for [https://drive.google.com/open?id=13WgEk6sUq430ib6uNNQtwPqSGaWZH7YM logistical assistance] with receiving and picking up vendor booth event materials.    &lt;br /&gt;
* 2019-06-27, Janet Whitaker[janetwhitaker68@gmail.com] from DefCon responded that Booth numbers not available yet.  They are behind we should find out the first week in July sometime.      &lt;br /&gt;
= Registration is not available.  Only accept cash =&lt;br /&gt;
&lt;br /&gt;
= Budget  =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|Quantity &lt;br /&gt;
|Expenses:&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Artwork for t-shirt &amp;amp; stickers&lt;br /&gt;
|$3,500&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Booth 8X8&lt;br /&gt;
|$1,100&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Power&lt;br /&gt;
|$250&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Internet&lt;br /&gt;
|$400&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Tickets 6 Board &amp;amp; 2 staff&lt;br /&gt;
|$2,700&lt;br /&gt;
|-&lt;br /&gt;
|750&lt;br /&gt;
|t-shirts &amp;amp; printing (&amp;lt;$8 per)&lt;br /&gt;
|$6000&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|table cloth&lt;br /&gt;
|$275&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Stickers / print on both sides&lt;br /&gt;
|$1,000&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Flyers estimate - Hand out?&lt;br /&gt;
|$350&lt;br /&gt;
|-&lt;br /&gt;
|Est.&lt;br /&gt;
|Packing &amp;amp; Handling fees &lt;br /&gt;
|$100&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Staff travel &amp;amp; expenses&lt;br /&gt;
|$5,000&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|Board Hotel Accommodations&lt;br /&gt;
|$2,400&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Travel Assistance Grant $1,000&lt;br /&gt;
|$5,000&lt;br /&gt;
|-&lt;br /&gt;
|25&lt;br /&gt;
|Global AppSec Vouchers to 1st 25  Woman to donate&lt;br /&gt;
|20,000&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Total&lt;br /&gt;
|48,075&lt;br /&gt;
|}&lt;br /&gt;
* 25 Vouchers for the first women to &amp;quot;make a donation&amp;quot; to the Foundation at our booth. A process will be setup after the event to solicit Travel Assistance Grants for a later conference. The approximate cost of this promotion is approximately $20,000.&lt;br /&gt;
&lt;br /&gt;
== T-Shirt Order ==&lt;br /&gt;
&lt;br /&gt;
NEW DESIGN&lt;br /&gt;
Men (adjusted to stay within budget)&lt;br /&gt;
* XXXL 20&lt;br /&gt;
* XXL 130&lt;br /&gt;
* XL 185&lt;br /&gt;
* L 185&lt;br /&gt;
* M 50&lt;br /&gt;
* S 10&lt;br /&gt;
Women&lt;br /&gt;
* XXXL 5&lt;br /&gt;
* XXL 10&lt;br /&gt;
* XL 10&lt;br /&gt;
* L 10&lt;br /&gt;
* M 5&lt;br /&gt;
OLD DESIGN&lt;br /&gt;
Men&lt;br /&gt;
* XXL 20&lt;br /&gt;
* XL 20&lt;br /&gt;
* L 20&lt;br /&gt;
Women&lt;br /&gt;
* XXXL 5&lt;br /&gt;
* XXL 10&lt;br /&gt;
* XL 10&lt;br /&gt;
* L 10&lt;br /&gt;
* M 5&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1xSahMqHHA6KmaQDe20HyHbo1fMnbDwHg3DkhQeuwtrw/edit#gid=1837428674 Comparison] with last year's information located.&lt;br /&gt;
  &lt;br /&gt;
[[Category:Staff Projects]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247367</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247367"/>
				<updated>2019-02-12T19:04:30Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Code Execution via Log Injection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events  (log forging via log injection)&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
== Log Forging ==&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
=== Log Forging Example ===&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
== Code Execution via Log Injection ==&lt;br /&gt;
&lt;br /&gt;
PHP code can easily be added to a log file, for example:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://www.somedomain.tld/index.php?file=&amp;lt;/nowiki&amp;gt;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This stage it is called '''log file poisoning'''. If the log file is staged on a public directory and can be accessed via a HTTP GET request, the embedded PHP command may execute in certain circumstances. This is a form of [[Command Injection]] via Log Injection.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247366</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247366"/>
				<updated>2019-02-12T19:03:57Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Code Execution via Log Injection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events  (log forging via log injection)&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
== Log Forging ==&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
=== Log Forging Example ===&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
== Code Execution via Log Injection ==&lt;br /&gt;
&lt;br /&gt;
PHP code can easily be added to a log file, for example:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://www.somedomain.tld/index.php?file=&amp;lt;/nowiki&amp;gt;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This stage it is called '''log file poisoning'''. If the log file is staged on a public directory and can be accessed via a HTTP GET request, the embedded PHP command may execute in certain circumstances. This is a form of [[Command_Injection]] via Log Injection.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247365</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247365"/>
				<updated>2019-02-12T19:02:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Log Forging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events  (log forging via log injection)&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
== Log Forging ==&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
=== Log Forging Example ===&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
== Code Execution via Log Injection ==&lt;br /&gt;
&lt;br /&gt;
PHP code can easily be added to a log file, for example:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://www.somedomain.tld/index.php?file=&amp;lt;/nowiki&amp;gt;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This stage it is called '''log file poisoning'''. If the log file is staged on a public directory and can be accessed via a HTTP GET request, the embedded PHP command may execute in certain circumstances.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247364</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247364"/>
				<updated>2019-02-12T18:56:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events  (log forging via log injection)&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
== Log Forging ==&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
=== Log Forging Example ===&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247363</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247363"/>
				<updated>2019-02-12T18:56:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events  (log forging via log injection)&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
== Log Forging ==&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247362</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247362"/>
				<updated>2019-02-12T18:54:51Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
In other cases, an attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility [2].&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247361</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247361"/>
				<updated>2019-02-12T18:54:41Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. This is called log injection.&lt;br /&gt;
&lt;br /&gt;
Log injection vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file.&lt;br /&gt;
&lt;br /&gt;
Successful log injection attacks can cause:&lt;br /&gt;
&lt;br /&gt;
# Injection of new/bogus log events&lt;br /&gt;
# Injection of XSS attacks, hoping that the malicious log event is viewed in a vulnerable web application&lt;br /&gt;
# Injection of commands that parsers (like PHP parsers) could execute&lt;br /&gt;
&lt;br /&gt;
 In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1].&lt;br /&gt;
&lt;br /&gt;
In other cases, an attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility [2].&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247360</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247360"/>
				<updated>2019-02-12T18:44:42Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: adding more references from other editor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs.&lt;br /&gt;
&lt;br /&gt;
Log forging vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file. &lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Interpretation of the log files may be hindered or misdirected if an attacker can supply data to the application that is subsequently logged verbatim. In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1]. In the worst case, an attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility [2].&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
* https://medium.com/@shatabda/security-log-injection-what-how-a510cfc0f73b&lt;br /&gt;
* https://www.geeksforgeeks.org/log-injection/&lt;br /&gt;
* https://affinity-it-security.com/what-is-log-injection/&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247359</id>
		<title>Log Injection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Log_Injection&amp;diff=247359"/>
				<updated>2019-02-12T18:43:14Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: returning to Jims version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs.&lt;br /&gt;
&lt;br /&gt;
Log forging vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters an application from an untrusted source. &lt;br /&gt;
# The data is written to an application or system log file. &lt;br /&gt;
&lt;br /&gt;
Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.&lt;br /&gt;
&lt;br /&gt;
Interpretation of the log files may be hindered or misdirected if an attacker can supply data to the application that is subsequently logged verbatim. In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. A more subtle attack might involve skewing the log file statistics. Forged or otherwise, corrupted log files can be used to cover an attacker's tracks or even to implicate another party in the commission of a malicious act [1]. In the worst case, an attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility [2].&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The following web application code attempts to read an integer value from a request object. If the value fails to parse as an integer, then the input is logged with an error message indicating what happened.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	...&lt;br /&gt;
	String val = request.getParameter(&amp;quot;val&amp;quot;);&lt;br /&gt;
	try {&lt;br /&gt;
		int value = Integer.parseInt(val);&lt;br /&gt;
	}&lt;br /&gt;
	catch (NumberFormatException) {&lt;br /&gt;
		log.info(&amp;quot;Failed to parse val = &amp;quot; + val);&lt;br /&gt;
	}&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user submits the string &amp;quot;twenty-one&amp;quot; for val, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if an attacker submits the string &amp;quot;twenty-one%0a%0aINFO:+User+logged+out%3dbadguy&amp;quot;, the following entry is logged:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	INFO: Failed to parse val=twenty-one&lt;br /&gt;
&lt;br /&gt;
	INFO: User logged out=badguy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearly, attackers can use this same mechanism to insert arbitrary log entries.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [1] A. Muffet. The night the log was forged. http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm.&lt;br /&gt;
* [2] G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246339</id>
		<title>Category:OWASP Application Security Verification Standard Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246339"/>
				<updated>2019-01-02T22:29:02Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* Related Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Home =&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:90px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File: flagship_big.jpg|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_Projects]]&amp;lt;/div&amp;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;
== What is ASVS? ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Application Security Verification Standard (ASVS) Project provides a basis for testing web application technical security controls and also provides developers with a list of requirements for secure development.&lt;br /&gt;
&lt;br /&gt;
The primary aim of the '''OWASP Application Security Verification Standard (ASVS) Project''' is to normalize the range in the coverage and level of rigor available in the market when it comes to performing Web application security verification using a commercially-workable open standard. The standard provides a basis for testing application technical security controls, as well as any technical security controls in the environment, that are relied on to protect against vulnerabilities such as Cross-Site Scripting (XSS) and SQL injection. This standard can be used to establish a level of confidence in the security of Web applications. The requirements were developed with the following objectives in mind: &lt;br /&gt;
&lt;br /&gt;
*'''Use as a metric''' - Provide application developers and application owners with a yardstick with which to assess the degree of trust that can be placed in their Web applications, &lt;br /&gt;
*'''Use as guidance''' - Provide guidance to security control developers as to what to build into security controls in order to satisfy application security requirements, and &lt;br /&gt;
*'''Use during procurement''' - Provide a basis for specifying application security verification requirements in contracts.&lt;br /&gt;
&lt;br /&gt;
== OWASP ASVS 4.0 will be released in early 2019 ==&lt;br /&gt;
&lt;br /&gt;
Please note there will &amp;lt;b&amp;gt;not be a 3.1 release&amp;lt;/b&amp;gt; and we will be going directly from &amp;lt;b&amp;gt;ASVS 3.0.1 to 4.0 in February 2019&amp;lt;/b&amp;gt;!&lt;br /&gt;
&lt;br /&gt;
== Email List ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]] [https://lists.owasp.org/mailman/listinfo/owasp-application-security-verification-standard Project Email List]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
Daniel Cuthbert [mailto:Daniel.Cuthbert@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Andrew van der Stock [mailto:vanderaj@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico [mailto:jim.manico@owasp.org @]&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
*[https://www.owasp.org/index.php/OWASP_Proactive_Controls OWASP Top Ten Proactive Controls (2018)]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project OWASP Top Ten Risks (2017)] &lt;br /&gt;
*[https://www.owasp.org/index.php/OWASP_Cheat_Sheet_Series OWASP Cheatsheet Series] &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;
ASVS 3.0.1 in English.&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
&lt;br /&gt;
* [9 March 2018] [https://docs.google.com/spreadsheets/d/1ic7gsib--Cn4ujrA8rhvzuUmMFpQ2Jkl96SZDCEtqJg/edit?ts=5a6bafe1#gid=950526877 OWASP Application Security Verification Standard 3.1 Spreadsheet] created by August Detlefsen&lt;br /&gt;
* [29 June 2016] [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Version 3.0.1]] released!&lt;br /&gt;
* [9 Oct 2015] Version 3.0 released&lt;br /&gt;
* [20 May 2015] &amp;quot;First Cut&amp;quot; Version 3.0 released&lt;br /&gt;
* [11 Aug 2014] Version 2.0 released&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-flagship-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_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;
= Downloads =&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 3.0.1 '''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in English ==&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Spanish==&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Polish==&lt;br /&gt;
* [[Media:OWASP Application Security Verification Standard 3.0.1 PL.pdf|Download PDF - 1.5 MB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Persian==&lt;br /&gt;
* [[Media:OWASP ASVS 3.0.1 (Persian).pdf|Download PDF - 2.84 MB]]&lt;br /&gt;
&lt;br /&gt;
We are looking for translators for this version. If you can help us, please contact the project mail list!&lt;br /&gt;
&lt;br /&gt;
'''Legacy Application Security Verification Standard 3.0'''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0 in English ==&lt;br /&gt;
* [[Media:OWASPApplicationSecurityVerificationStandard3.0.pdf|download PDF - 1.2 MB]]&lt;br /&gt;
* [[Media:ASVS-excel.xlsx|ASVS 3.0 excel sheet  - 39 kB]]&lt;br /&gt;
&lt;br /&gt;
== Older versions ==&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 2.0 (final)'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.pdf|download PDF - 1.6 MB]])&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.docx|download Word - 1.0MB]])&lt;br /&gt;
* ASVS 2.0 in Persian ([[Media:OWASP_ASVS_Version_2_Persian.pdf|download PDF - 1.6MB]])&lt;br /&gt;
* ASVS 2.0 in Polish (checklist) ([[Media:Asvs_2_PL.xlsx|download Excel]])&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 1.0 - 2009'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.pdf|download PDF - 2.5 MB]])&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.doc|download Word - 2.3 MB]])&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
&lt;br /&gt;
== Volunteers ==&lt;br /&gt;
&lt;br /&gt;
=== Version 3 (2015) ===&lt;br /&gt;
&lt;br /&gt;
Project Leaders&lt;br /&gt;
&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
&lt;br /&gt;
Lead Author&lt;br /&gt;
*Jim Manico&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Boy Baukema &lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Colin Watson &lt;br /&gt;
*François-Eric Guyomarc’h&lt;br /&gt;
*Cristinel Dumitru &lt;br /&gt;
*James Holland&lt;br /&gt;
*Gary Robinson&lt;br /&gt;
*Stephen de Vries&lt;br /&gt;
*Glenn Ten Cate&lt;br /&gt;
*Riccardo Ten Cate&lt;br /&gt;
*Martin Knobloch&lt;br /&gt;
*Abhinav Sejpal&lt;br /&gt;
*David Ryan&lt;br /&gt;
*Steven van der Baan&lt;br /&gt;
*Ryan Dewhurst&lt;br /&gt;
*Raoul Endres&lt;br /&gt;
*Roberto Martelloni&lt;br /&gt;
&lt;br /&gt;
=== Version 2 (2014) ===&lt;br /&gt;
&lt;br /&gt;
Project leaders&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Krishna Raja&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Jerome Athias&lt;br /&gt;
*Boy Baukema&lt;br /&gt;
*Archangel Cuison&lt;br /&gt;
*Sebastien.Deleersnyder&lt;br /&gt;
*Antonio Fontes&lt;br /&gt;
*Evan Gaustad&lt;br /&gt;
*Safuat Hamdy&lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Scott Luc&lt;br /&gt;
*Jim Manico&lt;br /&gt;
*Mait Peekma&lt;br /&gt;
*Pekka Sillanpää&lt;br /&gt;
*Jeff Sergeant&lt;br /&gt;
*Etienne Stalmans&lt;br /&gt;
*Colin Watson&lt;br /&gt;
*Dr. Emin İslam Tatlı&lt;br /&gt;
&lt;br /&gt;
Translators&lt;br /&gt;
*Abbas Javan Jafari (Persian)&lt;br /&gt;
*Sajjad Pourali (Persian)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Version 2009 ===&lt;br /&gt;
&lt;br /&gt;
Project leader&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
*Jeff Williams&lt;br /&gt;
*Dave Wichers&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
&lt;br /&gt;
Pierre Parrend (OWASP Summer of Code), Andrew van der Stock, Nam Nguyen, John Martin, Gaurang Shah, Theodore Winograd, Stan Wisseman, Barry Boyd, Steve Coyle, Paul Douthit, Ken Huang, Dave Hausladen, Mandeep Khera Scott Matsumoto, John Steven, Stephen de Vries, Dan Cornell, Shouvik Bardhan, Dr. Sarbari Gupta, Eoin Keary, Richard Campbell, Matt Presson, Jeff LoSapio, Liz Fong, George Lawless, Dave van Stein, Terrie Diaz, Ketan Dilipkumar Vyas, Bedirhan Urgun, Dr. Thomas Braun, Colin Watson, Jeremiah Grossman.&lt;br /&gt;
&lt;br /&gt;
== OWASP Summer of Code 2008 ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Foundation sponsored the OWASP Application Security Verification Standard Project during the OWASP Summer of Code 2008.&lt;br /&gt;
&lt;br /&gt;
= Glossary =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''ASVS Terminology''' &lt;br /&gt;
&lt;br /&gt;
*'''Access Control''' – A means of restricting access to files, referenced functions, URLs, and data based on the identity of users and/or groups to which they belong. &lt;br /&gt;
*'''Application Component''' – An individual or group of source files, libraries, and/or executables, as defined by the verifier for a particular application. &lt;br /&gt;
*'''Application Security''' – Application-level security focuses on the analysis of components that comprise the application layer of the Open Systems Interconnection Reference Model (OSI Model), rather than focusing on for example the underlying operating system or connected networks. &lt;br /&gt;
*'''Application Security Verification''' – The technical assessment of an application against the OWASP ASVS. &lt;br /&gt;
*'''Application Security Verification Report''' – A report that documents the overall results and supporting analysis produced by the verifier for a particular application. &lt;br /&gt;
*'''Application Security Verification Standard (ASVS)''' – An OWASP standard that defines four levels of application security verification for applications. &lt;br /&gt;
*'''Authentication''' – The verification of the claimed identity of an application user. &lt;br /&gt;
*'''Automated Verification''' – The use of automated tools (either dynamic analysis tools, static analysis tools, or both) that use vulnerability signatures to find problems. &lt;br /&gt;
*'''Back Doors''' – A type of malicious code that allows unauthorized access to an application. &lt;br /&gt;
*'''Blacklist''' – A list of data or operations that are not permitted, for example a list of characters that are not allowed as input. &lt;br /&gt;
*'''Common Criteria (CC)''' – A multipart standard that can be used as the basis for the verification of the design and implementation of security controls in IT products. &lt;br /&gt;
*'''Communication Security''' – The protection of application data when it is transmitted between application components, between clients and servers, and between external systems and the application. &lt;br /&gt;
*'''Design Verification''' – The technical assessment of the security architecture of an application. &lt;br /&gt;
*'''Internal Verification''' – The technical assessment of specific aspects of the security architecture of an application as defined in the OWASP ASVS. &lt;br /&gt;
*'''Cryptographic module''' – Hardware, software, and/or firmware that implements cryptographic algorithms and/or generates cryptographic keys. &lt;br /&gt;
*'''Denial of Service (DOS) Attacks''' – The flooding of an application with more requests than it can handle. &lt;br /&gt;
*'''Dynamic Verification''' – The use of automated tools that use vulnerability signatures to find problems during the execution of an application. &lt;br /&gt;
*'''Easter Eggs''' – A type of malicious code that does not run until a specific user input event occurs. &lt;br /&gt;
*'''External Systems''' – A server-side application or service that is not part of the application. &lt;br /&gt;
*'''FIPS 140-2''' – A standard that can be used as the basis for the verification of the design and implementation of cryptographic modules &lt;br /&gt;
*'''Input Validation''' – The canonicalization and validation of untrusted user input. &lt;br /&gt;
*'''Malicious Code''' – Code introduced into an application during its development unbeknownst to the application owner which circumvents the application’s intended security policy. Not the same as malware such as a virus or worm! &lt;br /&gt;
*'''Malware''' – Executable code that is introduced into an application during runtime without the knowledge of the application user or administrator. &lt;br /&gt;
*'''Open Web Application Security Project (OWASP)''' – The Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. Our mission is to make application security &amp;quot;visible,&amp;quot; so that people and organizations can make informed decisions about application security risks. See: http://www.owasp.org/ &lt;br /&gt;
*'''Output Validation''' – The canonicalization and validation of application output to Web browsers and to external systems. &lt;br /&gt;
*'''OWASP Enterprise Security API (ESAPI)''' – A free and open collection of all the security methods that developers need to build secure Web applications. See: http://www.owasp.org/index.php/ESAPI &lt;br /&gt;
*'''OWASP Risk Rating Methodology''' – A risk rating methodology that has been customized for application security. See: http://www.owasp.org/index.php/How_to_value_the_real_risk &lt;br /&gt;
*'''OWASP Testing Guide''' – A document designed to help organizations understand what comprises a testing program, and to help them identify the steps needed to build and operate that testing program. See: http://www.owasp.org/index.php/Category:OWASP_Testing_Project &lt;br /&gt;
*'''OWASP Top Ten''' – A document that represents a broad consensus about what the most critical Web application security flaws are. See: http://www.owasp.org/index.php/Top10 &lt;br /&gt;
*'''Positive''' – See whitelist. &lt;br /&gt;
*'''Salami Attack''' – A type of malicious code that is used to redirect small amounts of money without detection in financial transactions. &lt;br /&gt;
*'''Security Architecture''' – An abstraction of an application’s design that identifies and describes where and how security controls are used, and also identifies and describes the location and sensitivity of both user and application data. &lt;br /&gt;
*'''Security Control''' – A function or component that performs a security check (e.g. an access control check) or when called results in a security effect (e.g. generating an audit record). &lt;br /&gt;
*'''Security Configuration''' – The runtime configuration of an application that affects how security controls are used. &lt;br /&gt;
*'''Static Verification''' – The use of automated tools that use vulnerability signatures to find problems in application source code. &lt;br /&gt;
*'''Target of Verification (TOV)''' – If you are performing an application security verification according to the OWASP ASVS requirements, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. &lt;br /&gt;
*'''Threat Modeling''' - A technique consisting of developing increasingly refined security architectures to identify threat agents, security zones, security controls, and important technical and business assets. &lt;br /&gt;
*'''Time Bomb''' – A type of malicious code that does not run until a preconfigured time or date elapses. &lt;br /&gt;
*'''Verifier''' - The person or team that is reviewing an application against the OWASP ASVS requirements. &lt;br /&gt;
*'''Whitelist''' – A list of permitted data or operations, for example a list of characters that are allowed to perform input validation.&lt;br /&gt;
&lt;br /&gt;
= ASVS Users  =&lt;br /&gt;
[[Image:Asvs-handshake.JPG]]&lt;br /&gt;
&lt;br /&gt;
A broad range of companies and agencies around the globe have added ASVS to their software assurance tool boxes, including [http://www.aspectsecurity.com Aspect Security], [http://www.astyran.com Astyran], [http://www.boozallen.com Booz Allen Hamilton], [http://casabasecurity.com Casaba Security], [http://www.cgi.com/web/en/industries/governments/us_federal/services_solutions.htm CGI Federal], [http://denimgroup.com Denim Group], [http://etebaran.com Etebaran Informatics], [http://www.mindedsecurity.com Minded Security], [http://www.nixu.com Nixu], [http://www.pstestware.com/ ps_testware], [http://www.proactiverisk.com Proactive Risk], [http://quince.co.uk Quince Associates Limited (SeeMyData)], [http://www.serpro.gov.br/ Serviço Federal de Processamento de Dados (SERPRO)], [http://www.udistrital.edu.co/ Universidad Distrital Francisco José de Caldas] Organizations listed are not accredited by OWASP. Neither their products or services have been endorsed by OWASP. Use of ASVS may include for example providing verification services using the standard. Use of ASVS may also include for example performing internal evaluation of products with the OWASP ASVS in mind, and NOT making any claims of meeting any given level in the standard. Please let us know how your organization is using OWASP ASVS. Include your name, organization's name, and brief description of how you use the standard. The project lead can be reached [mailto:sahba@securitycompass.com here].&lt;br /&gt;
&lt;br /&gt;
= Precedents-Interpretations =&lt;br /&gt;
&lt;br /&gt;
'''PI-0001: Are there levels between the levels?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: Are there levels between the levels for the cases where &amp;quot;The specification for an application may require OWASP ASVS Level N, but it could also include other additional detailed requirements such as from a higher ASVS level&amp;quot;? &lt;br /&gt;
*Resolution: No. Use of alternate level definitions or notations such as &amp;quot;ASVS Level 1B+&amp;quot; is discouraged. &lt;br /&gt;
*References: ASVS section &amp;quot;Application Security Verification Levels&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''PI-0002: Is use of a master key simply another level of indirection?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: If a master key is stored as plaintext, isn't using a master key simply another level of indirection? &lt;br /&gt;
*Resolution: No. There is a strong rationale for having a &amp;quot;master key&amp;quot; stored in a secure location that is used to encrypt all other secrets. In many applications, there are lots of secrets stored in many different locations. This greatly increases the likelihood that one of them will be compromised. Having a single master key makes managing the protection considerably simpler and is not simply a level of indirection. &lt;br /&gt;
*References: ASVS verification requirement V2.14&lt;br /&gt;
&lt;br /&gt;
'''PI-0003: What is a &amp;quot;TOV&amp;quot; or &amp;quot;Target of Verification&amp;quot;?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: New terminology &lt;br /&gt;
*Resolution: If you are performing an application security verification according to ASVS, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. The TOV should be identified in verification documentation as follows: &lt;br /&gt;
**TOV Identification – &amp;amp;lt;name and version of the application&amp;amp;gt; or &amp;amp;lt;Application name&amp;amp;gt;, &amp;amp;lt;application version&amp;amp;gt;, dynamic testing was performed in a staging environment, not the production environment &lt;br /&gt;
**TOV Developer – &amp;amp;lt;insert name of the developer or verification customer&amp;amp;gt; &lt;br /&gt;
*References: ASVS section &amp;quot;Approach&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Internationalization =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]&lt;br /&gt;
If you can help with translations, please download the latest draft here:&lt;br /&gt;
&lt;br /&gt;
https://github.com/OWASP/ASVS&lt;br /&gt;
&lt;br /&gt;
If there are any incomprehensible English idiom or phrases in there, please don't hesitate to ask for clarification, because if it's hard to translate, it's almost certainly wrong in English as well. We recommend logging translation issues in GitHub, too, so please make yourself known. &lt;br /&gt;
&lt;br /&gt;
Translations are coordinated through OWASP's Crowd In account, so you don't have to do the entire thing yourself. &lt;br /&gt;
&lt;br /&gt;
https://crowdin.com/project/owasp-asvs/&lt;br /&gt;
&lt;br /&gt;
You don't HAVE to use Crowd In, but it would be nice to indicate to other native speakers of your language that you are willing to work together. This is a 70 page document, and in all honesty, will take a dedicated person a week or more to translate, so please please please work together rather than apart. You have full access to the original document and the original images, so you have everything I have.&lt;br /&gt;
&lt;br /&gt;
= Archive - Previous Version =&lt;br /&gt;
&lt;br /&gt;
'''*Please note that ASVS is currently on version 3.0.  The information on this page is for archival purposes only.*'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step1.jpg]]'1. About ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*Video presentation in English [https://www.youtube.com/watch?v=Ba6ncpIfaJA (YouTube)] &lt;br /&gt;
*ASVS vs. WASC et al [http://www.owasp.org/index.php/ASVS_vs_WASC_Et_Al (Wiki)]&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'2. Get ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS in Bahasa Indonesia (Indonesian language) ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-id.pdf PDF])&lt;br /&gt;
*ASVS in Bahasa Malaysia (Malay) (Currently under development!)&lt;br /&gt;
*ASVS in Chinese(Currently under development!) &lt;br /&gt;
*ASVS in English ([http://www.owasp.org/images/4/4e/OWASP_ASVS_2009_Web_App_Std_Release.pdf PDF], [http://www.owasp.org/images/3/35/OWASP_ASVS_2009_Web_App_Std_Release.doc Word], [http://code.google.com/p/owasp-asvs/wiki/ASVS '''Online'''], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-xml.zip XML]) &lt;br /&gt;
*ASVS in French ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.odt OpenOffice]) &lt;br /&gt;
*ASVS in German ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.doc Word])&lt;br /&gt;
*ASVS in Hungarian (Currently under development!) &lt;br /&gt;
*ASVS in Japanese ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.doc Word]) &lt;br /&gt;
*ASVS in Persian (Farsi) ([http://abiusx.com/archive/document/OWASP-ASVS-fa-20111115.pdf PDF]) beta 0.7&lt;br /&gt;
*ASVS in Polish ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pl.pdf PDF])&lt;br /&gt;
*ASVS in Portuguese-Brazil ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pt-br.pdf PDF])&lt;br /&gt;
*ASVS in Spanish (Currently under development!)&lt;br /&gt;
*ASVS in Thai (Currently under development!)&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'3. Learn ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS Article: Getting Started Using ASVS ([http://www.owasp.org/images/f/f8/OWASP_ASVS_Article_-_Getting_Started_Using_ASVS.pdf PDF]) &lt;br /&gt;
*ASVS Article: Code Reviews and Other Verification Activities: USELESS Unless Acted Upon IMMEDIATELY [http://www.owasp.org/index.php/Code_Reviews_and_Other_Verification_Activities:_USELESS_Unless_Acted_Upon_IMMEDIATELY (Wiki)] &lt;br /&gt;
*ASVS Article: Agile Software Development: Don't Forget EVIL User Stories ([http://www.owasp.org/index.php/Agile_Software_Development:_Don%27t_Forget_EVIL_User_Stories Wiki]) &lt;br /&gt;
*ASVS Article: Man vs. Code ([http://www.owasp.org/index.php/Man_vs._Code Wiki]) &lt;br /&gt;
*ASVS Article: Getting started designing for a level of assurance ([http://www.owasp.org/images/0/01/Getting_started_designing_for_a_level_of_assurance.pdf PDF]) &lt;br /&gt;
*ASVS Template: Sample verification fee schedule template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel]) &lt;br /&gt;
*ASVS Template: Sample verification report template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Report_Template.doc Word]) &lt;br /&gt;
*ASVS Training: An ASVS training presentation ([http://www.owasp.org/index.php/Image:OWASP_AU_Secure_Architecture_and_Coding.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Executive-Level Presentation ([http://www.owasp.org/images/9/99/About_OWASP_ASVS_Executive_Presentation.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Presentation Abstract ([http://www.owasp.org/images/1/10/OWASP_ASVS_Presentation_Abstract.doc Word]) &lt;br /&gt;
*Articles [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project#Articles_Below_-_More_About_ASVS_and_Using_It (More About ASVS and Using It)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP_Project|Application Security Verification Standard Project]]&lt;br /&gt;
[[Category:OWASP_Document]]&lt;br /&gt;
[[Category:OWASP_Download]]&lt;br /&gt;
[[Category:OWASP_Release_Quality_Document|OWASP Stable Quality Document]]&lt;br /&gt;
[[Category:SAMM-CR-1]]&lt;br /&gt;
[[Category:SAMM-DR-2]]&lt;br /&gt;
[[Category:SAMM-ST-3]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246338</id>
		<title>Category:OWASP Application Security Verification Standard Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246338"/>
				<updated>2019-01-02T22:28:04Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* OWASP ASVS 4.0 will be released in early 2019 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Home =&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:90px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File: flagship_big.jpg|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_Projects]]&amp;lt;/div&amp;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;
== What is ASVS? ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Application Security Verification Standard (ASVS) Project provides a basis for testing web application technical security controls and also provides developers with a list of requirements for secure development.&lt;br /&gt;
&lt;br /&gt;
The primary aim of the '''OWASP Application Security Verification Standard (ASVS) Project''' is to normalize the range in the coverage and level of rigor available in the market when it comes to performing Web application security verification using a commercially-workable open standard. The standard provides a basis for testing application technical security controls, as well as any technical security controls in the environment, that are relied on to protect against vulnerabilities such as Cross-Site Scripting (XSS) and SQL injection. This standard can be used to establish a level of confidence in the security of Web applications. The requirements were developed with the following objectives in mind: &lt;br /&gt;
&lt;br /&gt;
*'''Use as a metric''' - Provide application developers and application owners with a yardstick with which to assess the degree of trust that can be placed in their Web applications, &lt;br /&gt;
*'''Use as guidance''' - Provide guidance to security control developers as to what to build into security controls in order to satisfy application security requirements, and &lt;br /&gt;
*'''Use during procurement''' - Provide a basis for specifying application security verification requirements in contracts.&lt;br /&gt;
&lt;br /&gt;
== OWASP ASVS 4.0 will be released in early 2019 ==&lt;br /&gt;
&lt;br /&gt;
Please note there will &amp;lt;b&amp;gt;not be a 3.1 release&amp;lt;/b&amp;gt; and we will be going directly from &amp;lt;b&amp;gt;ASVS 3.0.1 to 4.0 in February 2019&amp;lt;/b&amp;gt;!&lt;br /&gt;
&lt;br /&gt;
== Email List ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]] [https://lists.owasp.org/mailman/listinfo/owasp-application-security-verification-standard Project Email List]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
Daniel Cuthbert [mailto:Daniel.Cuthbert@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Andrew van der Stock [mailto:vanderaj@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico [mailto:jim.manico@owasp.org @]&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
*[https://www.owasp.org/index.php/OWASP_Proactive_Controls OWASP Top Ten Proactive Controls (2016)]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project OWASP Top Ten Risks (2013)] &lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Guide_Project OWASP Development Guide] &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;
ASVS 3.0.1 in English.&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
&lt;br /&gt;
* [9 March 2018] [https://docs.google.com/spreadsheets/d/1ic7gsib--Cn4ujrA8rhvzuUmMFpQ2Jkl96SZDCEtqJg/edit?ts=5a6bafe1#gid=950526877 OWASP Application Security Verification Standard 3.1 Spreadsheet] created by August Detlefsen&lt;br /&gt;
* [29 June 2016] [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Version 3.0.1]] released!&lt;br /&gt;
* [9 Oct 2015] Version 3.0 released&lt;br /&gt;
* [20 May 2015] &amp;quot;First Cut&amp;quot; Version 3.0 released&lt;br /&gt;
* [11 Aug 2014] Version 2.0 released&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-flagship-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_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;
= Downloads =&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 3.0.1 '''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in English ==&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Spanish==&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Polish==&lt;br /&gt;
* [[Media:OWASP Application Security Verification Standard 3.0.1 PL.pdf|Download PDF - 1.5 MB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Persian==&lt;br /&gt;
* [[Media:OWASP ASVS 3.0.1 (Persian).pdf|Download PDF - 2.84 MB]]&lt;br /&gt;
&lt;br /&gt;
We are looking for translators for this version. If you can help us, please contact the project mail list!&lt;br /&gt;
&lt;br /&gt;
'''Legacy Application Security Verification Standard 3.0'''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0 in English ==&lt;br /&gt;
* [[Media:OWASPApplicationSecurityVerificationStandard3.0.pdf|download PDF - 1.2 MB]]&lt;br /&gt;
* [[Media:ASVS-excel.xlsx|ASVS 3.0 excel sheet  - 39 kB]]&lt;br /&gt;
&lt;br /&gt;
== Older versions ==&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 2.0 (final)'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.pdf|download PDF - 1.6 MB]])&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.docx|download Word - 1.0MB]])&lt;br /&gt;
* ASVS 2.0 in Persian ([[Media:OWASP_ASVS_Version_2_Persian.pdf|download PDF - 1.6MB]])&lt;br /&gt;
* ASVS 2.0 in Polish (checklist) ([[Media:Asvs_2_PL.xlsx|download Excel]])&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 1.0 - 2009'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.pdf|download PDF - 2.5 MB]])&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.doc|download Word - 2.3 MB]])&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
&lt;br /&gt;
== Volunteers ==&lt;br /&gt;
&lt;br /&gt;
=== Version 3 (2015) ===&lt;br /&gt;
&lt;br /&gt;
Project Leaders&lt;br /&gt;
&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
&lt;br /&gt;
Lead Author&lt;br /&gt;
*Jim Manico&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Boy Baukema &lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Colin Watson &lt;br /&gt;
*François-Eric Guyomarc’h&lt;br /&gt;
*Cristinel Dumitru &lt;br /&gt;
*James Holland&lt;br /&gt;
*Gary Robinson&lt;br /&gt;
*Stephen de Vries&lt;br /&gt;
*Glenn Ten Cate&lt;br /&gt;
*Riccardo Ten Cate&lt;br /&gt;
*Martin Knobloch&lt;br /&gt;
*Abhinav Sejpal&lt;br /&gt;
*David Ryan&lt;br /&gt;
*Steven van der Baan&lt;br /&gt;
*Ryan Dewhurst&lt;br /&gt;
*Raoul Endres&lt;br /&gt;
*Roberto Martelloni&lt;br /&gt;
&lt;br /&gt;
=== Version 2 (2014) ===&lt;br /&gt;
&lt;br /&gt;
Project leaders&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Krishna Raja&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Jerome Athias&lt;br /&gt;
*Boy Baukema&lt;br /&gt;
*Archangel Cuison&lt;br /&gt;
*Sebastien.Deleersnyder&lt;br /&gt;
*Antonio Fontes&lt;br /&gt;
*Evan Gaustad&lt;br /&gt;
*Safuat Hamdy&lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Scott Luc&lt;br /&gt;
*Jim Manico&lt;br /&gt;
*Mait Peekma&lt;br /&gt;
*Pekka Sillanpää&lt;br /&gt;
*Jeff Sergeant&lt;br /&gt;
*Etienne Stalmans&lt;br /&gt;
*Colin Watson&lt;br /&gt;
*Dr. Emin İslam Tatlı&lt;br /&gt;
&lt;br /&gt;
Translators&lt;br /&gt;
*Abbas Javan Jafari (Persian)&lt;br /&gt;
*Sajjad Pourali (Persian)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Version 2009 ===&lt;br /&gt;
&lt;br /&gt;
Project leader&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
*Jeff Williams&lt;br /&gt;
*Dave Wichers&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
&lt;br /&gt;
Pierre Parrend (OWASP Summer of Code), Andrew van der Stock, Nam Nguyen, John Martin, Gaurang Shah, Theodore Winograd, Stan Wisseman, Barry Boyd, Steve Coyle, Paul Douthit, Ken Huang, Dave Hausladen, Mandeep Khera Scott Matsumoto, John Steven, Stephen de Vries, Dan Cornell, Shouvik Bardhan, Dr. Sarbari Gupta, Eoin Keary, Richard Campbell, Matt Presson, Jeff LoSapio, Liz Fong, George Lawless, Dave van Stein, Terrie Diaz, Ketan Dilipkumar Vyas, Bedirhan Urgun, Dr. Thomas Braun, Colin Watson, Jeremiah Grossman.&lt;br /&gt;
&lt;br /&gt;
== OWASP Summer of Code 2008 ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Foundation sponsored the OWASP Application Security Verification Standard Project during the OWASP Summer of Code 2008.&lt;br /&gt;
&lt;br /&gt;
= Glossary =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''ASVS Terminology''' &lt;br /&gt;
&lt;br /&gt;
*'''Access Control''' – A means of restricting access to files, referenced functions, URLs, and data based on the identity of users and/or groups to which they belong. &lt;br /&gt;
*'''Application Component''' – An individual or group of source files, libraries, and/or executables, as defined by the verifier for a particular application. &lt;br /&gt;
*'''Application Security''' – Application-level security focuses on the analysis of components that comprise the application layer of the Open Systems Interconnection Reference Model (OSI Model), rather than focusing on for example the underlying operating system or connected networks. &lt;br /&gt;
*'''Application Security Verification''' – The technical assessment of an application against the OWASP ASVS. &lt;br /&gt;
*'''Application Security Verification Report''' – A report that documents the overall results and supporting analysis produced by the verifier for a particular application. &lt;br /&gt;
*'''Application Security Verification Standard (ASVS)''' – An OWASP standard that defines four levels of application security verification for applications. &lt;br /&gt;
*'''Authentication''' – The verification of the claimed identity of an application user. &lt;br /&gt;
*'''Automated Verification''' – The use of automated tools (either dynamic analysis tools, static analysis tools, or both) that use vulnerability signatures to find problems. &lt;br /&gt;
*'''Back Doors''' – A type of malicious code that allows unauthorized access to an application. &lt;br /&gt;
*'''Blacklist''' – A list of data or operations that are not permitted, for example a list of characters that are not allowed as input. &lt;br /&gt;
*'''Common Criteria (CC)''' – A multipart standard that can be used as the basis for the verification of the design and implementation of security controls in IT products. &lt;br /&gt;
*'''Communication Security''' – The protection of application data when it is transmitted between application components, between clients and servers, and between external systems and the application. &lt;br /&gt;
*'''Design Verification''' – The technical assessment of the security architecture of an application. &lt;br /&gt;
*'''Internal Verification''' – The technical assessment of specific aspects of the security architecture of an application as defined in the OWASP ASVS. &lt;br /&gt;
*'''Cryptographic module''' – Hardware, software, and/or firmware that implements cryptographic algorithms and/or generates cryptographic keys. &lt;br /&gt;
*'''Denial of Service (DOS) Attacks''' – The flooding of an application with more requests than it can handle. &lt;br /&gt;
*'''Dynamic Verification''' – The use of automated tools that use vulnerability signatures to find problems during the execution of an application. &lt;br /&gt;
*'''Easter Eggs''' – A type of malicious code that does not run until a specific user input event occurs. &lt;br /&gt;
*'''External Systems''' – A server-side application or service that is not part of the application. &lt;br /&gt;
*'''FIPS 140-2''' – A standard that can be used as the basis for the verification of the design and implementation of cryptographic modules &lt;br /&gt;
*'''Input Validation''' – The canonicalization and validation of untrusted user input. &lt;br /&gt;
*'''Malicious Code''' – Code introduced into an application during its development unbeknownst to the application owner which circumvents the application’s intended security policy. Not the same as malware such as a virus or worm! &lt;br /&gt;
*'''Malware''' – Executable code that is introduced into an application during runtime without the knowledge of the application user or administrator. &lt;br /&gt;
*'''Open Web Application Security Project (OWASP)''' – The Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. Our mission is to make application security &amp;quot;visible,&amp;quot; so that people and organizations can make informed decisions about application security risks. See: http://www.owasp.org/ &lt;br /&gt;
*'''Output Validation''' – The canonicalization and validation of application output to Web browsers and to external systems. &lt;br /&gt;
*'''OWASP Enterprise Security API (ESAPI)''' – A free and open collection of all the security methods that developers need to build secure Web applications. See: http://www.owasp.org/index.php/ESAPI &lt;br /&gt;
*'''OWASP Risk Rating Methodology''' – A risk rating methodology that has been customized for application security. See: http://www.owasp.org/index.php/How_to_value_the_real_risk &lt;br /&gt;
*'''OWASP Testing Guide''' – A document designed to help organizations understand what comprises a testing program, and to help them identify the steps needed to build and operate that testing program. See: http://www.owasp.org/index.php/Category:OWASP_Testing_Project &lt;br /&gt;
*'''OWASP Top Ten''' – A document that represents a broad consensus about what the most critical Web application security flaws are. See: http://www.owasp.org/index.php/Top10 &lt;br /&gt;
*'''Positive''' – See whitelist. &lt;br /&gt;
*'''Salami Attack''' – A type of malicious code that is used to redirect small amounts of money without detection in financial transactions. &lt;br /&gt;
*'''Security Architecture''' – An abstraction of an application’s design that identifies and describes where and how security controls are used, and also identifies and describes the location and sensitivity of both user and application data. &lt;br /&gt;
*'''Security Control''' – A function or component that performs a security check (e.g. an access control check) or when called results in a security effect (e.g. generating an audit record). &lt;br /&gt;
*'''Security Configuration''' – The runtime configuration of an application that affects how security controls are used. &lt;br /&gt;
*'''Static Verification''' – The use of automated tools that use vulnerability signatures to find problems in application source code. &lt;br /&gt;
*'''Target of Verification (TOV)''' – If you are performing an application security verification according to the OWASP ASVS requirements, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. &lt;br /&gt;
*'''Threat Modeling''' - A technique consisting of developing increasingly refined security architectures to identify threat agents, security zones, security controls, and important technical and business assets. &lt;br /&gt;
*'''Time Bomb''' – A type of malicious code that does not run until a preconfigured time or date elapses. &lt;br /&gt;
*'''Verifier''' - The person or team that is reviewing an application against the OWASP ASVS requirements. &lt;br /&gt;
*'''Whitelist''' – A list of permitted data or operations, for example a list of characters that are allowed to perform input validation.&lt;br /&gt;
&lt;br /&gt;
= ASVS Users  =&lt;br /&gt;
[[Image:Asvs-handshake.JPG]]&lt;br /&gt;
&lt;br /&gt;
A broad range of companies and agencies around the globe have added ASVS to their software assurance tool boxes, including [http://www.aspectsecurity.com Aspect Security], [http://www.astyran.com Astyran], [http://www.boozallen.com Booz Allen Hamilton], [http://casabasecurity.com Casaba Security], [http://www.cgi.com/web/en/industries/governments/us_federal/services_solutions.htm CGI Federal], [http://denimgroup.com Denim Group], [http://etebaran.com Etebaran Informatics], [http://www.mindedsecurity.com Minded Security], [http://www.nixu.com Nixu], [http://www.pstestware.com/ ps_testware], [http://www.proactiverisk.com Proactive Risk], [http://quince.co.uk Quince Associates Limited (SeeMyData)], [http://www.serpro.gov.br/ Serviço Federal de Processamento de Dados (SERPRO)], [http://www.udistrital.edu.co/ Universidad Distrital Francisco José de Caldas] Organizations listed are not accredited by OWASP. Neither their products or services have been endorsed by OWASP. Use of ASVS may include for example providing verification services using the standard. Use of ASVS may also include for example performing internal evaluation of products with the OWASP ASVS in mind, and NOT making any claims of meeting any given level in the standard. Please let us know how your organization is using OWASP ASVS. Include your name, organization's name, and brief description of how you use the standard. The project lead can be reached [mailto:sahba@securitycompass.com here].&lt;br /&gt;
&lt;br /&gt;
= Precedents-Interpretations =&lt;br /&gt;
&lt;br /&gt;
'''PI-0001: Are there levels between the levels?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: Are there levels between the levels for the cases where &amp;quot;The specification for an application may require OWASP ASVS Level N, but it could also include other additional detailed requirements such as from a higher ASVS level&amp;quot;? &lt;br /&gt;
*Resolution: No. Use of alternate level definitions or notations such as &amp;quot;ASVS Level 1B+&amp;quot; is discouraged. &lt;br /&gt;
*References: ASVS section &amp;quot;Application Security Verification Levels&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''PI-0002: Is use of a master key simply another level of indirection?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: If a master key is stored as plaintext, isn't using a master key simply another level of indirection? &lt;br /&gt;
*Resolution: No. There is a strong rationale for having a &amp;quot;master key&amp;quot; stored in a secure location that is used to encrypt all other secrets. In many applications, there are lots of secrets stored in many different locations. This greatly increases the likelihood that one of them will be compromised. Having a single master key makes managing the protection considerably simpler and is not simply a level of indirection. &lt;br /&gt;
*References: ASVS verification requirement V2.14&lt;br /&gt;
&lt;br /&gt;
'''PI-0003: What is a &amp;quot;TOV&amp;quot; or &amp;quot;Target of Verification&amp;quot;?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: New terminology &lt;br /&gt;
*Resolution: If you are performing an application security verification according to ASVS, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. The TOV should be identified in verification documentation as follows: &lt;br /&gt;
**TOV Identification – &amp;amp;lt;name and version of the application&amp;amp;gt; or &amp;amp;lt;Application name&amp;amp;gt;, &amp;amp;lt;application version&amp;amp;gt;, dynamic testing was performed in a staging environment, not the production environment &lt;br /&gt;
**TOV Developer – &amp;amp;lt;insert name of the developer or verification customer&amp;amp;gt; &lt;br /&gt;
*References: ASVS section &amp;quot;Approach&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Internationalization =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]&lt;br /&gt;
If you can help with translations, please download the latest draft here:&lt;br /&gt;
&lt;br /&gt;
https://github.com/OWASP/ASVS&lt;br /&gt;
&lt;br /&gt;
If there are any incomprehensible English idiom or phrases in there, please don't hesitate to ask for clarification, because if it's hard to translate, it's almost certainly wrong in English as well. We recommend logging translation issues in GitHub, too, so please make yourself known. &lt;br /&gt;
&lt;br /&gt;
Translations are coordinated through OWASP's Crowd In account, so you don't have to do the entire thing yourself. &lt;br /&gt;
&lt;br /&gt;
https://crowdin.com/project/owasp-asvs/&lt;br /&gt;
&lt;br /&gt;
You don't HAVE to use Crowd In, but it would be nice to indicate to other native speakers of your language that you are willing to work together. This is a 70 page document, and in all honesty, will take a dedicated person a week or more to translate, so please please please work together rather than apart. You have full access to the original document and the original images, so you have everything I have.&lt;br /&gt;
&lt;br /&gt;
= Archive - Previous Version =&lt;br /&gt;
&lt;br /&gt;
'''*Please note that ASVS is currently on version 3.0.  The information on this page is for archival purposes only.*'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step1.jpg]]'1. About ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*Video presentation in English [https://www.youtube.com/watch?v=Ba6ncpIfaJA (YouTube)] &lt;br /&gt;
*ASVS vs. WASC et al [http://www.owasp.org/index.php/ASVS_vs_WASC_Et_Al (Wiki)]&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'2. Get ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS in Bahasa Indonesia (Indonesian language) ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-id.pdf PDF])&lt;br /&gt;
*ASVS in Bahasa Malaysia (Malay) (Currently under development!)&lt;br /&gt;
*ASVS in Chinese(Currently under development!) &lt;br /&gt;
*ASVS in English ([http://www.owasp.org/images/4/4e/OWASP_ASVS_2009_Web_App_Std_Release.pdf PDF], [http://www.owasp.org/images/3/35/OWASP_ASVS_2009_Web_App_Std_Release.doc Word], [http://code.google.com/p/owasp-asvs/wiki/ASVS '''Online'''], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-xml.zip XML]) &lt;br /&gt;
*ASVS in French ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.odt OpenOffice]) &lt;br /&gt;
*ASVS in German ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.doc Word])&lt;br /&gt;
*ASVS in Hungarian (Currently under development!) &lt;br /&gt;
*ASVS in Japanese ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.doc Word]) &lt;br /&gt;
*ASVS in Persian (Farsi) ([http://abiusx.com/archive/document/OWASP-ASVS-fa-20111115.pdf PDF]) beta 0.7&lt;br /&gt;
*ASVS in Polish ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pl.pdf PDF])&lt;br /&gt;
*ASVS in Portuguese-Brazil ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pt-br.pdf PDF])&lt;br /&gt;
*ASVS in Spanish (Currently under development!)&lt;br /&gt;
*ASVS in Thai (Currently under development!)&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'3. Learn ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS Article: Getting Started Using ASVS ([http://www.owasp.org/images/f/f8/OWASP_ASVS_Article_-_Getting_Started_Using_ASVS.pdf PDF]) &lt;br /&gt;
*ASVS Article: Code Reviews and Other Verification Activities: USELESS Unless Acted Upon IMMEDIATELY [http://www.owasp.org/index.php/Code_Reviews_and_Other_Verification_Activities:_USELESS_Unless_Acted_Upon_IMMEDIATELY (Wiki)] &lt;br /&gt;
*ASVS Article: Agile Software Development: Don't Forget EVIL User Stories ([http://www.owasp.org/index.php/Agile_Software_Development:_Don%27t_Forget_EVIL_User_Stories Wiki]) &lt;br /&gt;
*ASVS Article: Man vs. Code ([http://www.owasp.org/index.php/Man_vs._Code Wiki]) &lt;br /&gt;
*ASVS Article: Getting started designing for a level of assurance ([http://www.owasp.org/images/0/01/Getting_started_designing_for_a_level_of_assurance.pdf PDF]) &lt;br /&gt;
*ASVS Template: Sample verification fee schedule template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel]) &lt;br /&gt;
*ASVS Template: Sample verification report template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Report_Template.doc Word]) &lt;br /&gt;
*ASVS Training: An ASVS training presentation ([http://www.owasp.org/index.php/Image:OWASP_AU_Secure_Architecture_and_Coding.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Executive-Level Presentation ([http://www.owasp.org/images/9/99/About_OWASP_ASVS_Executive_Presentation.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Presentation Abstract ([http://www.owasp.org/images/1/10/OWASP_ASVS_Presentation_Abstract.doc Word]) &lt;br /&gt;
*Articles [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project#Articles_Below_-_More_About_ASVS_and_Using_It (More About ASVS and Using It)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP_Project|Application Security Verification Standard Project]]&lt;br /&gt;
[[Category:OWASP_Document]]&lt;br /&gt;
[[Category:OWASP_Download]]&lt;br /&gt;
[[Category:OWASP_Release_Quality_Document|OWASP Stable Quality Document]]&lt;br /&gt;
[[Category:SAMM-CR-1]]&lt;br /&gt;
[[Category:SAMM-DR-2]]&lt;br /&gt;
[[Category:SAMM-ST-3]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246337</id>
		<title>Category:OWASP Application Security Verification Standard Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=246337"/>
				<updated>2019-01-02T22:27:46Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: /* OWASP ASVS 4.0 will be released in late 2018 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Home =&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:90px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File: flagship_big.jpg|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_Projects]]&amp;lt;/div&amp;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;
== What is ASVS? ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Application Security Verification Standard (ASVS) Project provides a basis for testing web application technical security controls and also provides developers with a list of requirements for secure development.&lt;br /&gt;
&lt;br /&gt;
The primary aim of the '''OWASP Application Security Verification Standard (ASVS) Project''' is to normalize the range in the coverage and level of rigor available in the market when it comes to performing Web application security verification using a commercially-workable open standard. The standard provides a basis for testing application technical security controls, as well as any technical security controls in the environment, that are relied on to protect against vulnerabilities such as Cross-Site Scripting (XSS) and SQL injection. This standard can be used to establish a level of confidence in the security of Web applications. The requirements were developed with the following objectives in mind: &lt;br /&gt;
&lt;br /&gt;
*'''Use as a metric''' - Provide application developers and application owners with a yardstick with which to assess the degree of trust that can be placed in their Web applications, &lt;br /&gt;
*'''Use as guidance''' - Provide guidance to security control developers as to what to build into security controls in order to satisfy application security requirements, and &lt;br /&gt;
*'''Use during procurement''' - Provide a basis for specifying application security verification requirements in contracts.&lt;br /&gt;
&lt;br /&gt;
== OWASP ASVS 4.0 will be released in early 2019 ==&lt;br /&gt;
&lt;br /&gt;
Please note there will &amp;lt;b&amp;gt;not be a 3.1 release&amp;lt;/b&amp;gt; and we will be going directly from ASVS 3.0.1 to 4.0 in February 2019!&lt;br /&gt;
&lt;br /&gt;
== Email List ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]] [https://lists.owasp.org/mailman/listinfo/owasp-application-security-verification-standard Project Email List]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
Daniel Cuthbert [mailto:Daniel.Cuthbert@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Andrew van der Stock [mailto:vanderaj@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico [mailto:jim.manico@owasp.org @]&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
*[https://www.owasp.org/index.php/OWASP_Proactive_Controls OWASP Top Ten Proactive Controls (2016)]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project OWASP Top Ten Risks (2013)] &lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Guide_Project OWASP Development Guide] &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;
ASVS 3.0.1 in English.&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
&lt;br /&gt;
* [9 March 2018] [https://docs.google.com/spreadsheets/d/1ic7gsib--Cn4ujrA8rhvzuUmMFpQ2Jkl96SZDCEtqJg/edit?ts=5a6bafe1#gid=950526877 OWASP Application Security Verification Standard 3.1 Spreadsheet] created by August Detlefsen&lt;br /&gt;
* [29 June 2016] [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Version 3.0.1]] released!&lt;br /&gt;
* [9 Oct 2015] Version 3.0 released&lt;br /&gt;
* [20 May 2015] &amp;quot;First Cut&amp;quot; Version 3.0 released&lt;br /&gt;
* [11 Aug 2014] Version 2.0 released&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-flagship-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_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;
= Downloads =&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 3.0.1 '''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in English ==&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Spanish==&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Polish==&lt;br /&gt;
* [[Media:OWASP Application Security Verification Standard 3.0.1 PL.pdf|Download PDF - 1.5 MB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Persian==&lt;br /&gt;
* [[Media:OWASP ASVS 3.0.1 (Persian).pdf|Download PDF - 2.84 MB]]&lt;br /&gt;
&lt;br /&gt;
We are looking for translators for this version. If you can help us, please contact the project mail list!&lt;br /&gt;
&lt;br /&gt;
'''Legacy Application Security Verification Standard 3.0'''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0 in English ==&lt;br /&gt;
* [[Media:OWASPApplicationSecurityVerificationStandard3.0.pdf|download PDF - 1.2 MB]]&lt;br /&gt;
* [[Media:ASVS-excel.xlsx|ASVS 3.0 excel sheet  - 39 kB]]&lt;br /&gt;
&lt;br /&gt;
== Older versions ==&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 2.0 (final)'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.pdf|download PDF - 1.6 MB]])&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.docx|download Word - 1.0MB]])&lt;br /&gt;
* ASVS 2.0 in Persian ([[Media:OWASP_ASVS_Version_2_Persian.pdf|download PDF - 1.6MB]])&lt;br /&gt;
* ASVS 2.0 in Polish (checklist) ([[Media:Asvs_2_PL.xlsx|download Excel]])&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 1.0 - 2009'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.pdf|download PDF - 2.5 MB]])&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.doc|download Word - 2.3 MB]])&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
&lt;br /&gt;
== Volunteers ==&lt;br /&gt;
&lt;br /&gt;
=== Version 3 (2015) ===&lt;br /&gt;
&lt;br /&gt;
Project Leaders&lt;br /&gt;
&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
&lt;br /&gt;
Lead Author&lt;br /&gt;
*Jim Manico&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Boy Baukema &lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Colin Watson &lt;br /&gt;
*François-Eric Guyomarc’h&lt;br /&gt;
*Cristinel Dumitru &lt;br /&gt;
*James Holland&lt;br /&gt;
*Gary Robinson&lt;br /&gt;
*Stephen de Vries&lt;br /&gt;
*Glenn Ten Cate&lt;br /&gt;
*Riccardo Ten Cate&lt;br /&gt;
*Martin Knobloch&lt;br /&gt;
*Abhinav Sejpal&lt;br /&gt;
*David Ryan&lt;br /&gt;
*Steven van der Baan&lt;br /&gt;
*Ryan Dewhurst&lt;br /&gt;
*Raoul Endres&lt;br /&gt;
*Roberto Martelloni&lt;br /&gt;
&lt;br /&gt;
=== Version 2 (2014) ===&lt;br /&gt;
&lt;br /&gt;
Project leaders&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Krishna Raja&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Jerome Athias&lt;br /&gt;
*Boy Baukema&lt;br /&gt;
*Archangel Cuison&lt;br /&gt;
*Sebastien.Deleersnyder&lt;br /&gt;
*Antonio Fontes&lt;br /&gt;
*Evan Gaustad&lt;br /&gt;
*Safuat Hamdy&lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Scott Luc&lt;br /&gt;
*Jim Manico&lt;br /&gt;
*Mait Peekma&lt;br /&gt;
*Pekka Sillanpää&lt;br /&gt;
*Jeff Sergeant&lt;br /&gt;
*Etienne Stalmans&lt;br /&gt;
*Colin Watson&lt;br /&gt;
*Dr. Emin İslam Tatlı&lt;br /&gt;
&lt;br /&gt;
Translators&lt;br /&gt;
*Abbas Javan Jafari (Persian)&lt;br /&gt;
*Sajjad Pourali (Persian)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Version 2009 ===&lt;br /&gt;
&lt;br /&gt;
Project leader&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
*Jeff Williams&lt;br /&gt;
*Dave Wichers&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
&lt;br /&gt;
Pierre Parrend (OWASP Summer of Code), Andrew van der Stock, Nam Nguyen, John Martin, Gaurang Shah, Theodore Winograd, Stan Wisseman, Barry Boyd, Steve Coyle, Paul Douthit, Ken Huang, Dave Hausladen, Mandeep Khera Scott Matsumoto, John Steven, Stephen de Vries, Dan Cornell, Shouvik Bardhan, Dr. Sarbari Gupta, Eoin Keary, Richard Campbell, Matt Presson, Jeff LoSapio, Liz Fong, George Lawless, Dave van Stein, Terrie Diaz, Ketan Dilipkumar Vyas, Bedirhan Urgun, Dr. Thomas Braun, Colin Watson, Jeremiah Grossman.&lt;br /&gt;
&lt;br /&gt;
== OWASP Summer of Code 2008 ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Foundation sponsored the OWASP Application Security Verification Standard Project during the OWASP Summer of Code 2008.&lt;br /&gt;
&lt;br /&gt;
= Glossary =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''ASVS Terminology''' &lt;br /&gt;
&lt;br /&gt;
*'''Access Control''' – A means of restricting access to files, referenced functions, URLs, and data based on the identity of users and/or groups to which they belong. &lt;br /&gt;
*'''Application Component''' – An individual or group of source files, libraries, and/or executables, as defined by the verifier for a particular application. &lt;br /&gt;
*'''Application Security''' – Application-level security focuses on the analysis of components that comprise the application layer of the Open Systems Interconnection Reference Model (OSI Model), rather than focusing on for example the underlying operating system or connected networks. &lt;br /&gt;
*'''Application Security Verification''' – The technical assessment of an application against the OWASP ASVS. &lt;br /&gt;
*'''Application Security Verification Report''' – A report that documents the overall results and supporting analysis produced by the verifier for a particular application. &lt;br /&gt;
*'''Application Security Verification Standard (ASVS)''' – An OWASP standard that defines four levels of application security verification for applications. &lt;br /&gt;
*'''Authentication''' – The verification of the claimed identity of an application user. &lt;br /&gt;
*'''Automated Verification''' – The use of automated tools (either dynamic analysis tools, static analysis tools, or both) that use vulnerability signatures to find problems. &lt;br /&gt;
*'''Back Doors''' – A type of malicious code that allows unauthorized access to an application. &lt;br /&gt;
*'''Blacklist''' – A list of data or operations that are not permitted, for example a list of characters that are not allowed as input. &lt;br /&gt;
*'''Common Criteria (CC)''' – A multipart standard that can be used as the basis for the verification of the design and implementation of security controls in IT products. &lt;br /&gt;
*'''Communication Security''' – The protection of application data when it is transmitted between application components, between clients and servers, and between external systems and the application. &lt;br /&gt;
*'''Design Verification''' – The technical assessment of the security architecture of an application. &lt;br /&gt;
*'''Internal Verification''' – The technical assessment of specific aspects of the security architecture of an application as defined in the OWASP ASVS. &lt;br /&gt;
*'''Cryptographic module''' – Hardware, software, and/or firmware that implements cryptographic algorithms and/or generates cryptographic keys. &lt;br /&gt;
*'''Denial of Service (DOS) Attacks''' – The flooding of an application with more requests than it can handle. &lt;br /&gt;
*'''Dynamic Verification''' – The use of automated tools that use vulnerability signatures to find problems during the execution of an application. &lt;br /&gt;
*'''Easter Eggs''' – A type of malicious code that does not run until a specific user input event occurs. &lt;br /&gt;
*'''External Systems''' – A server-side application or service that is not part of the application. &lt;br /&gt;
*'''FIPS 140-2''' – A standard that can be used as the basis for the verification of the design and implementation of cryptographic modules &lt;br /&gt;
*'''Input Validation''' – The canonicalization and validation of untrusted user input. &lt;br /&gt;
*'''Malicious Code''' – Code introduced into an application during its development unbeknownst to the application owner which circumvents the application’s intended security policy. Not the same as malware such as a virus or worm! &lt;br /&gt;
*'''Malware''' – Executable code that is introduced into an application during runtime without the knowledge of the application user or administrator. &lt;br /&gt;
*'''Open Web Application Security Project (OWASP)''' – The Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. Our mission is to make application security &amp;quot;visible,&amp;quot; so that people and organizations can make informed decisions about application security risks. See: http://www.owasp.org/ &lt;br /&gt;
*'''Output Validation''' – The canonicalization and validation of application output to Web browsers and to external systems. &lt;br /&gt;
*'''OWASP Enterprise Security API (ESAPI)''' – A free and open collection of all the security methods that developers need to build secure Web applications. See: http://www.owasp.org/index.php/ESAPI &lt;br /&gt;
*'''OWASP Risk Rating Methodology''' – A risk rating methodology that has been customized for application security. See: http://www.owasp.org/index.php/How_to_value_the_real_risk &lt;br /&gt;
*'''OWASP Testing Guide''' – A document designed to help organizations understand what comprises a testing program, and to help them identify the steps needed to build and operate that testing program. See: http://www.owasp.org/index.php/Category:OWASP_Testing_Project &lt;br /&gt;
*'''OWASP Top Ten''' – A document that represents a broad consensus about what the most critical Web application security flaws are. See: http://www.owasp.org/index.php/Top10 &lt;br /&gt;
*'''Positive''' – See whitelist. &lt;br /&gt;
*'''Salami Attack''' – A type of malicious code that is used to redirect small amounts of money without detection in financial transactions. &lt;br /&gt;
*'''Security Architecture''' – An abstraction of an application’s design that identifies and describes where and how security controls are used, and also identifies and describes the location and sensitivity of both user and application data. &lt;br /&gt;
*'''Security Control''' – A function or component that performs a security check (e.g. an access control check) or when called results in a security effect (e.g. generating an audit record). &lt;br /&gt;
*'''Security Configuration''' – The runtime configuration of an application that affects how security controls are used. &lt;br /&gt;
*'''Static Verification''' – The use of automated tools that use vulnerability signatures to find problems in application source code. &lt;br /&gt;
*'''Target of Verification (TOV)''' – If you are performing an application security verification according to the OWASP ASVS requirements, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. &lt;br /&gt;
*'''Threat Modeling''' - A technique consisting of developing increasingly refined security architectures to identify threat agents, security zones, security controls, and important technical and business assets. &lt;br /&gt;
*'''Time Bomb''' – A type of malicious code that does not run until a preconfigured time or date elapses. &lt;br /&gt;
*'''Verifier''' - The person or team that is reviewing an application against the OWASP ASVS requirements. &lt;br /&gt;
*'''Whitelist''' – A list of permitted data or operations, for example a list of characters that are allowed to perform input validation.&lt;br /&gt;
&lt;br /&gt;
= ASVS Users  =&lt;br /&gt;
[[Image:Asvs-handshake.JPG]]&lt;br /&gt;
&lt;br /&gt;
A broad range of companies and agencies around the globe have added ASVS to their software assurance tool boxes, including [http://www.aspectsecurity.com Aspect Security], [http://www.astyran.com Astyran], [http://www.boozallen.com Booz Allen Hamilton], [http://casabasecurity.com Casaba Security], [http://www.cgi.com/web/en/industries/governments/us_federal/services_solutions.htm CGI Federal], [http://denimgroup.com Denim Group], [http://etebaran.com Etebaran Informatics], [http://www.mindedsecurity.com Minded Security], [http://www.nixu.com Nixu], [http://www.pstestware.com/ ps_testware], [http://www.proactiverisk.com Proactive Risk], [http://quince.co.uk Quince Associates Limited (SeeMyData)], [http://www.serpro.gov.br/ Serviço Federal de Processamento de Dados (SERPRO)], [http://www.udistrital.edu.co/ Universidad Distrital Francisco José de Caldas] Organizations listed are not accredited by OWASP. Neither their products or services have been endorsed by OWASP. Use of ASVS may include for example providing verification services using the standard. Use of ASVS may also include for example performing internal evaluation of products with the OWASP ASVS in mind, and NOT making any claims of meeting any given level in the standard. Please let us know how your organization is using OWASP ASVS. Include your name, organization's name, and brief description of how you use the standard. The project lead can be reached [mailto:sahba@securitycompass.com here].&lt;br /&gt;
&lt;br /&gt;
= Precedents-Interpretations =&lt;br /&gt;
&lt;br /&gt;
'''PI-0001: Are there levels between the levels?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: Are there levels between the levels for the cases where &amp;quot;The specification for an application may require OWASP ASVS Level N, but it could also include other additional detailed requirements such as from a higher ASVS level&amp;quot;? &lt;br /&gt;
*Resolution: No. Use of alternate level definitions or notations such as &amp;quot;ASVS Level 1B+&amp;quot; is discouraged. &lt;br /&gt;
*References: ASVS section &amp;quot;Application Security Verification Levels&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''PI-0002: Is use of a master key simply another level of indirection?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: If a master key is stored as plaintext, isn't using a master key simply another level of indirection? &lt;br /&gt;
*Resolution: No. There is a strong rationale for having a &amp;quot;master key&amp;quot; stored in a secure location that is used to encrypt all other secrets. In many applications, there are lots of secrets stored in many different locations. This greatly increases the likelihood that one of them will be compromised. Having a single master key makes managing the protection considerably simpler and is not simply a level of indirection. &lt;br /&gt;
*References: ASVS verification requirement V2.14&lt;br /&gt;
&lt;br /&gt;
'''PI-0003: What is a &amp;quot;TOV&amp;quot; or &amp;quot;Target of Verification&amp;quot;?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: New terminology &lt;br /&gt;
*Resolution: If you are performing an application security verification according to ASVS, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. The TOV should be identified in verification documentation as follows: &lt;br /&gt;
**TOV Identification – &amp;amp;lt;name and version of the application&amp;amp;gt; or &amp;amp;lt;Application name&amp;amp;gt;, &amp;amp;lt;application version&amp;amp;gt;, dynamic testing was performed in a staging environment, not the production environment &lt;br /&gt;
**TOV Developer – &amp;amp;lt;insert name of the developer or verification customer&amp;amp;gt; &lt;br /&gt;
*References: ASVS section &amp;quot;Approach&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Internationalization =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]&lt;br /&gt;
If you can help with translations, please download the latest draft here:&lt;br /&gt;
&lt;br /&gt;
https://github.com/OWASP/ASVS&lt;br /&gt;
&lt;br /&gt;
If there are any incomprehensible English idiom or phrases in there, please don't hesitate to ask for clarification, because if it's hard to translate, it's almost certainly wrong in English as well. We recommend logging translation issues in GitHub, too, so please make yourself known. &lt;br /&gt;
&lt;br /&gt;
Translations are coordinated through OWASP's Crowd In account, so you don't have to do the entire thing yourself. &lt;br /&gt;
&lt;br /&gt;
https://crowdin.com/project/owasp-asvs/&lt;br /&gt;
&lt;br /&gt;
You don't HAVE to use Crowd In, but it would be nice to indicate to other native speakers of your language that you are willing to work together. This is a 70 page document, and in all honesty, will take a dedicated person a week or more to translate, so please please please work together rather than apart. You have full access to the original document and the original images, so you have everything I have.&lt;br /&gt;
&lt;br /&gt;
= Archive - Previous Version =&lt;br /&gt;
&lt;br /&gt;
'''*Please note that ASVS is currently on version 3.0.  The information on this page is for archival purposes only.*'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step1.jpg]]'1. About ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*Video presentation in English [https://www.youtube.com/watch?v=Ba6ncpIfaJA (YouTube)] &lt;br /&gt;
*ASVS vs. WASC et al [http://www.owasp.org/index.php/ASVS_vs_WASC_Et_Al (Wiki)]&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'2. Get ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS in Bahasa Indonesia (Indonesian language) ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-id.pdf PDF])&lt;br /&gt;
*ASVS in Bahasa Malaysia (Malay) (Currently under development!)&lt;br /&gt;
*ASVS in Chinese(Currently under development!) &lt;br /&gt;
*ASVS in English ([http://www.owasp.org/images/4/4e/OWASP_ASVS_2009_Web_App_Std_Release.pdf PDF], [http://www.owasp.org/images/3/35/OWASP_ASVS_2009_Web_App_Std_Release.doc Word], [http://code.google.com/p/owasp-asvs/wiki/ASVS '''Online'''], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-xml.zip XML]) &lt;br /&gt;
*ASVS in French ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.odt OpenOffice]) &lt;br /&gt;
*ASVS in German ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.doc Word])&lt;br /&gt;
*ASVS in Hungarian (Currently under development!) &lt;br /&gt;
*ASVS in Japanese ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.doc Word]) &lt;br /&gt;
*ASVS in Persian (Farsi) ([http://abiusx.com/archive/document/OWASP-ASVS-fa-20111115.pdf PDF]) beta 0.7&lt;br /&gt;
*ASVS in Polish ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pl.pdf PDF])&lt;br /&gt;
*ASVS in Portuguese-Brazil ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pt-br.pdf PDF])&lt;br /&gt;
*ASVS in Spanish (Currently under development!)&lt;br /&gt;
*ASVS in Thai (Currently under development!)&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'3. Learn ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS Article: Getting Started Using ASVS ([http://www.owasp.org/images/f/f8/OWASP_ASVS_Article_-_Getting_Started_Using_ASVS.pdf PDF]) &lt;br /&gt;
*ASVS Article: Code Reviews and Other Verification Activities: USELESS Unless Acted Upon IMMEDIATELY [http://www.owasp.org/index.php/Code_Reviews_and_Other_Verification_Activities:_USELESS_Unless_Acted_Upon_IMMEDIATELY (Wiki)] &lt;br /&gt;
*ASVS Article: Agile Software Development: Don't Forget EVIL User Stories ([http://www.owasp.org/index.php/Agile_Software_Development:_Don%27t_Forget_EVIL_User_Stories Wiki]) &lt;br /&gt;
*ASVS Article: Man vs. Code ([http://www.owasp.org/index.php/Man_vs._Code Wiki]) &lt;br /&gt;
*ASVS Article: Getting started designing for a level of assurance ([http://www.owasp.org/images/0/01/Getting_started_designing_for_a_level_of_assurance.pdf PDF]) &lt;br /&gt;
*ASVS Template: Sample verification fee schedule template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel]) &lt;br /&gt;
*ASVS Template: Sample verification report template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Report_Template.doc Word]) &lt;br /&gt;
*ASVS Training: An ASVS training presentation ([http://www.owasp.org/index.php/Image:OWASP_AU_Secure_Architecture_and_Coding.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Executive-Level Presentation ([http://www.owasp.org/images/9/99/About_OWASP_ASVS_Executive_Presentation.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Presentation Abstract ([http://www.owasp.org/images/1/10/OWASP_ASVS_Presentation_Abstract.doc Word]) &lt;br /&gt;
*Articles [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project#Articles_Below_-_More_About_ASVS_and_Using_It (More About ASVS and Using It)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP_Project|Application Security Verification Standard Project]]&lt;br /&gt;
[[Category:OWASP_Document]]&lt;br /&gt;
[[Category:OWASP_Download]]&lt;br /&gt;
[[Category:OWASP_Release_Quality_Document|OWASP Stable Quality Document]]&lt;br /&gt;
[[Category:SAMM-CR-1]]&lt;br /&gt;
[[Category:SAMM-DR-2]]&lt;br /&gt;
[[Category:SAMM-ST-3]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=How_to_meet_verification_reporting_requirements&amp;diff=246006</id>
		<title>How to meet verification reporting requirements</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=How_to_meet_verification_reporting_requirements&amp;diff=246006"/>
				<updated>2018-12-12T22:38:22Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=old content from a deleted user removed&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=How_to_meet_verification_reporting_requirements&amp;diff=246005</id>
		<title>How to meet verification reporting requirements</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=How_to_meet_verification_reporting_requirements&amp;diff=246005"/>
				<updated>2018-12-12T22:37:32Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: old content from a deleted user, fishy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245525</id>
		<title>Injection Prevention Cheat Sheet in Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245525"/>
				<updated>2018-11-26T13:21:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This document has for objective to provide some tips to handle ''Injection'' into Java application code.&lt;br /&gt;
&lt;br /&gt;
Sample codes used in tips are located [https://github.com/righettod/injection-cheat-sheets here].&lt;br /&gt;
&lt;br /&gt;
= What is Injection ? =&lt;br /&gt;
&lt;br /&gt;
[[Top_10_2013-A1-Injection|Injection]] in OWASP Top 10 is defined as following:&lt;br /&gt;
&lt;br /&gt;
''Consider anyone who can send untrusted data to the system, including external users, internal users, and administrators.''&lt;br /&gt;
&lt;br /&gt;
= General advices to prevent Injection =&lt;br /&gt;
&lt;br /&gt;
The following point can be applied, in a general way, to prevent ''Injection'' issue:&lt;br /&gt;
&lt;br /&gt;
#  Apply '''Input Validation''' (using whitelist approach) combined with '''Output Sanitizing+Escaping''' on user input/output.&lt;br /&gt;
#  If you need to interact with system, try to use API features provided by your technology stack (Java / .Net / PHP...) instead of building command.&lt;br /&gt;
&lt;br /&gt;
Additional advices are provided on this [[Input_Validation_Cheat_Sheet|cheatsheet]].&lt;br /&gt;
&lt;br /&gt;
= Specific Injection types =&lt;br /&gt;
&lt;br /&gt;
''Examples in this section will be provided in Java technology (see Maven project associated) but advices are applicable to others technologies like .Net / PHP / Ruby / Python...''&lt;br /&gt;
&lt;br /&gt;
== SQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a SQL query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use ''Query Parameterization'' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*No DB framework used here in order to show the real use of Prepared Statement from Java API*/&lt;br /&gt;
/*Open connection with H2 database and use it*/&lt;br /&gt;
Class.forName(&amp;quot;org.h2.Driver&amp;quot;);&lt;br /&gt;
String jdbcUrl = &amp;quot;jdbc:h2:file:&amp;quot; + new File(&amp;quot;.&amp;quot;).getAbsolutePath() + &amp;quot;/target/db&amp;quot;;&lt;br /&gt;
try (Connection con = DriverManager.getConnection(jdbcUrl)) {&lt;br /&gt;
&lt;br /&gt;
    /* Sample A: Select data using Prepared Statement*/&lt;br /&gt;
    String query = &amp;quot;select * from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    List&amp;lt;String&amp;gt; colors = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;yellow&amp;quot;);&lt;br /&gt;
        try (ResultSet rSet = pStatement.executeQuery()) {&lt;br /&gt;
            while (rSet.next()) {&lt;br /&gt;
                colors.add(rSet.getString(1));&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, colors.size());&lt;br /&gt;
    Assert.assertTrue(colors.contains(&amp;quot;yellow&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    /* Sample B: Insert data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;insert into color(friendly_name, red, green, blue) values(?, ?, ?, ?)&amp;quot;;&lt;br /&gt;
    int insertedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        pStatement.setInt(2, 239);&lt;br /&gt;
        pStatement.setInt(3, 125);&lt;br /&gt;
        pStatement.setInt(4, 11);&lt;br /&gt;
        insertedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, insertedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample C: Update data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;update color set blue = ? where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int updatedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setInt(1, 10);&lt;br /&gt;
        pStatement.setString(2, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        updatedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, updatedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample D: Delete data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;delete from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int deletedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        deletedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, deletedRecordCount);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[SQL_Injection_Prevention_Cheat_Sheet|SQL Injection Prevention Cheat Sheet]]&lt;br /&gt;
&lt;br /&gt;
== JPA ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a JPA query using a String and execute it. It's quite similar to SQL injection but here the altered language is not SQL but JPA QL.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use Java Persistence Query Language '''Query Parameterization''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
EntityManager entityManager = null;&lt;br /&gt;
try {&lt;br /&gt;
    /* Get a ref on EntityManager to access DB */&lt;br /&gt;
    entityManager = Persistence.createEntityManagerFactory(&amp;quot;testJPA&amp;quot;).createEntityManager();&lt;br /&gt;
&lt;br /&gt;
    /* Define parametrized query prototype using named parameter to enhance readability */&lt;br /&gt;
    String queryPrototype = &amp;quot;select c from Color c where c.friendlyName = :colorName&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    /* Create the query, set the named parameter and execute the query */&lt;br /&gt;
    Query queryObject = entityManager.createQuery(queryPrototype);&lt;br /&gt;
    Color c = (Color) queryObject.setParameter(&amp;quot;colorName&amp;quot;, &amp;quot;yellow&amp;quot;).getSingleResult();&lt;br /&gt;
&lt;br /&gt;
    /* Ensure that the object obtained is the right one */&lt;br /&gt;
    Assert.assertNotNull(c);&lt;br /&gt;
    Assert.assertEquals(c.getFriendlyName(), &amp;quot;yellow&amp;quot;);&lt;br /&gt;
    Assert.assertEquals(c.getRed(), 213);&lt;br /&gt;
    Assert.assertEquals(c.getGreen(), 242);&lt;br /&gt;
    Assert.assertEquals(c.getBlue(), 26);&lt;br /&gt;
} finally {&lt;br /&gt;
    if (entityManager != null &amp;amp;&amp;amp; entityManager.isOpen()) {&lt;br /&gt;
        entityManager.close();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-persistence-api-jpa&lt;br /&gt;
&lt;br /&gt;
== Operating System ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a Operating System command using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use technology stack '''API''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/* The context taken is, for example, to perform a PING against a computer.&lt;br /&gt;
* The prevention is to use the feature provided by the Java API instead of building&lt;br /&gt;
* a system command as String and execute it */&lt;br /&gt;
InetAddress host = InetAddress.getByName(&amp;quot;localhost&amp;quot;);&lt;br /&gt;
Assert.assertTrue(host.isReachable(5000));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Command_Injection|Command Injection]]&lt;br /&gt;
&lt;br /&gt;
==  XML: External Entity attack ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application load the received XML stream using a XML parser instance in which the resolution of External Entity is not disabled.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Disable to resolution of the External Entity in the parser instance to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
// This is the PRIMARY defense. If DTDs (doctypes) are disallowed,&lt;br /&gt;
// almost all XML entity attacks are prevented&lt;br /&gt;
// Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
String feature = &amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, true);&lt;br /&gt;
&lt;br /&gt;
// If you can't completely disable DTDs, then at least do the following:&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-general-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-parameter-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-parameter-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// feature external DTDs as well&lt;br /&gt;
feature = &amp;quot;http://apache.org/xml/features/nonvalidating/load-external-dtd&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// and these as well, per Timothy Morgan's 2014 paper: &amp;quot;XML Schema, DTD, and Entity Attacks&amp;quot;&lt;br /&gt;
dbf.setXIncludeAware(false);&lt;br /&gt;
dbf.setExpandEntityReferences(false);&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
//Here an org.xml.sax.SAXParseException will be throws because the XML contains a External Entity.&lt;br /&gt;
builder.parse(new File(&amp;quot;src/test/resources/SampleXXE.xml&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== XML: XPath Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a XPath query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''XPath Variable Resolver''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
'''Variable Resolver''' implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Resolver in order to define parameter for XPATH expression.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleVariableResolver implements XPathVariableResolver {&lt;br /&gt;
&lt;br /&gt;
    private final Map&amp;lt;QName, Object&amp;gt; vars = new HashMap&amp;lt;QName, Object&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * External methods to add parameter&lt;br /&gt;
     *&lt;br /&gt;
     * @param name Parameter name&lt;br /&gt;
     * @param value Parameter value&lt;br /&gt;
     */&lt;br /&gt;
    public void addVariable(QName name, Object value) {&lt;br /&gt;
        vars.put(name, value);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * {@inheritDoc}&lt;br /&gt;
     *&lt;br /&gt;
     * @see javax.xml.xpath.XPathVariableResolver#resolveVariable(javax.xml.namespace.QName)&lt;br /&gt;
     */&lt;br /&gt;
    public Object resolveVariable(QName variableName) {&lt;br /&gt;
        return vars.get(variableName);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code using it to perform XPath query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
//Do not performed here in order to focus on variable resolver code&lt;br /&gt;
//but do it for production code !&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
Document doc = builder.parse(new File(&amp;quot;src/test/resources/SampleXPath.xml&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/* Create and configure parameter resolver */&lt;br /&gt;
String bid = &amp;quot;bk102&amp;quot;;&lt;br /&gt;
SimpleVariableResolver variableResolver = new SimpleVariableResolver();&lt;br /&gt;
variableResolver.addVariable(new QName(&amp;quot;bookId&amp;quot;), bid);&lt;br /&gt;
&lt;br /&gt;
/*Create and configure XPATH expression*/&lt;br /&gt;
XPath xpath = XPathFactory.newInstance().newXPath();&lt;br /&gt;
xpath.setXPathVariableResolver(variableResolver);&lt;br /&gt;
XPathExpression xPathExpression = xpath.compile(&amp;quot;//book[@id=$bookId]&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
/* Apply expression on XML document */&lt;br /&gt;
Object nodes = xPathExpression.evaluate(doc, XPathConstants.NODESET);&lt;br /&gt;
NodeList nodesList = (NodeList) nodes;&lt;br /&gt;
Assert.assertNotNull(nodesList);&lt;br /&gt;
Assert.assertEquals(1, nodesList.getLength());&lt;br /&gt;
Element book = (Element)nodesList.item(0);&lt;br /&gt;
Assert.assertTrue(book.getTextContent().contains(&amp;quot;Ralls, Kim&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[XPATH_Injection|XPATH Injection]]&lt;br /&gt;
&lt;br /&gt;
== HTML/JavaScript/CSS ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a HTTP response and sent it to browser.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Either apply strict input validation (whitelist approach) or use output sanitizing+escaping if input validation is not possible (combine both every time is possible).&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
INPUT WAY: Receive data from user&lt;br /&gt;
Here it's recommended to use strict input validation using whitelist approach.&lt;br /&gt;
In fact, you ensure that only allowed characters are part of the input received.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String userInput = &amp;quot;You user login is owasp-user01&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First we check that the value contains only expected character*/&lt;br /&gt;
Assert.assertTrue(Pattern.matches(&amp;quot;[a-zA-Z0-9\\s\\-]{1,50}&amp;quot;, userInput));&lt;br /&gt;
&lt;br /&gt;
/* If the first check pass then ensure that potential dangerous character that we have allowed&lt;br /&gt;
for business requirement are not used in a dangerous way.&lt;br /&gt;
For example here we have allowed the character '-', and, this can be used in SQL injection so, we&lt;br /&gt;
ensure that this character is not used is a continuous form.&lt;br /&gt;
Use the API COMMONS LANG v3 to help in String analysis...&lt;br /&gt;
*/&lt;br /&gt;
Assert.assertEquals(0, StringUtils.countMatches(userInput.replace(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;), &amp;quot;--&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
OUTPUT WAY: Send data to user&lt;br /&gt;
Here we escape + sanitize any data sent to user&lt;br /&gt;
Use the OWASP Java HTML Sanitizer API to handle sanitizing&lt;br /&gt;
Use the OWASP Java Encoder API to handle HTML tag encoding (escaping)&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String outputToUser = &amp;quot;You &amp;lt;p&amp;gt;user login&amp;lt;/p&amp;gt; is &amp;lt;strong&amp;gt;owasp-user01&amp;lt;/strong&amp;gt;&amp;quot;;&lt;br /&gt;
outputToUser += &amp;quot;&amp;lt;script&amp;gt;alert(22);&amp;lt;/script&amp;gt;&amp;lt;img src='#' onload='javascript:alert(23);'&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* Create a sanitizing policy that only allow tag '&amp;lt;p&amp;gt;' and '&amp;lt;strong&amp;gt;'*/&lt;br /&gt;
PolicyFactory policy = new HtmlPolicyBuilder().allowElements(&amp;quot;p&amp;quot;, &amp;quot;strong&amp;quot;).toFactory();&lt;br /&gt;
&lt;br /&gt;
/* Sanitize the output that will be sent to user*/&lt;br /&gt;
String safeOutput = policy.sanitize(outputToUser);&lt;br /&gt;
&lt;br /&gt;
/* Encode HTML Tag*/&lt;br /&gt;
safeOutput = Encode.forHtml(safeOutput);&lt;br /&gt;
String finalSafeOutputExpected = &amp;quot;You &amp;amp;lt;p&amp;amp;gt;user login&amp;amp;lt;/p&amp;amp;gt; is &amp;amp;lt;strong&amp;amp;gt;owasp-user01&amp;amp;lt;/strong&amp;amp;gt;&amp;quot;;&lt;br /&gt;
Assert.assertEquals(finalSafeOutputExpected, safeOutput);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Cross-site_Scripting_(XSS)| XSS]]&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/java-html-sanitizer&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/owasp-java-encoder/&lt;br /&gt;
&lt;br /&gt;
* https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html&lt;br /&gt;
&lt;br /&gt;
* https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/org/apache/commons/lang3/StringEscapeUtils.html&lt;br /&gt;
&lt;br /&gt;
== LDAP ==&lt;br /&gt;
&lt;br /&gt;
A dedicated [[LDAP_Injection_Prevention_Cheat_Sheet|cheatsheet]] has been created.&lt;br /&gt;
&lt;br /&gt;
== NoSQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a NoSQL API call expression.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
As there many NoSQL database system and each one use a API for call, it's important to ensure that user input received&lt;br /&gt;
and used to build the API call expression do not contains any character that have a special meaning in the target API syntax.&lt;br /&gt;
This in order to avoid that it will be used to escape the initial call expression in order to create another one based on crafted user input.&lt;br /&gt;
It's also important to not use string concatenation to build API call expression but use the API to create the expression.&lt;br /&gt;
&lt;br /&gt;
=== Example - MongoDB ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 /* Here use MongoDB as target NoSQL DB */&lt;br /&gt;
String userInput = &amp;quot;Brooklyn&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First ensure that the input do no contains any special characters for the current NoSQL DB call API,&lt;br /&gt;
here they are: ' &amp;quot; \ ; { } $&lt;br /&gt;
*/&lt;br /&gt;
//Avoid regexp this time in order to made validation code more easy to read and understand...&lt;br /&gt;
ArrayList&amp;lt;String&amp;gt; specialCharsList = new ArrayList&amp;lt;String&amp;gt;() {{&lt;br /&gt;
    add(&amp;quot;'&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\\&amp;quot;);&lt;br /&gt;
    add(&amp;quot;;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;{&amp;quot;);&lt;br /&gt;
    add(&amp;quot;}&amp;quot;);&lt;br /&gt;
    add(&amp;quot;$&amp;quot;);&lt;br /&gt;
}};&lt;br /&gt;
specialCharsList.forEach(specChar -&amp;gt; Assert.assertFalse(userInput.contains(specChar)));&lt;br /&gt;
//Add also a check on input max size&lt;br /&gt;
Assert.assertTrue(userInput.length() &amp;lt;= 50);&lt;br /&gt;
&lt;br /&gt;
/* Then perform query on database using API to build expression */&lt;br /&gt;
//Connect to the local MongoDB instance&lt;br /&gt;
try(MongoClient mongoClient = new MongoClient()){&lt;br /&gt;
    MongoDatabase db = mongoClient.getDatabase(&amp;quot;test&amp;quot;);&lt;br /&gt;
    //Use API query builder to create call expression&lt;br /&gt;
    //Create expression&lt;br /&gt;
    Bson expression = eq(&amp;quot;borough&amp;quot;, userInput);&lt;br /&gt;
    //Perform call&lt;br /&gt;
    FindIterable&amp;lt;org.bson.Document&amp;gt; restaurants = db.getCollection(&amp;quot;restaurants&amp;quot;).find(expression);&lt;br /&gt;
    //Verify result consistency&lt;br /&gt;
    restaurants.forEach(new Block&amp;lt;org.bson.Document&amp;gt;() {&lt;br /&gt;
        @Override&lt;br /&gt;
        public void apply(final org.bson.Document doc) {&lt;br /&gt;
            String restBorough = (String)doc.get(&amp;quot;borough&amp;quot;);&lt;br /&gt;
            Assert.assertTrue(&amp;quot;Brooklyn&amp;quot;.equals(restBorough));&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
[[Testing_for_NoSQL_injection|Testing for NoSQL injection]]&lt;br /&gt;
&lt;br /&gt;
https://ckarande.gitbooks.io/owasp-nodegoat-tutorial/content/tutorial/a1_-_sql_and_nosql_injection.html&lt;br /&gt;
&lt;br /&gt;
https://arxiv.org/ftp/arxiv/papers/1506/1506.04082.pdf&lt;br /&gt;
&lt;br /&gt;
== Log Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
[[Log_Injection|Log Injection]] occurs when an application uses untrusted data to create a message in an application log.&lt;br /&gt;
&lt;br /&gt;
More information about this attack is available on this OWASP [[Log_Injection|page]].&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
In order to prevent an attacker from writing malicious content into the application log, apply the following steps:&lt;br /&gt;
&lt;br /&gt;
# Limit the size of the user input value used to create the log message.&lt;br /&gt;
# Filter the user input used to prevent injection of '''C'''arriage '''R'''eturn (CR) or '''L'''ine '''F'''eed (LF) characters.&lt;br /&gt;
&lt;br /&gt;
The project [[OWASP_Security_Logging_Project|OWASP Security Logging]] can be used to protect the application log against ''Log Injection'' attack.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Usage of the ''OWASP Security Logging'' features with the LOG4J2 logging API.&lt;br /&gt;
&lt;br /&gt;
Configuration of a logging policy to roll on 10 files of 5MB each one and encode/limit the log message using the ''OWASP Security Logging'' features (see the ''encode'' function usage in the ''Pattern'' tag):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Configuration status=&amp;quot;error&amp;quot; name=&amp;quot;SecureLoggingPolicy&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Appenders&amp;gt;&lt;br /&gt;
        &amp;lt;RollingFile name=&amp;quot;RollingFile&amp;quot; fileName=&amp;quot;App.log&amp;quot; filePattern=&amp;quot;App-%i.log&amp;quot; ignoreExceptions=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;PatternLayout&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Encode the message and limit is maximum size to 500 characters --&amp;gt;&lt;br /&gt;
                &amp;lt;Pattern&amp;gt;%d{ISO8601} %-5p - %encode{%.-500m}%n&amp;lt;/Pattern&amp;gt;&lt;br /&gt;
            &amp;lt;/PatternLayout&amp;gt;&lt;br /&gt;
            &amp;lt;Policies&amp;gt;&lt;br /&gt;
                &amp;lt;SizeBasedTriggeringPolicy size=&amp;quot;5MB&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Policies&amp;gt;&lt;br /&gt;
            &amp;lt;DefaultRolloverStrategy max=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/RollingFile&amp;gt;&lt;br /&gt;
    &amp;lt;/Appenders&amp;gt;&lt;br /&gt;
    &amp;lt;Loggers&amp;gt;&lt;br /&gt;
        &amp;lt;Root level=&amp;quot;debug&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AppenderRef ref=&amp;quot;RollingFile&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/Root&amp;gt;&lt;br /&gt;
    &amp;lt;/Loggers&amp;gt;&lt;br /&gt;
&amp;lt;/Configuration&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usage of the logger at code level:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.apache.logging.log4j.LogManager;&lt;br /&gt;
import org.apache.logging.log4j.Logger;&lt;br /&gt;
...&lt;br /&gt;
// No special action needed because security actions are performed at the logging policy level&lt;br /&gt;
Logger logger = LogManager.getLogger(MyClass.class);&lt;br /&gt;
logger.info(logMessage);&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/configuration.html&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/appenders.html&lt;br /&gt;
&lt;br /&gt;
https://github.com/javabeanz/owasp-security-logging&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
[[User:Dominique_RIGHETTO|Dominique Righetto]] - dominique.righetto@owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets = &lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245524</id>
		<title>Injection Prevention Cheat Sheet in Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245524"/>
				<updated>2018-11-26T13:21:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: removing HTML escaping in log files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This document has for objective to provide some tips to handle ''Injection'' into Java application code.&lt;br /&gt;
&lt;br /&gt;
Sample codes used in tips are located [https://github.com/righettod/injection-cheat-sheets here].&lt;br /&gt;
&lt;br /&gt;
= What is Injection ? =&lt;br /&gt;
&lt;br /&gt;
[[Top_10_2013-A1-Injection|Injection]] in OWASP Top 10 is defined as following:&lt;br /&gt;
&lt;br /&gt;
''Consider anyone who can send untrusted data to the system, including external users, internal users, and administrators.''&lt;br /&gt;
&lt;br /&gt;
= General advices to prevent Injection =&lt;br /&gt;
&lt;br /&gt;
The following point can be applied, in a general way, to prevent ''Injection'' issue:&lt;br /&gt;
&lt;br /&gt;
#  Apply '''Input Validation''' (using whitelist approach) combined with '''Output Sanitizing+Escaping''' on user input/output.&lt;br /&gt;
#  If you need to interact with system, try to use API features provided by your technology stack (Java / .Net / PHP...) instead of building command.&lt;br /&gt;
&lt;br /&gt;
Additional advices are provided on this [[Input_Validation_Cheat_Sheet|cheatsheet]].&lt;br /&gt;
&lt;br /&gt;
= Specific Injection types =&lt;br /&gt;
&lt;br /&gt;
''Examples in this section will be provided in Java technology (see Maven project associated) but advices are applicable to others technologies like .Net / PHP / Ruby / Python...''&lt;br /&gt;
&lt;br /&gt;
== SQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a SQL query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''Query Parameterization'' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*No DB framework used here in order to show the real use of Prepared Statement from Java API*/&lt;br /&gt;
/*Open connection with H2 database and use it*/&lt;br /&gt;
Class.forName(&amp;quot;org.h2.Driver&amp;quot;);&lt;br /&gt;
String jdbcUrl = &amp;quot;jdbc:h2:file:&amp;quot; + new File(&amp;quot;.&amp;quot;).getAbsolutePath() + &amp;quot;/target/db&amp;quot;;&lt;br /&gt;
try (Connection con = DriverManager.getConnection(jdbcUrl)) {&lt;br /&gt;
&lt;br /&gt;
    /* Sample A: Select data using Prepared Statement*/&lt;br /&gt;
    String query = &amp;quot;select * from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    List&amp;lt;String&amp;gt; colors = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;yellow&amp;quot;);&lt;br /&gt;
        try (ResultSet rSet = pStatement.executeQuery()) {&lt;br /&gt;
            while (rSet.next()) {&lt;br /&gt;
                colors.add(rSet.getString(1));&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, colors.size());&lt;br /&gt;
    Assert.assertTrue(colors.contains(&amp;quot;yellow&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    /* Sample B: Insert data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;insert into color(friendly_name, red, green, blue) values(?, ?, ?, ?)&amp;quot;;&lt;br /&gt;
    int insertedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        pStatement.setInt(2, 239);&lt;br /&gt;
        pStatement.setInt(3, 125);&lt;br /&gt;
        pStatement.setInt(4, 11);&lt;br /&gt;
        insertedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, insertedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample C: Update data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;update color set blue = ? where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int updatedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setInt(1, 10);&lt;br /&gt;
        pStatement.setString(2, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        updatedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, updatedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample D: Delete data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;delete from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int deletedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        deletedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, deletedRecordCount);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[SQL_Injection_Prevention_Cheat_Sheet|SQL Injection Prevention Cheat Sheet]]&lt;br /&gt;
&lt;br /&gt;
== JPA ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a JPA query using a String and execute it. It's quite similar to SQL injection but here the altered language is not SQL but JPA QL.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use Java Persistence Query Language '''Query Parameterization''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
EntityManager entityManager = null;&lt;br /&gt;
try {&lt;br /&gt;
    /* Get a ref on EntityManager to access DB */&lt;br /&gt;
    entityManager = Persistence.createEntityManagerFactory(&amp;quot;testJPA&amp;quot;).createEntityManager();&lt;br /&gt;
&lt;br /&gt;
    /* Define parametrized query prototype using named parameter to enhance readability */&lt;br /&gt;
    String queryPrototype = &amp;quot;select c from Color c where c.friendlyName = :colorName&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    /* Create the query, set the named parameter and execute the query */&lt;br /&gt;
    Query queryObject = entityManager.createQuery(queryPrototype);&lt;br /&gt;
    Color c = (Color) queryObject.setParameter(&amp;quot;colorName&amp;quot;, &amp;quot;yellow&amp;quot;).getSingleResult();&lt;br /&gt;
&lt;br /&gt;
    /* Ensure that the object obtained is the right one */&lt;br /&gt;
    Assert.assertNotNull(c);&lt;br /&gt;
    Assert.assertEquals(c.getFriendlyName(), &amp;quot;yellow&amp;quot;);&lt;br /&gt;
    Assert.assertEquals(c.getRed(), 213);&lt;br /&gt;
    Assert.assertEquals(c.getGreen(), 242);&lt;br /&gt;
    Assert.assertEquals(c.getBlue(), 26);&lt;br /&gt;
} finally {&lt;br /&gt;
    if (entityManager != null &amp;amp;&amp;amp; entityManager.isOpen()) {&lt;br /&gt;
        entityManager.close();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-persistence-api-jpa&lt;br /&gt;
&lt;br /&gt;
== Operating System ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a Operating System command using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use technology stack '''API''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/* The context taken is, for example, to perform a PING against a computer.&lt;br /&gt;
* The prevention is to use the feature provided by the Java API instead of building&lt;br /&gt;
* a system command as String and execute it */&lt;br /&gt;
InetAddress host = InetAddress.getByName(&amp;quot;localhost&amp;quot;);&lt;br /&gt;
Assert.assertTrue(host.isReachable(5000));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Command_Injection|Command Injection]]&lt;br /&gt;
&lt;br /&gt;
==  XML: External Entity attack ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application load the received XML stream using a XML parser instance in which the resolution of External Entity is not disabled.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Disable to resolution of the External Entity in the parser instance to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
// This is the PRIMARY defense. If DTDs (doctypes) are disallowed,&lt;br /&gt;
// almost all XML entity attacks are prevented&lt;br /&gt;
// Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
String feature = &amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, true);&lt;br /&gt;
&lt;br /&gt;
// If you can't completely disable DTDs, then at least do the following:&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-general-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-parameter-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-parameter-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// feature external DTDs as well&lt;br /&gt;
feature = &amp;quot;http://apache.org/xml/features/nonvalidating/load-external-dtd&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// and these as well, per Timothy Morgan's 2014 paper: &amp;quot;XML Schema, DTD, and Entity Attacks&amp;quot;&lt;br /&gt;
dbf.setXIncludeAware(false);&lt;br /&gt;
dbf.setExpandEntityReferences(false);&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
//Here an org.xml.sax.SAXParseException will be throws because the XML contains a External Entity.&lt;br /&gt;
builder.parse(new File(&amp;quot;src/test/resources/SampleXXE.xml&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== XML: XPath Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a XPath query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''XPath Variable Resolver''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
'''Variable Resolver''' implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Resolver in order to define parameter for XPATH expression.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleVariableResolver implements XPathVariableResolver {&lt;br /&gt;
&lt;br /&gt;
    private final Map&amp;lt;QName, Object&amp;gt; vars = new HashMap&amp;lt;QName, Object&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * External methods to add parameter&lt;br /&gt;
     *&lt;br /&gt;
     * @param name Parameter name&lt;br /&gt;
     * @param value Parameter value&lt;br /&gt;
     */&lt;br /&gt;
    public void addVariable(QName name, Object value) {&lt;br /&gt;
        vars.put(name, value);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * {@inheritDoc}&lt;br /&gt;
     *&lt;br /&gt;
     * @see javax.xml.xpath.XPathVariableResolver#resolveVariable(javax.xml.namespace.QName)&lt;br /&gt;
     */&lt;br /&gt;
    public Object resolveVariable(QName variableName) {&lt;br /&gt;
        return vars.get(variableName);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code using it to perform XPath query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
//Do not performed here in order to focus on variable resolver code&lt;br /&gt;
//but do it for production code !&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
Document doc = builder.parse(new File(&amp;quot;src/test/resources/SampleXPath.xml&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/* Create and configure parameter resolver */&lt;br /&gt;
String bid = &amp;quot;bk102&amp;quot;;&lt;br /&gt;
SimpleVariableResolver variableResolver = new SimpleVariableResolver();&lt;br /&gt;
variableResolver.addVariable(new QName(&amp;quot;bookId&amp;quot;), bid);&lt;br /&gt;
&lt;br /&gt;
/*Create and configure XPATH expression*/&lt;br /&gt;
XPath xpath = XPathFactory.newInstance().newXPath();&lt;br /&gt;
xpath.setXPathVariableResolver(variableResolver);&lt;br /&gt;
XPathExpression xPathExpression = xpath.compile(&amp;quot;//book[@id=$bookId]&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
/* Apply expression on XML document */&lt;br /&gt;
Object nodes = xPathExpression.evaluate(doc, XPathConstants.NODESET);&lt;br /&gt;
NodeList nodesList = (NodeList) nodes;&lt;br /&gt;
Assert.assertNotNull(nodesList);&lt;br /&gt;
Assert.assertEquals(1, nodesList.getLength());&lt;br /&gt;
Element book = (Element)nodesList.item(0);&lt;br /&gt;
Assert.assertTrue(book.getTextContent().contains(&amp;quot;Ralls, Kim&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[XPATH_Injection|XPATH Injection]]&lt;br /&gt;
&lt;br /&gt;
== HTML/JavaScript/CSS ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a HTTP response and sent it to browser.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Either apply strict input validation (whitelist approach) or use output sanitizing+escaping if input validation is not possible (combine both every time is possible).&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
INPUT WAY: Receive data from user&lt;br /&gt;
Here it's recommended to use strict input validation using whitelist approach.&lt;br /&gt;
In fact, you ensure that only allowed characters are part of the input received.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String userInput = &amp;quot;You user login is owasp-user01&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First we check that the value contains only expected character*/&lt;br /&gt;
Assert.assertTrue(Pattern.matches(&amp;quot;[a-zA-Z0-9\\s\\-]{1,50}&amp;quot;, userInput));&lt;br /&gt;
&lt;br /&gt;
/* If the first check pass then ensure that potential dangerous character that we have allowed&lt;br /&gt;
for business requirement are not used in a dangerous way.&lt;br /&gt;
For example here we have allowed the character '-', and, this can be used in SQL injection so, we&lt;br /&gt;
ensure that this character is not used is a continuous form.&lt;br /&gt;
Use the API COMMONS LANG v3 to help in String analysis...&lt;br /&gt;
*/&lt;br /&gt;
Assert.assertEquals(0, StringUtils.countMatches(userInput.replace(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;), &amp;quot;--&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
OUTPUT WAY: Send data to user&lt;br /&gt;
Here we escape + sanitize any data sent to user&lt;br /&gt;
Use the OWASP Java HTML Sanitizer API to handle sanitizing&lt;br /&gt;
Use the OWASP Java Encoder API to handle HTML tag encoding (escaping)&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String outputToUser = &amp;quot;You &amp;lt;p&amp;gt;user login&amp;lt;/p&amp;gt; is &amp;lt;strong&amp;gt;owasp-user01&amp;lt;/strong&amp;gt;&amp;quot;;&lt;br /&gt;
outputToUser += &amp;quot;&amp;lt;script&amp;gt;alert(22);&amp;lt;/script&amp;gt;&amp;lt;img src='#' onload='javascript:alert(23);'&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* Create a sanitizing policy that only allow tag '&amp;lt;p&amp;gt;' and '&amp;lt;strong&amp;gt;'*/&lt;br /&gt;
PolicyFactory policy = new HtmlPolicyBuilder().allowElements(&amp;quot;p&amp;quot;, &amp;quot;strong&amp;quot;).toFactory();&lt;br /&gt;
&lt;br /&gt;
/* Sanitize the output that will be sent to user*/&lt;br /&gt;
String safeOutput = policy.sanitize(outputToUser);&lt;br /&gt;
&lt;br /&gt;
/* Encode HTML Tag*/&lt;br /&gt;
safeOutput = Encode.forHtml(safeOutput);&lt;br /&gt;
String finalSafeOutputExpected = &amp;quot;You &amp;amp;lt;p&amp;amp;gt;user login&amp;amp;lt;/p&amp;amp;gt; is &amp;amp;lt;strong&amp;amp;gt;owasp-user01&amp;amp;lt;/strong&amp;amp;gt;&amp;quot;;&lt;br /&gt;
Assert.assertEquals(finalSafeOutputExpected, safeOutput);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Cross-site_Scripting_(XSS)| XSS]]&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/java-html-sanitizer&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/owasp-java-encoder/&lt;br /&gt;
&lt;br /&gt;
* https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html&lt;br /&gt;
&lt;br /&gt;
* https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/org/apache/commons/lang3/StringEscapeUtils.html&lt;br /&gt;
&lt;br /&gt;
== LDAP ==&lt;br /&gt;
&lt;br /&gt;
A dedicated [[LDAP_Injection_Prevention_Cheat_Sheet|cheatsheet]] has been created.&lt;br /&gt;
&lt;br /&gt;
== NoSQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a NoSQL API call expression.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
As there many NoSQL database system and each one use a API for call, it's important to ensure that user input received&lt;br /&gt;
and used to build the API call expression do not contains any character that have a special meaning in the target API syntax.&lt;br /&gt;
This in order to avoid that it will be used to escape the initial call expression in order to create another one based on crafted user input.&lt;br /&gt;
It's also important to not use string concatenation to build API call expression but use the API to create the expression.&lt;br /&gt;
&lt;br /&gt;
=== Example - MongoDB ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 /* Here use MongoDB as target NoSQL DB */&lt;br /&gt;
String userInput = &amp;quot;Brooklyn&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First ensure that the input do no contains any special characters for the current NoSQL DB call API,&lt;br /&gt;
here they are: ' &amp;quot; \ ; { } $&lt;br /&gt;
*/&lt;br /&gt;
//Avoid regexp this time in order to made validation code more easy to read and understand...&lt;br /&gt;
ArrayList&amp;lt;String&amp;gt; specialCharsList = new ArrayList&amp;lt;String&amp;gt;() {{&lt;br /&gt;
    add(&amp;quot;'&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\\&amp;quot;);&lt;br /&gt;
    add(&amp;quot;;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;{&amp;quot;);&lt;br /&gt;
    add(&amp;quot;}&amp;quot;);&lt;br /&gt;
    add(&amp;quot;$&amp;quot;);&lt;br /&gt;
}};&lt;br /&gt;
specialCharsList.forEach(specChar -&amp;gt; Assert.assertFalse(userInput.contains(specChar)));&lt;br /&gt;
//Add also a check on input max size&lt;br /&gt;
Assert.assertTrue(userInput.length() &amp;lt;= 50);&lt;br /&gt;
&lt;br /&gt;
/* Then perform query on database using API to build expression */&lt;br /&gt;
//Connect to the local MongoDB instance&lt;br /&gt;
try(MongoClient mongoClient = new MongoClient()){&lt;br /&gt;
    MongoDatabase db = mongoClient.getDatabase(&amp;quot;test&amp;quot;);&lt;br /&gt;
    //Use API query builder to create call expression&lt;br /&gt;
    //Create expression&lt;br /&gt;
    Bson expression = eq(&amp;quot;borough&amp;quot;, userInput);&lt;br /&gt;
    //Perform call&lt;br /&gt;
    FindIterable&amp;lt;org.bson.Document&amp;gt; restaurants = db.getCollection(&amp;quot;restaurants&amp;quot;).find(expression);&lt;br /&gt;
    //Verify result consistency&lt;br /&gt;
    restaurants.forEach(new Block&amp;lt;org.bson.Document&amp;gt;() {&lt;br /&gt;
        @Override&lt;br /&gt;
        public void apply(final org.bson.Document doc) {&lt;br /&gt;
            String restBorough = (String)doc.get(&amp;quot;borough&amp;quot;);&lt;br /&gt;
            Assert.assertTrue(&amp;quot;Brooklyn&amp;quot;.equals(restBorough));&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
[[Testing_for_NoSQL_injection|Testing for NoSQL injection]]&lt;br /&gt;
&lt;br /&gt;
https://ckarande.gitbooks.io/owasp-nodegoat-tutorial/content/tutorial/a1_-_sql_and_nosql_injection.html&lt;br /&gt;
&lt;br /&gt;
https://arxiv.org/ftp/arxiv/papers/1506/1506.04082.pdf&lt;br /&gt;
&lt;br /&gt;
== Log Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
[[Log_Injection|Log Injection]] occurs when an application uses untrusted data to create a message in an application log.&lt;br /&gt;
&lt;br /&gt;
More information about this attack is available on this OWASP [[Log_Injection|page]].&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
In order to prevent an attacker from writing malicious content into the application log, apply the following steps:&lt;br /&gt;
&lt;br /&gt;
# Limit the size of the user input value used to create the log message.&lt;br /&gt;
# Filter the user input used to prevent injection of '''C'''arriage '''R'''eturn (CR) or '''L'''ine '''F'''eed (LF) characters.&lt;br /&gt;
&lt;br /&gt;
The project [[OWASP_Security_Logging_Project|OWASP Security Logging]] can be used to protect the application log against ''Log Injection'' attack.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Usage of the ''OWASP Security Logging'' features with the LOG4J2 logging API.&lt;br /&gt;
&lt;br /&gt;
Configuration of a logging policy to roll on 10 files of 5MB each one and encode/limit the log message using the ''OWASP Security Logging'' features (see the ''encode'' function usage in the ''Pattern'' tag):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Configuration status=&amp;quot;error&amp;quot; name=&amp;quot;SecureLoggingPolicy&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Appenders&amp;gt;&lt;br /&gt;
        &amp;lt;RollingFile name=&amp;quot;RollingFile&amp;quot; fileName=&amp;quot;App.log&amp;quot; filePattern=&amp;quot;App-%i.log&amp;quot; ignoreExceptions=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;PatternLayout&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Encode the message and limit is maximum size to 500 characters --&amp;gt;&lt;br /&gt;
                &amp;lt;Pattern&amp;gt;%d{ISO8601} %-5p - %encode{%.-500m}%n&amp;lt;/Pattern&amp;gt;&lt;br /&gt;
            &amp;lt;/PatternLayout&amp;gt;&lt;br /&gt;
            &amp;lt;Policies&amp;gt;&lt;br /&gt;
                &amp;lt;SizeBasedTriggeringPolicy size=&amp;quot;5MB&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Policies&amp;gt;&lt;br /&gt;
            &amp;lt;DefaultRolloverStrategy max=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/RollingFile&amp;gt;&lt;br /&gt;
    &amp;lt;/Appenders&amp;gt;&lt;br /&gt;
    &amp;lt;Loggers&amp;gt;&lt;br /&gt;
        &amp;lt;Root level=&amp;quot;debug&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AppenderRef ref=&amp;quot;RollingFile&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/Root&amp;gt;&lt;br /&gt;
    &amp;lt;/Loggers&amp;gt;&lt;br /&gt;
&amp;lt;/Configuration&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usage of the logger at code level:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.apache.logging.log4j.LogManager;&lt;br /&gt;
import org.apache.logging.log4j.Logger;&lt;br /&gt;
...&lt;br /&gt;
// No special action needed because security actions are performed at the logging policy level&lt;br /&gt;
Logger logger = LogManager.getLogger(MyClass.class);&lt;br /&gt;
logger.info(logMessage);&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/configuration.html&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/appenders.html&lt;br /&gt;
&lt;br /&gt;
https://github.com/javabeanz/owasp-security-logging&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
[[User:Dominique_RIGHETTO|Dominique Righetto]] - dominique.righetto@owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets = &lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245522</id>
		<title>Injection Prevention Cheat Sheet in Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245522"/>
				<updated>2018-11-26T13:16:43Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This document has for objective to provide some tips to handle ''Injection'' into Java application code.&lt;br /&gt;
&lt;br /&gt;
Sample codes used in tips are located [https://github.com/righettod/injection-cheat-sheets here].&lt;br /&gt;
&lt;br /&gt;
= What is Injection ? =&lt;br /&gt;
&lt;br /&gt;
[[Top_10_2013-A1-Injection|Injection]] in OWASP Top 10 is defined as following:&lt;br /&gt;
&lt;br /&gt;
''Consider anyone who can send untrusted data to the system, including external users, internal users, and administrators.''&lt;br /&gt;
&lt;br /&gt;
= General advices to prevent Injection =&lt;br /&gt;
&lt;br /&gt;
The following point can be applied, in a general way, to prevent ''Injection'' issue:&lt;br /&gt;
&lt;br /&gt;
#  Apply '''Input Validation''' (using whitelist approach) combined with '''Output Sanitizing+Escaping''' on user input/output.&lt;br /&gt;
#  If you need to interact with system, try to use API features provided by your technology stack (Java / .Net / PHP...) instead of building command.&lt;br /&gt;
&lt;br /&gt;
Additional advices are provided on this [[Input_Validation_Cheat_Sheet|cheatsheet]].&lt;br /&gt;
&lt;br /&gt;
= Specific Injection types =&lt;br /&gt;
&lt;br /&gt;
''Examples in this section will be provided in Java technology (see Maven project associated) but advices are applicable to others technologies like .Net / PHP / Ruby / Python...''&lt;br /&gt;
&lt;br /&gt;
== SQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a SQL query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''Query Parameterization'' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*No DB framework used here in order to show the real use of Prepared Statement from Java API*/&lt;br /&gt;
/*Open connection with H2 database and use it*/&lt;br /&gt;
Class.forName(&amp;quot;org.h2.Driver&amp;quot;);&lt;br /&gt;
String jdbcUrl = &amp;quot;jdbc:h2:file:&amp;quot; + new File(&amp;quot;.&amp;quot;).getAbsolutePath() + &amp;quot;/target/db&amp;quot;;&lt;br /&gt;
try (Connection con = DriverManager.getConnection(jdbcUrl)) {&lt;br /&gt;
&lt;br /&gt;
    /* Sample A: Select data using Prepared Statement*/&lt;br /&gt;
    String query = &amp;quot;select * from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    List&amp;lt;String&amp;gt; colors = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;yellow&amp;quot;);&lt;br /&gt;
        try (ResultSet rSet = pStatement.executeQuery()) {&lt;br /&gt;
            while (rSet.next()) {&lt;br /&gt;
                colors.add(rSet.getString(1));&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, colors.size());&lt;br /&gt;
    Assert.assertTrue(colors.contains(&amp;quot;yellow&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    /* Sample B: Insert data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;insert into color(friendly_name, red, green, blue) values(?, ?, ?, ?)&amp;quot;;&lt;br /&gt;
    int insertedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        pStatement.setInt(2, 239);&lt;br /&gt;
        pStatement.setInt(3, 125);&lt;br /&gt;
        pStatement.setInt(4, 11);&lt;br /&gt;
        insertedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, insertedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample C: Update data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;update color set blue = ? where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int updatedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setInt(1, 10);&lt;br /&gt;
        pStatement.setString(2, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        updatedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, updatedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample D: Delete data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;delete from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int deletedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        deletedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, deletedRecordCount);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[SQL_Injection_Prevention_Cheat_Sheet|SQL Injection Prevention Cheat Sheet]]&lt;br /&gt;
&lt;br /&gt;
== JPA ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a JPA query using a String and execute it. It's quite similar to SQL injection but here the altered language is not SQL but JPA QL.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use Java Persistence Query Language '''Query Parameterization''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
EntityManager entityManager = null;&lt;br /&gt;
try {&lt;br /&gt;
    /* Get a ref on EntityManager to access DB */&lt;br /&gt;
    entityManager = Persistence.createEntityManagerFactory(&amp;quot;testJPA&amp;quot;).createEntityManager();&lt;br /&gt;
&lt;br /&gt;
    /* Define parametrized query prototype using named parameter to enhance readability */&lt;br /&gt;
    String queryPrototype = &amp;quot;select c from Color c where c.friendlyName = :colorName&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    /* Create the query, set the named parameter and execute the query */&lt;br /&gt;
    Query queryObject = entityManager.createQuery(queryPrototype);&lt;br /&gt;
    Color c = (Color) queryObject.setParameter(&amp;quot;colorName&amp;quot;, &amp;quot;yellow&amp;quot;).getSingleResult();&lt;br /&gt;
&lt;br /&gt;
    /* Ensure that the object obtained is the right one */&lt;br /&gt;
    Assert.assertNotNull(c);&lt;br /&gt;
    Assert.assertEquals(c.getFriendlyName(), &amp;quot;yellow&amp;quot;);&lt;br /&gt;
    Assert.assertEquals(c.getRed(), 213);&lt;br /&gt;
    Assert.assertEquals(c.getGreen(), 242);&lt;br /&gt;
    Assert.assertEquals(c.getBlue(), 26);&lt;br /&gt;
} finally {&lt;br /&gt;
    if (entityManager != null &amp;amp;&amp;amp; entityManager.isOpen()) {&lt;br /&gt;
        entityManager.close();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-persistence-api-jpa&lt;br /&gt;
&lt;br /&gt;
== Operating System ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a Operating System command using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use technology stack '''API''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/* The context taken is, for example, to perform a PING against a computer.&lt;br /&gt;
* The prevention is to use the feature provided by the Java API instead of building&lt;br /&gt;
* a system command as String and execute it */&lt;br /&gt;
InetAddress host = InetAddress.getByName(&amp;quot;localhost&amp;quot;);&lt;br /&gt;
Assert.assertTrue(host.isReachable(5000));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Command_Injection|Command Injection]]&lt;br /&gt;
&lt;br /&gt;
==  XML: External Entity attack ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application load the received XML stream using a XML parser instance in which the resolution of External Entity is not disabled.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Disable to resolution of the External Entity in the parser instance to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
// This is the PRIMARY defense. If DTDs (doctypes) are disallowed,&lt;br /&gt;
// almost all XML entity attacks are prevented&lt;br /&gt;
// Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
String feature = &amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, true);&lt;br /&gt;
&lt;br /&gt;
// If you can't completely disable DTDs, then at least do the following:&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-general-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-parameter-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-parameter-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// feature external DTDs as well&lt;br /&gt;
feature = &amp;quot;http://apache.org/xml/features/nonvalidating/load-external-dtd&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// and these as well, per Timothy Morgan's 2014 paper: &amp;quot;XML Schema, DTD, and Entity Attacks&amp;quot;&lt;br /&gt;
dbf.setXIncludeAware(false);&lt;br /&gt;
dbf.setExpandEntityReferences(false);&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
//Here an org.xml.sax.SAXParseException will be throws because the XML contains a External Entity.&lt;br /&gt;
builder.parse(new File(&amp;quot;src/test/resources/SampleXXE.xml&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== XML: XPath Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a XPath query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''XPath Variable Resolver''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
'''Variable Resolver''' implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Resolver in order to define parameter for XPATH expression.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleVariableResolver implements XPathVariableResolver {&lt;br /&gt;
&lt;br /&gt;
    private final Map&amp;lt;QName, Object&amp;gt; vars = new HashMap&amp;lt;QName, Object&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * External methods to add parameter&lt;br /&gt;
     *&lt;br /&gt;
     * @param name Parameter name&lt;br /&gt;
     * @param value Parameter value&lt;br /&gt;
     */&lt;br /&gt;
    public void addVariable(QName name, Object value) {&lt;br /&gt;
        vars.put(name, value);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * {@inheritDoc}&lt;br /&gt;
     *&lt;br /&gt;
     * @see javax.xml.xpath.XPathVariableResolver#resolveVariable(javax.xml.namespace.QName)&lt;br /&gt;
     */&lt;br /&gt;
    public Object resolveVariable(QName variableName) {&lt;br /&gt;
        return vars.get(variableName);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code using it to perform XPath query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
//Do not performed here in order to focus on variable resolver code&lt;br /&gt;
//but do it for production code !&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
Document doc = builder.parse(new File(&amp;quot;src/test/resources/SampleXPath.xml&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/* Create and configure parameter resolver */&lt;br /&gt;
String bid = &amp;quot;bk102&amp;quot;;&lt;br /&gt;
SimpleVariableResolver variableResolver = new SimpleVariableResolver();&lt;br /&gt;
variableResolver.addVariable(new QName(&amp;quot;bookId&amp;quot;), bid);&lt;br /&gt;
&lt;br /&gt;
/*Create and configure XPATH expression*/&lt;br /&gt;
XPath xpath = XPathFactory.newInstance().newXPath();&lt;br /&gt;
xpath.setXPathVariableResolver(variableResolver);&lt;br /&gt;
XPathExpression xPathExpression = xpath.compile(&amp;quot;//book[@id=$bookId]&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
/* Apply expression on XML document */&lt;br /&gt;
Object nodes = xPathExpression.evaluate(doc, XPathConstants.NODESET);&lt;br /&gt;
NodeList nodesList = (NodeList) nodes;&lt;br /&gt;
Assert.assertNotNull(nodesList);&lt;br /&gt;
Assert.assertEquals(1, nodesList.getLength());&lt;br /&gt;
Element book = (Element)nodesList.item(0);&lt;br /&gt;
Assert.assertTrue(book.getTextContent().contains(&amp;quot;Ralls, Kim&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[XPATH_Injection|XPATH Injection]]&lt;br /&gt;
&lt;br /&gt;
== HTML/JavaScript/CSS ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a HTTP response and sent it to browser.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Either apply strict input validation (whitelist approach) or use output sanitizing+escaping if input validation is not possible (combine both every time is possible).&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
INPUT WAY: Receive data from user&lt;br /&gt;
Here it's recommended to use strict input validation using whitelist approach.&lt;br /&gt;
In fact, you ensure that only allowed characters are part of the input received.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String userInput = &amp;quot;You user login is owasp-user01&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First we check that the value contains only expected character*/&lt;br /&gt;
Assert.assertTrue(Pattern.matches(&amp;quot;[a-zA-Z0-9\\s\\-]{1,50}&amp;quot;, userInput));&lt;br /&gt;
&lt;br /&gt;
/* If the first check pass then ensure that potential dangerous character that we have allowed&lt;br /&gt;
for business requirement are not used in a dangerous way.&lt;br /&gt;
For example here we have allowed the character '-', and, this can be used in SQL injection so, we&lt;br /&gt;
ensure that this character is not used is a continuous form.&lt;br /&gt;
Use the API COMMONS LANG v3 to help in String analysis...&lt;br /&gt;
*/&lt;br /&gt;
Assert.assertEquals(0, StringUtils.countMatches(userInput.replace(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;), &amp;quot;--&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
OUTPUT WAY: Send data to user&lt;br /&gt;
Here we escape + sanitize any data sent to user&lt;br /&gt;
Use the OWASP Java HTML Sanitizer API to handle sanitizing&lt;br /&gt;
Use the OWASP Java Encoder API to handle HTML tag encoding (escaping)&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String outputToUser = &amp;quot;You &amp;lt;p&amp;gt;user login&amp;lt;/p&amp;gt; is &amp;lt;strong&amp;gt;owasp-user01&amp;lt;/strong&amp;gt;&amp;quot;;&lt;br /&gt;
outputToUser += &amp;quot;&amp;lt;script&amp;gt;alert(22);&amp;lt;/script&amp;gt;&amp;lt;img src='#' onload='javascript:alert(23);'&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* Create a sanitizing policy that only allow tag '&amp;lt;p&amp;gt;' and '&amp;lt;strong&amp;gt;'*/&lt;br /&gt;
PolicyFactory policy = new HtmlPolicyBuilder().allowElements(&amp;quot;p&amp;quot;, &amp;quot;strong&amp;quot;).toFactory();&lt;br /&gt;
&lt;br /&gt;
/* Sanitize the output that will be sent to user*/&lt;br /&gt;
String safeOutput = policy.sanitize(outputToUser);&lt;br /&gt;
&lt;br /&gt;
/* Encode HTML Tag*/&lt;br /&gt;
safeOutput = Encode.forHtml(safeOutput);&lt;br /&gt;
String finalSafeOutputExpected = &amp;quot;You &amp;amp;lt;p&amp;amp;gt;user login&amp;amp;lt;/p&amp;amp;gt; is &amp;amp;lt;strong&amp;amp;gt;owasp-user01&amp;amp;lt;/strong&amp;amp;gt;&amp;quot;;&lt;br /&gt;
Assert.assertEquals(finalSafeOutputExpected, safeOutput);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Cross-site_Scripting_(XSS)| XSS]]&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/java-html-sanitizer&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/owasp-java-encoder/&lt;br /&gt;
&lt;br /&gt;
* https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html&lt;br /&gt;
&lt;br /&gt;
* https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/org/apache/commons/lang3/StringEscapeUtils.html&lt;br /&gt;
&lt;br /&gt;
== LDAP ==&lt;br /&gt;
&lt;br /&gt;
A dedicated [[LDAP_Injection_Prevention_Cheat_Sheet|cheatsheet]] has been created.&lt;br /&gt;
&lt;br /&gt;
== NoSQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a NoSQL API call expression.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
As there many NoSQL database system and each one use a API for call, it's important to ensure that user input received&lt;br /&gt;
and used to build the API call expression do not contains any character that have a special meaning in the target API syntax.&lt;br /&gt;
This in order to avoid that it will be used to escape the initial call expression in order to create another one based on crafted user input.&lt;br /&gt;
It's also important to not use string concatenation to build API call expression but use the API to create the expression.&lt;br /&gt;
&lt;br /&gt;
=== Example - MongoDB ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 /* Here use MongoDB as target NoSQL DB */&lt;br /&gt;
String userInput = &amp;quot;Brooklyn&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First ensure that the input do no contains any special characters for the current NoSQL DB call API,&lt;br /&gt;
here they are: ' &amp;quot; \ ; { } $&lt;br /&gt;
*/&lt;br /&gt;
//Avoid regexp this time in order to made validation code more easy to read and understand...&lt;br /&gt;
ArrayList&amp;lt;String&amp;gt; specialCharsList = new ArrayList&amp;lt;String&amp;gt;() {{&lt;br /&gt;
    add(&amp;quot;'&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\\&amp;quot;);&lt;br /&gt;
    add(&amp;quot;;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;{&amp;quot;);&lt;br /&gt;
    add(&amp;quot;}&amp;quot;);&lt;br /&gt;
    add(&amp;quot;$&amp;quot;);&lt;br /&gt;
}};&lt;br /&gt;
specialCharsList.forEach(specChar -&amp;gt; Assert.assertFalse(userInput.contains(specChar)));&lt;br /&gt;
//Add also a check on input max size&lt;br /&gt;
Assert.assertTrue(userInput.length() &amp;lt;= 50);&lt;br /&gt;
&lt;br /&gt;
/* Then perform query on database using API to build expression */&lt;br /&gt;
//Connect to the local MongoDB instance&lt;br /&gt;
try(MongoClient mongoClient = new MongoClient()){&lt;br /&gt;
    MongoDatabase db = mongoClient.getDatabase(&amp;quot;test&amp;quot;);&lt;br /&gt;
    //Use API query builder to create call expression&lt;br /&gt;
    //Create expression&lt;br /&gt;
    Bson expression = eq(&amp;quot;borough&amp;quot;, userInput);&lt;br /&gt;
    //Perform call&lt;br /&gt;
    FindIterable&amp;lt;org.bson.Document&amp;gt; restaurants = db.getCollection(&amp;quot;restaurants&amp;quot;).find(expression);&lt;br /&gt;
    //Verify result consistency&lt;br /&gt;
    restaurants.forEach(new Block&amp;lt;org.bson.Document&amp;gt;() {&lt;br /&gt;
        @Override&lt;br /&gt;
        public void apply(final org.bson.Document doc) {&lt;br /&gt;
            String restBorough = (String)doc.get(&amp;quot;borough&amp;quot;);&lt;br /&gt;
            Assert.assertTrue(&amp;quot;Brooklyn&amp;quot;.equals(restBorough));&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
[[Testing_for_NoSQL_injection|Testing for NoSQL injection]]&lt;br /&gt;
&lt;br /&gt;
https://ckarande.gitbooks.io/owasp-nodegoat-tutorial/content/tutorial/a1_-_sql_and_nosql_injection.html&lt;br /&gt;
&lt;br /&gt;
https://arxiv.org/ftp/arxiv/papers/1506/1506.04082.pdf&lt;br /&gt;
&lt;br /&gt;
== Log Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
[[Log_Injection|Log Injection]] occurs when an application uses untrusted data to create a message in an application log.&lt;br /&gt;
&lt;br /&gt;
More information about this attack is available on this OWASP [[Log_Injection|page]].&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
In order to prevent an attacker to be able to write arbitrary content into the application log, apply the following steps:&lt;br /&gt;
# Limit the size of the user input value used to create the log message.&lt;br /&gt;
# Encode the user input used to prevent injection using html tag.&lt;br /&gt;
# Filter the user input used to prevent injection of '''C'''arriage '''R'''eturn (CR) or '''L'''ine '''F'''eed (LF) characters.&lt;br /&gt;
&lt;br /&gt;
The project [[OWASP_Security_Logging_Project|OWASP Security Logging]] can be used to protect the application log against ''Log Injection'' attack.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Usage of the ''OWASP Security Logging'' features with the LOG4J2 logging API.&lt;br /&gt;
&lt;br /&gt;
Configuration of a logging policy to roll on 10 files of 5MB each one and encode/limit the log message using the ''OWASP Security Logging'' features (see the ''encode'' function usage in the ''Pattern'' tag):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Configuration status=&amp;quot;error&amp;quot; name=&amp;quot;SecureLoggingPolicy&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Appenders&amp;gt;&lt;br /&gt;
        &amp;lt;RollingFile name=&amp;quot;RollingFile&amp;quot; fileName=&amp;quot;App.log&amp;quot; filePattern=&amp;quot;App-%i.log&amp;quot; ignoreExceptions=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;PatternLayout&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Encode the message and limit is maximum size to 500 characters --&amp;gt;&lt;br /&gt;
                &amp;lt;Pattern&amp;gt;%d{ISO8601} %-5p - %encode{%.-500m}%n&amp;lt;/Pattern&amp;gt;&lt;br /&gt;
            &amp;lt;/PatternLayout&amp;gt;&lt;br /&gt;
            &amp;lt;Policies&amp;gt;&lt;br /&gt;
                &amp;lt;SizeBasedTriggeringPolicy size=&amp;quot;5MB&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Policies&amp;gt;&lt;br /&gt;
            &amp;lt;DefaultRolloverStrategy max=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/RollingFile&amp;gt;&lt;br /&gt;
    &amp;lt;/Appenders&amp;gt;&lt;br /&gt;
    &amp;lt;Loggers&amp;gt;&lt;br /&gt;
        &amp;lt;Root level=&amp;quot;debug&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AppenderRef ref=&amp;quot;RollingFile&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/Root&amp;gt;&lt;br /&gt;
    &amp;lt;/Loggers&amp;gt;&lt;br /&gt;
&amp;lt;/Configuration&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usage of the logger at code level:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.apache.logging.log4j.LogManager;&lt;br /&gt;
import org.apache.logging.log4j.Logger;&lt;br /&gt;
...&lt;br /&gt;
// No special action needed because security actions are performed at the logging policy level&lt;br /&gt;
Logger logger = LogManager.getLogger(MyClass.class);&lt;br /&gt;
logger.info(logMessage);&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/configuration.html&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/appenders.html&lt;br /&gt;
&lt;br /&gt;
https://github.com/javabeanz/owasp-security-logging&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
[[User:Dominique_RIGHETTO|Dominique Righetto]] - dominique.righetto@owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets = &lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245521</id>
		<title>Injection Prevention Cheat Sheet in Java</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Injection_Prevention_Cheat_Sheet_in_Java&amp;diff=245521"/>
				<updated>2018-11-26T13:16:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This document has for objective to provide some tips to handle ''Injection'' into Java application code.&lt;br /&gt;
&lt;br /&gt;
Sample codes used in tips are located [https://github.com/righettod/injection-cheat-sheets here].&lt;br /&gt;
&lt;br /&gt;
= What is Injection ? =&lt;br /&gt;
&lt;br /&gt;
[[Top_10_2013-A1-Injection|Injection]] in OWASP Top 10 is defined as following:&lt;br /&gt;
&lt;br /&gt;
''Consider anyone who can send untrusted data to the system, including external users, internal users, and administrators.''&lt;br /&gt;
&lt;br /&gt;
= General advices to prevent Injection =&lt;br /&gt;
&lt;br /&gt;
The following point can be applied, in a general way, to prevent ''Injection'' issue:&lt;br /&gt;
&lt;br /&gt;
#  Apply '''Input Validation''' (using whitelist approach) combined with '''Output Sanitizing+Escaping''' on user input/output.&lt;br /&gt;
#  If you need to interact with system, try to use API features provided by your technology stack (Java / .Net / PHP...) instead of building command.&lt;br /&gt;
&lt;br /&gt;
Additional advices are provided on this [[Input_Validation_Cheat_Sheet|cheatsheet]].&lt;br /&gt;
&lt;br /&gt;
= Specific Injection types =&lt;br /&gt;
&lt;br /&gt;
''Examples in this section will be provided in Java technology (see Maven project associated) but advices are applicable to others technologies like .Net / PHP / Ruby / Python...''&lt;br /&gt;
&lt;br /&gt;
== SQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a SQL query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''Query Parameterization'' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*No DB framework used here in order to show the real use of Prepared Statement from Java API*/&lt;br /&gt;
/*Open connection with H2 database and use it*/&lt;br /&gt;
Class.forName(&amp;quot;org.h2.Driver&amp;quot;);&lt;br /&gt;
String jdbcUrl = &amp;quot;jdbc:h2:file:&amp;quot; + new File(&amp;quot;.&amp;quot;).getAbsolutePath() + &amp;quot;/target/db&amp;quot;;&lt;br /&gt;
try (Connection con = DriverManager.getConnection(jdbcUrl)) {&lt;br /&gt;
&lt;br /&gt;
    /* Sample A: Select data using Prepared Statement*/&lt;br /&gt;
    String query = &amp;quot;select * from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    List&amp;lt;String&amp;gt; colors = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;yellow&amp;quot;);&lt;br /&gt;
        try (ResultSet rSet = pStatement.executeQuery()) {&lt;br /&gt;
            while (rSet.next()) {&lt;br /&gt;
                colors.add(rSet.getString(1));&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, colors.size());&lt;br /&gt;
    Assert.assertTrue(colors.contains(&amp;quot;yellow&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    /* Sample B: Insert data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;insert into color(friendly_name, red, green, blue) values(?, ?, ?, ?)&amp;quot;;&lt;br /&gt;
    int insertedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        pStatement.setInt(2, 239);&lt;br /&gt;
        pStatement.setInt(3, 125);&lt;br /&gt;
        pStatement.setInt(4, 11);&lt;br /&gt;
        insertedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, insertedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample C: Update data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;update color set blue = ? where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int updatedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setInt(1, 10);&lt;br /&gt;
        pStatement.setString(2, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        updatedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, updatedRecordCount);&lt;br /&gt;
&lt;br /&gt;
   /* Sample D: Delete data using Prepared Statement*/&lt;br /&gt;
    query = &amp;quot;delete from color where friendly_name = ?&amp;quot;;&lt;br /&gt;
    int deletedRecordCount;&lt;br /&gt;
    try (PreparedStatement pStatement = con.prepareStatement(query)) {&lt;br /&gt;
        pStatement.setString(1, &amp;quot;orange&amp;quot;);&lt;br /&gt;
        deletedRecordCount = pStatement.executeUpdate();&lt;br /&gt;
    }&lt;br /&gt;
    Assert.assertEquals(1, deletedRecordCount);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[SQL_Injection_Prevention_Cheat_Sheet|SQL Injection Prevention Cheat Sheet]]&lt;br /&gt;
&lt;br /&gt;
== JPA ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a JPA query using a String and execute it. It's quite similar to SQL injection but here the altered language is not SQL but JPA QL.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use Java Persistence Query Language '''Query Parameterization''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
EntityManager entityManager = null;&lt;br /&gt;
try {&lt;br /&gt;
    /* Get a ref on EntityManager to access DB */&lt;br /&gt;
    entityManager = Persistence.createEntityManagerFactory(&amp;quot;testJPA&amp;quot;).createEntityManager();&lt;br /&gt;
&lt;br /&gt;
    /* Define parametrized query prototype using named parameter to enhance readability */&lt;br /&gt;
    String queryPrototype = &amp;quot;select c from Color c where c.friendlyName = :colorName&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    /* Create the query, set the named parameter and execute the query */&lt;br /&gt;
    Query queryObject = entityManager.createQuery(queryPrototype);&lt;br /&gt;
    Color c = (Color) queryObject.setParameter(&amp;quot;colorName&amp;quot;, &amp;quot;yellow&amp;quot;).getSingleResult();&lt;br /&gt;
&lt;br /&gt;
    /* Ensure that the object obtained is the right one */&lt;br /&gt;
    Assert.assertNotNull(c);&lt;br /&gt;
    Assert.assertEquals(c.getFriendlyName(), &amp;quot;yellow&amp;quot;);&lt;br /&gt;
    Assert.assertEquals(c.getRed(), 213);&lt;br /&gt;
    Assert.assertEquals(c.getGreen(), 242);&lt;br /&gt;
    Assert.assertEquals(c.getBlue(), 26);&lt;br /&gt;
} finally {&lt;br /&gt;
    if (entityManager != null &amp;amp;&amp;amp; entityManager.isOpen()) {&lt;br /&gt;
        entityManager.close();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-persistence-api-jpa&lt;br /&gt;
&lt;br /&gt;
== Operating System ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a Operating System command using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use technology stack '''API''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/* The context taken is, for example, to perform a PING against a computer.&lt;br /&gt;
* The prevention is to use the feature provided by the Java API instead of building&lt;br /&gt;
* a system command as String and execute it */&lt;br /&gt;
InetAddress host = InetAddress.getByName(&amp;quot;localhost&amp;quot;);&lt;br /&gt;
Assert.assertTrue(host.isReachable(5000));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Command_Injection|Command Injection]]&lt;br /&gt;
&lt;br /&gt;
==  XML: External Entity attack ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application load the received XML stream using a XML parser instance in which the resolution of External Entity is not disabled.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Disable to resolution of the External Entity in the parser instance to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
// This is the PRIMARY defense. If DTDs (doctypes) are disallowed,&lt;br /&gt;
// almost all XML entity attacks are prevented&lt;br /&gt;
// Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
String feature = &amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, true);&lt;br /&gt;
&lt;br /&gt;
// If you can't completely disable DTDs, then at least do the following:&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-general-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities&lt;br /&gt;
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities&lt;br /&gt;
// JDK7+ - http://xml.org/sax/features/external-parameter-entities&lt;br /&gt;
feature = &amp;quot;http://xml.org/sax/features/external-parameter-entities&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// feature external DTDs as well&lt;br /&gt;
feature = &amp;quot;http://apache.org/xml/features/nonvalidating/load-external-dtd&amp;quot;;&lt;br /&gt;
dbf.setFeature(feature, false);&lt;br /&gt;
&lt;br /&gt;
// and these as well, per Timothy Morgan's 2014 paper: &amp;quot;XML Schema, DTD, and Entity Attacks&amp;quot;&lt;br /&gt;
dbf.setXIncludeAware(false);&lt;br /&gt;
dbf.setExpandEntityReferences(false);&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
//Here an org.xml.sax.SAXParseException will be throws because the XML contains a External Entity.&lt;br /&gt;
builder.parse(new File(&amp;quot;src/test/resources/SampleXXE.xml&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== XML: XPath Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a XPath query using a String and execute it.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Use '''XPath Variable Resolver''' in order to prevent injection.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
'''Variable Resolver''' implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Resolver in order to define parameter for XPATH expression.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleVariableResolver implements XPathVariableResolver {&lt;br /&gt;
&lt;br /&gt;
    private final Map&amp;lt;QName, Object&amp;gt; vars = new HashMap&amp;lt;QName, Object&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * External methods to add parameter&lt;br /&gt;
     *&lt;br /&gt;
     * @param name Parameter name&lt;br /&gt;
     * @param value Parameter value&lt;br /&gt;
     */&lt;br /&gt;
    public void addVariable(QName name, Object value) {&lt;br /&gt;
        vars.put(name, value);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * {@inheritDoc}&lt;br /&gt;
     *&lt;br /&gt;
     * @see javax.xml.xpath.XPathVariableResolver#resolveVariable(javax.xml.namespace.QName)&lt;br /&gt;
     */&lt;br /&gt;
    public Object resolveVariable(QName variableName) {&lt;br /&gt;
        return vars.get(variableName);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code using it to perform XPath query.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*Create a XML document builder factory*/&lt;br /&gt;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
&lt;br /&gt;
/*Disable External Entity resolution for differents cases*/&lt;br /&gt;
//Do not performed here in order to focus on variable resolver code&lt;br /&gt;
//but do it for production code !&lt;br /&gt;
&lt;br /&gt;
/*Load XML file*/&lt;br /&gt;
DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;
Document doc = builder.parse(new File(&amp;quot;src/test/resources/SampleXPath.xml&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/* Create and configure parameter resolver */&lt;br /&gt;
String bid = &amp;quot;bk102&amp;quot;;&lt;br /&gt;
SimpleVariableResolver variableResolver = new SimpleVariableResolver();&lt;br /&gt;
variableResolver.addVariable(new QName(&amp;quot;bookId&amp;quot;), bid);&lt;br /&gt;
&lt;br /&gt;
/*Create and configure XPATH expression*/&lt;br /&gt;
XPath xpath = XPathFactory.newInstance().newXPath();&lt;br /&gt;
xpath.setXPathVariableResolver(variableResolver);&lt;br /&gt;
XPathExpression xPathExpression = xpath.compile(&amp;quot;//book[@id=$bookId]&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
/* Apply expression on XML document */&lt;br /&gt;
Object nodes = xPathExpression.evaluate(doc, XPathConstants.NODESET);&lt;br /&gt;
NodeList nodesList = (NodeList) nodes;&lt;br /&gt;
Assert.assertNotNull(nodesList);&lt;br /&gt;
Assert.assertEquals(1, nodesList.getLength());&lt;br /&gt;
Element book = (Element)nodesList.item(0);&lt;br /&gt;
Assert.assertTrue(book.getTextContent().contains(&amp;quot;Ralls, Kim&amp;quot;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[XPATH_Injection|XPATH Injection]]&lt;br /&gt;
&lt;br /&gt;
== HTML/JavaScript/CSS ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a HTTP response and sent it to browser.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
Either apply strict input validation (whitelist approach) or use output sanitizing+escaping if input validation is not possible (combine both every time is possible).&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
INPUT WAY: Receive data from user&lt;br /&gt;
Here it's recommended to use strict input validation using whitelist approach.&lt;br /&gt;
In fact, you ensure that only allowed characters are part of the input received.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String userInput = &amp;quot;You user login is owasp-user01&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First we check that the value contains only expected character*/&lt;br /&gt;
Assert.assertTrue(Pattern.matches(&amp;quot;[a-zA-Z0-9\\s\\-]{1,50}&amp;quot;, userInput));&lt;br /&gt;
&lt;br /&gt;
/* If the first check pass then ensure that potential dangerous character that we have allowed&lt;br /&gt;
for business requirement are not used in a dangerous way.&lt;br /&gt;
For example here we have allowed the character '-', and, this can be used in SQL injection so, we&lt;br /&gt;
ensure that this character is not used is a continuous form.&lt;br /&gt;
Use the API COMMONS LANG v3 to help in String analysis...&lt;br /&gt;
*/&lt;br /&gt;
Assert.assertEquals(0, StringUtils.countMatches(userInput.replace(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;), &amp;quot;--&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
OUTPUT WAY: Send data to user&lt;br /&gt;
Here we escape + sanitize any data sent to user&lt;br /&gt;
Use the OWASP Java HTML Sanitizer API to handle sanitizing&lt;br /&gt;
Use the OWASP Java Encoder API to handle HTML tag encoding (escaping)&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
String outputToUser = &amp;quot;You &amp;lt;p&amp;gt;user login&amp;lt;/p&amp;gt; is &amp;lt;strong&amp;gt;owasp-user01&amp;lt;/strong&amp;gt;&amp;quot;;&lt;br /&gt;
outputToUser += &amp;quot;&amp;lt;script&amp;gt;alert(22);&amp;lt;/script&amp;gt;&amp;lt;img src='#' onload='javascript:alert(23);'&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* Create a sanitizing policy that only allow tag '&amp;lt;p&amp;gt;' and '&amp;lt;strong&amp;gt;'*/&lt;br /&gt;
PolicyFactory policy = new HtmlPolicyBuilder().allowElements(&amp;quot;p&amp;quot;, &amp;quot;strong&amp;quot;).toFactory();&lt;br /&gt;
&lt;br /&gt;
/* Sanitize the output that will be sent to user*/&lt;br /&gt;
String safeOutput = policy.sanitize(outputToUser);&lt;br /&gt;
&lt;br /&gt;
/* Encode HTML Tag*/&lt;br /&gt;
safeOutput = Encode.forHtml(safeOutput);&lt;br /&gt;
String finalSafeOutputExpected = &amp;quot;You &amp;amp;lt;p&amp;amp;gt;user login&amp;amp;lt;/p&amp;amp;gt; is &amp;amp;lt;strong&amp;amp;gt;owasp-user01&amp;amp;lt;/strong&amp;amp;gt;&amp;quot;;&lt;br /&gt;
Assert.assertEquals(finalSafeOutputExpected, safeOutput);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [[Cross-site_Scripting_(XSS)| XSS]]&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/java-html-sanitizer&lt;br /&gt;
&lt;br /&gt;
* https://github.com/owasp/owasp-java-encoder/&lt;br /&gt;
&lt;br /&gt;
* https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html&lt;br /&gt;
&lt;br /&gt;
* https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/org/apache/commons/lang3/StringEscapeUtils.html&lt;br /&gt;
&lt;br /&gt;
== LDAP ==&lt;br /&gt;
&lt;br /&gt;
A dedicated [[LDAP_Injection_Prevention_Cheat_Sheet|cheatsheet]] has been created.&lt;br /&gt;
&lt;br /&gt;
== NoSQL ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
Injection of this type occur when the application use untrusted user input to build a NoSQL API call expression.&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
As there many NoSQL database system and each one use a API for call, it's important to ensure that user input received&lt;br /&gt;
and used to build the API call expression do not contains any character that have a special meaning in the target API syntax.&lt;br /&gt;
This in order to avoid that it will be used to escape the initial call expression in order to create another one based on crafted user input.&lt;br /&gt;
It's also important to not use string concatenation to build API call expression but use the API to create the expression.&lt;br /&gt;
&lt;br /&gt;
=== Example - MongoDB ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 /* Here use MongoDB as target NoSQL DB */&lt;br /&gt;
String userInput = &amp;quot;Brooklyn&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/* First ensure that the input do no contains any special characters for the current NoSQL DB call API,&lt;br /&gt;
here they are: ' &amp;quot; \ ; { } $&lt;br /&gt;
*/&lt;br /&gt;
//Avoid regexp this time in order to made validation code more easy to read and understand...&lt;br /&gt;
ArrayList&amp;lt;String&amp;gt; specialCharsList = new ArrayList&amp;lt;String&amp;gt;() {{&lt;br /&gt;
    add(&amp;quot;'&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;\\&amp;quot;);&lt;br /&gt;
    add(&amp;quot;;&amp;quot;);&lt;br /&gt;
    add(&amp;quot;{&amp;quot;);&lt;br /&gt;
    add(&amp;quot;}&amp;quot;);&lt;br /&gt;
    add(&amp;quot;$&amp;quot;);&lt;br /&gt;
}};&lt;br /&gt;
specialCharsList.forEach(specChar -&amp;gt; Assert.assertFalse(userInput.contains(specChar)));&lt;br /&gt;
//Add also a check on input max size&lt;br /&gt;
Assert.assertTrue(userInput.length() &amp;lt;= 50);&lt;br /&gt;
&lt;br /&gt;
/* Then perform query on database using API to build expression */&lt;br /&gt;
//Connect to the local MongoDB instance&lt;br /&gt;
try(MongoClient mongoClient = new MongoClient()){&lt;br /&gt;
    MongoDatabase db = mongoClient.getDatabase(&amp;quot;test&amp;quot;);&lt;br /&gt;
    //Use API query builder to create call expression&lt;br /&gt;
    //Create expression&lt;br /&gt;
    Bson expression = eq(&amp;quot;borough&amp;quot;, userInput);&lt;br /&gt;
    //Perform call&lt;br /&gt;
    FindIterable&amp;lt;org.bson.Document&amp;gt; restaurants = db.getCollection(&amp;quot;restaurants&amp;quot;).find(expression);&lt;br /&gt;
    //Verify result consistency&lt;br /&gt;
    restaurants.forEach(new Block&amp;lt;org.bson.Document&amp;gt;() {&lt;br /&gt;
        @Override&lt;br /&gt;
        public void apply(final org.bson.Document doc) {&lt;br /&gt;
            String restBorough = (String)doc.get(&amp;quot;borough&amp;quot;);&lt;br /&gt;
            Assert.assertTrue(&amp;quot;Brooklyn&amp;quot;.equals(restBorough));&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
[[Testing_for_NoSQL_injection|Testing for NoSQL injection]]&lt;br /&gt;
&lt;br /&gt;
https://ckarande.gitbooks.io/owasp-nodegoat-tutorial/content/tutorial/a1_-_sql_and_nosql_injection.html&lt;br /&gt;
&lt;br /&gt;
https://arxiv.org/ftp/arxiv/papers/1506/1506.04082.pdf&lt;br /&gt;
&lt;br /&gt;
== Log Injection ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom ===&lt;br /&gt;
&lt;br /&gt;
[[Log_Injection]] occurs when an application uses untrusted data to create a message in an application log.&lt;br /&gt;
&lt;br /&gt;
More information about this attack is available on this OWASP [[Log_Injection|page]].&lt;br /&gt;
&lt;br /&gt;
=== How to prevent ===&lt;br /&gt;
&lt;br /&gt;
In order to prevent an attacker to be able to write arbitrary content into the application log, apply the following steps:&lt;br /&gt;
# Limit the size of the user input value used to create the log message.&lt;br /&gt;
# Encode the user input used to prevent injection using html tag.&lt;br /&gt;
# Filter the user input used to prevent injection of '''C'''arriage '''R'''eturn (CR) or '''L'''ine '''F'''eed (LF) characters.&lt;br /&gt;
&lt;br /&gt;
The project [[OWASP_Security_Logging_Project|OWASP Security Logging]] can be used to protect the application log against ''Log Injection'' attack.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Usage of the ''OWASP Security Logging'' features with the LOG4J2 logging API.&lt;br /&gt;
&lt;br /&gt;
Configuration of a logging policy to roll on 10 files of 5MB each one and encode/limit the log message using the ''OWASP Security Logging'' features (see the ''encode'' function usage in the ''Pattern'' tag):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Configuration status=&amp;quot;error&amp;quot; name=&amp;quot;SecureLoggingPolicy&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Appenders&amp;gt;&lt;br /&gt;
        &amp;lt;RollingFile name=&amp;quot;RollingFile&amp;quot; fileName=&amp;quot;App.log&amp;quot; filePattern=&amp;quot;App-%i.log&amp;quot; ignoreExceptions=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;PatternLayout&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Encode the message and limit is maximum size to 500 characters --&amp;gt;&lt;br /&gt;
                &amp;lt;Pattern&amp;gt;%d{ISO8601} %-5p - %encode{%.-500m}%n&amp;lt;/Pattern&amp;gt;&lt;br /&gt;
            &amp;lt;/PatternLayout&amp;gt;&lt;br /&gt;
            &amp;lt;Policies&amp;gt;&lt;br /&gt;
                &amp;lt;SizeBasedTriggeringPolicy size=&amp;quot;5MB&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Policies&amp;gt;&lt;br /&gt;
            &amp;lt;DefaultRolloverStrategy max=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/RollingFile&amp;gt;&lt;br /&gt;
    &amp;lt;/Appenders&amp;gt;&lt;br /&gt;
    &amp;lt;Loggers&amp;gt;&lt;br /&gt;
        &amp;lt;Root level=&amp;quot;debug&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AppenderRef ref=&amp;quot;RollingFile&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/Root&amp;gt;&lt;br /&gt;
    &amp;lt;/Loggers&amp;gt;&lt;br /&gt;
&amp;lt;/Configuration&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usage of the logger at code level:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.apache.logging.log4j.LogManager;&lt;br /&gt;
import org.apache.logging.log4j.Logger;&lt;br /&gt;
...&lt;br /&gt;
// No special action needed because security actions are performed at the logging policy level&lt;br /&gt;
Logger logger = LogManager.getLogger(MyClass.class);&lt;br /&gt;
logger.info(logMessage);&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/configuration.html&lt;br /&gt;
&lt;br /&gt;
https://logging.apache.org/log4j/2.x/manual/appenders.html&lt;br /&gt;
&lt;br /&gt;
https://github.com/javabeanz/owasp-security-logging&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
[[User:Dominique_RIGHETTO|Dominique Righetto]] - dominique.righetto@owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets = &lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245496</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245496"/>
				<updated>2018-11-25T11:53:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup defense mechanism 3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is to inform Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etc. Good programmers like to keep code readable and usable by other Code Reviewers of the team. The risk is that attackers could map these selectors to actual features of a web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated by access control level. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on. Make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for a user with the proper access control level.  Only users with the proper access control level should be able to access their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file. &lt;br /&gt;
&lt;br /&gt;
If an authenticated user with the '''Student''' Role tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; through forced browsing, an alert that an intrusion is occurring should be recorded.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that attackers are not informed what a specific selector is linking to.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; could be named &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. These names could be randomly generated per user as well.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
Web applications that allow users to author content via HTML input could be vulnerable to malicious use of CSS. Uploaded HTML could use styles that are allowed by the web application but could be used for purposes other than intended which could lead to security risks.&lt;br /&gt;
&lt;br /&gt;
Example: You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability which allowed malicious use of CSS that lead to the authoring of a page where the entire page was clickable including overwriting LinkedIn's standard navigation elements.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245495</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245495"/>
				<updated>2018-11-25T11:44:22Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: clearity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is to inform Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etc. Good programmers like to keep code readable and usable by other Code Reviewers of the team. The risk is that attackers could map these selectors to actual features of a web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated by access control level. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on. Make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for a user with the proper access control level.  Only users with the proper access control level should be able to access their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file. &lt;br /&gt;
&lt;br /&gt;
If an authenticated user with the '''Student''' Role tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; through forced browsing, an alert that an intrusion is occurring should be recorded.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that attackers are not informed what a specific selector is linking to.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; could be named &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. These names could be randomly generated per user as well.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245494</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245494"/>
				<updated>2018-11-25T11:41:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is to inform Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etc. Good programmers like to keep code readable and usable by other Code Reviewers of the team. The risk is that attackers could map these selectors to actual features of a web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated by access control level. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on. Make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for a user with the proper access control level.  Only users with the proper access control level should be able to access their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file. &lt;br /&gt;
&lt;br /&gt;
If an authenticated user with the '''Student''' Role tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; through forced browsing, an alert that an intrusion is occurring should be recorded.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245493</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245493"/>
				<updated>2018-11-25T11:40:32Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: edits for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is to inform Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etc. Good programmers like to keep code readable and usable by other Code Reviewers of the team. The risk is that attackers could map these selectors to actual features of a web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated by access control level. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on. &lt;br /&gt;
&lt;br /&gt;
Make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for a user with the proper access control level.  Only users with the proper access control level should be able to access their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file. &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files should not be loaded for users without proper access.&lt;br /&gt;
&lt;br /&gt;
If an authenticated user with the '''Student''' Role tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; through forced browsing, access should of course be denied and alert that an intrusion is occurring should be recorded.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245492</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245492"/>
				<updated>2018-11-25T11:33:58Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: editing for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is to inform Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etc. Good programmers like to keep code readable and usable by other Code Reviewers of the team. The risk is that attackers could map these selectors to actual features of a web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file and other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #1''':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student):&lt;br /&gt;
  load(Student.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Please login using your credentials”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #2''':&lt;br /&gt;
&lt;br /&gt;
If '''Student''' Role (authenticated user) tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; forcefully through the URL by replacing &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt;, the permission should not be granted and the request should be forbidden because the '''Student''' Role doesn’t have access to any other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file except &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student)&lt;br /&gt;
  load(AdministratorStyling.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245491</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245491"/>
				<updated>2018-11-25T11:30:57Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: editing for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security when authoring “Cascading Style Sheets.”&lt;br /&gt;
&lt;br /&gt;
This cheat sheet will help you mitigate risks associated with Cascading Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and authors a Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only do these roles have different access controls, but these roles could also have different styling for webpages that might be specific to an individual or group of roles.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimized idea to create a “global styling” css file which has all the CSS styling/selectors for all of the roles. According to their role, a specific feature or user interface element will be rendered. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
Example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before other attacks. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim can use the CSS for intel gathering to help gain access to sensitive roles.This isa form of attacker due diligence even before trying to perform dangerous attacks to gain access to the web application. &lt;br /&gt;
&lt;br /&gt;
In a nutshell, having global styling could reveal sensitive information that could be beneficial to the attacker.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file and other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #1''':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student):&lt;br /&gt;
  load(Student.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Please login using your credentials”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #2''':&lt;br /&gt;
&lt;br /&gt;
If '''Student''' Role (authenticated user) tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; forcefully through the URL by replacing &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt;, the permission should not be granted and the request should be forbidden because the '''Student''' Role doesn’t have access to any other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file except &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student)&lt;br /&gt;
  load(AdministratorStyling.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245490</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245490"/>
				<updated>2018-11-25T11:22:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: move for name change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Securing Cascading Style_Sheets (CSS)_Cheat_Sheet]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245489</id>
		<title>Securing Cascading Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascading_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245489"/>
				<updated>2018-11-25T11:22:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: move for page title name change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascading Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering: ''How is Cascading Style Sheet going to impact on Application Security?'' &lt;br /&gt;
&lt;br /&gt;
Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascading Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. &lt;br /&gt;
&lt;br /&gt;
For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file and other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #1''':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student):&lt;br /&gt;
  load(Student.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Please login using your credentials”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #2''':&lt;br /&gt;
&lt;br /&gt;
If '''Student''' Role (authenticated user) tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; forcefully through the URL by replacing &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt;, the permission should not be granted and the request should be forbidden because the '''Student''' Role doesn’t have access to any other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file except &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student)&lt;br /&gt;
  load(AdministratorStyling.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245488</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245488"/>
				<updated>2018-11-25T11:20:17Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cascade to cascading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS]], but [https://www.w3schools.com/css/css_intro.asp Cascading Style Sheet]) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascading Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering: ''How is Cascading Style Sheet going to impact on Application Security?'' &lt;br /&gt;
&lt;br /&gt;
Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascading Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let's demonstrate this risk with an example:&lt;br /&gt;
&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascading Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - [[Access Control Cheat Sheet|Permission Based Access Control]]) and Roles (RBAC - [[Access Control Cheat Sheet|Role Based Access Control]]). Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. &lt;br /&gt;
&lt;br /&gt;
For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. &lt;br /&gt;
&lt;br /&gt;
For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
* .login&lt;br /&gt;
* .profileStudent&lt;br /&gt;
* .changePassword&lt;br /&gt;
* .addUsers&lt;br /&gt;
* .deleteUsers&lt;br /&gt;
* .addNewAdmin&lt;br /&gt;
* .deleteAdmin&lt;br /&gt;
* .exportUserData&lt;br /&gt;
* .exportProfileData&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like &amp;lt;code&amp;gt;.profileSettings, .editUser, .addUser, .deleteUser&amp;lt;/code&amp;gt; and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like &amp;lt;code&amp;gt;.profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword&amp;lt;/code&amp;gt; etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application.&lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means '''Student''' will have a different CSS file called as &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; while '''Administrator''' has &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file and other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #1''':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student):&lt;br /&gt;
  load(Student.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Please login using your credentials”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Scenario #2''':&lt;br /&gt;
&lt;br /&gt;
If '''Student''' Role (authenticated user) tries to access &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt; forcefully through the URL by replacing &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;AdministratorStyling.CSS&amp;lt;/code&amp;gt;, the permission should not be granted and the request should be forbidden because the '''Student''' Role doesn’t have access to any other &amp;lt;code&amp;gt;*.CSS&amp;lt;/code&amp;gt; file except &amp;lt;code&amp;gt;StudentStyling.CSS&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot; JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
if Role(student)&lt;br /&gt;
  load(AdministratorStyling.CSS)&lt;br /&gt;
else:&lt;br /&gt;
  print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascading Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use [https://developer.mozilla.org/son/docs/Tools Web Developer Tools] to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for &amp;lt;code&amp;gt;addUser, addAdmin, profileSettings, changePassword&amp;lt;/code&amp;gt; can be something like &amp;lt;code&amp;gt;aHj879JK, bHjsU, ahkrrE, lOiksn&amp;lt;/code&amp;gt; respectively. &lt;br /&gt;
&lt;br /&gt;
This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
This [https://www.npmjs.com/package/rename-css-selectors NPM package] can be used to perform the renaming of the CSS selector.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. &lt;br /&gt;
&lt;br /&gt;
You can read about how [https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529 LinkedIn] had a vulnerability through Cascading Style Sheet which was fixed once reported.&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -  https://www.linkedin.com/in/santhosh-tuppad-338b7412/&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Template:Cheatsheet_Navigation_Body&amp;diff=245437</id>
		<title>Template:Cheatsheet Navigation Body</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Template:Cheatsheet_Navigation_Body&amp;diff=245437"/>
				<updated>2018-11-24T09:38:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: added css security&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;See documentation of [[Template:navigationBoxBegin|the navigationBoxBegin template]] to see how this works...&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{navigationBoxBegin|title=[[Cheat_Sheets|Cheat Sheets]]|editlink={{FULLPAGENAME}}}}&lt;br /&gt;
{{navigationBoxRow|title=Developer / Builder|content=&lt;br /&gt;
* [[3rd_Party_Javascript_Management_Cheat_Sheet|3rd Party Javascript Management]]&lt;br /&gt;
* [[Access Control Cheat Sheet|Access Control]]&lt;br /&gt;
* [[AJAX Security Cheat Sheet]]&lt;br /&gt;
* [[Authentication Cheat Sheet|Authentication]] ([[Authentication_Cheat_Sheet_Español|ES]])&lt;br /&gt;
* [[Bean Validation Cheat Sheet]]&lt;br /&gt;
* [[Choosing and Using Security Questions Cheat Sheet|Choosing and Using Security Questions]]&lt;br /&gt;
* [[Clickjacking Defense Cheat Sheet|Clickjacking Defense]]&lt;br /&gt;
* [[Credential Stuffing Prevention Cheat Sheet]]&lt;br /&gt;
* [[Cross-Site Request Forgery (CSRF) Prevention Cheat Sheet|Cross-Site Request Forgery (CSRF) Prevention]]&lt;br /&gt;
* [[Cryptographic Storage Cheat Sheet|Cryptographic Storage]]&lt;br /&gt;
* [[C-Based Toolchain Hardening Cheat Sheet|C-Based Toolchain Hardening]]&lt;br /&gt;
* [[Securing Cascade Style Sheets (CSS) Cheat Sheet|CSS Security]]&lt;br /&gt;
* [[Deserialization_Cheat_Sheet|Deserialization]]&lt;br /&gt;
* [[DOM based XSS Prevention Cheat Sheet|DOM based XSS Prevention]]&lt;br /&gt;
* [[Forgot Password Cheat Sheet|Forgot Password]]&lt;br /&gt;
* [[HTML5 Security Cheat Sheet|HTML5 Security]]&lt;br /&gt;
* [[HTTP Strict Transport Security Cheat Sheet|HTTP Strict Transport Security]]&lt;br /&gt;
* [[Injection Prevention Cheat Sheet]]&lt;br /&gt;
* [[Injection Prevention Cheat Sheet in Java]]&lt;br /&gt;
* [[JSON Web Token (JWT) Cheat Sheet for Java]]&lt;br /&gt;
* [[Input Validation Cheat Sheet|Input Validation]]&lt;br /&gt;
* [[Insecure Direct Object Reference Prevention Cheat Sheet|Insecure Direct Object Reference Prevention]]&lt;br /&gt;
* [[JAAS Cheat Sheet|JAAS]]&lt;br /&gt;
* [[Key Management Cheat Sheet|Key Management]]&lt;br /&gt;
* [[LDAP Injection Prevention Cheat Sheet|LDAP Injection Prevention]]&lt;br /&gt;
* [[Logging Cheat Sheet|Logging]]&lt;br /&gt;
* [[Mass Assignment Cheat Sheet]]&lt;br /&gt;
* [[.NET Security Cheat Sheet|.NET Security]]&lt;br /&gt;
* [[OS Command Injection Defense Cheat Sheet]]&lt;br /&gt;
* [[OWASP Top Ten Cheat Sheet|OWASP Top Ten]]&lt;br /&gt;
* [[Password Storage Cheat Sheet|Password Storage]]&lt;br /&gt;
* [[Pinning Cheat Sheet|Pinning]]&lt;br /&gt;
* [[Query Parameterization Cheat Sheet|Query Parameterization]]&lt;br /&gt;
* [[REST Security Cheat Sheet|REST Security]]&lt;br /&gt;
* [[Ruby on Rails Cheatsheet|Ruby on Rails]]&lt;br /&gt;
* [[Session Management Cheat Sheet|Session Management]]&lt;br /&gt;
* [[SAML Security Cheat Sheet|SAML Security]]&lt;br /&gt;
* [[SQL Injection Prevention Cheat Sheet|SQL Injection Prevention]]&lt;br /&gt;
* [[Transaction Authorization Cheat Sheet|Transaction Authorization]]&lt;br /&gt;
* [[Transport Layer Protection Cheat Sheet|Transport Layer Protection]]&lt;br /&gt;
* [[TLS_Cipher_String_Cheat_Sheet|TLS Cipher String Configuration]]&lt;br /&gt;
* [[Unvalidated Redirects and Forwards Cheat Sheet|Unvalidated Redirects and Forwards]]&lt;br /&gt;
* [[User Privacy Protection Cheat Sheet|User Privacy Protection]]&lt;br /&gt;
* [[Web Service Security Cheat Sheet|Web Service Security]]&lt;br /&gt;
* [[XSS (Cross Site Scripting) Prevention Cheat Sheet|XSS (Cross Site Scripting) Prevention]]&lt;br /&gt;
* [[XML External Entity (XXE) Prevention Cheat Sheet]]&lt;br /&gt;
}}&lt;br /&gt;
{{navigationBoxRow|title=Assessment / Breaker|content=&lt;br /&gt;
* [[Attack Surface Analysis Cheat Sheet|Attack Surface Analysis]]&lt;br /&gt;
* [[REST Assessment Cheat Sheet|REST Assessment]]&lt;br /&gt;
* [[Web Application Security Testing Cheat Sheet|Web Application Security Testing]]&lt;br /&gt;
* [[XML Security Cheat Sheet]]&lt;br /&gt;
* [[XSS Filter Evasion Cheat Sheet|XSS Filter Evasion]]&lt;br /&gt;
}}&lt;br /&gt;
{{navigationBoxRow|title=Mobile|content=&lt;br /&gt;
* [[Android_Testing_Cheat_Sheet|Android Testing]]&lt;br /&gt;
* [[IOS Developer Cheat Sheet|IOS Developer]]&lt;br /&gt;
* [[Mobile Jailbreaking Cheat Sheet|Mobile Jailbreaking]]&lt;br /&gt;
}}&lt;br /&gt;
{{navigationBoxRow|title=OpSec / Defender|content=&lt;br /&gt;
* [[Virtual Patching Cheat Sheet|Virtual Patching]]&lt;br /&gt;
* [[Vulnerability Disclosure Cheat Sheet|Vulnerability Disclosure]]&lt;br /&gt;
}}&lt;br /&gt;
{{navigationBoxRow|title=Draft and Beta|content=&lt;br /&gt;
* [[Application Security Architecture Cheat Sheet|Application Security Architecture]]&lt;br /&gt;
* [[Business Logic Security Cheat Sheet|Business Logic Security]]&lt;br /&gt;
* [[Content Security Policy Cheat Sheet|Content Security Policy]]&lt;br /&gt;
* [[Denial of Service Cheat Sheet]]&lt;br /&gt;
* [[Grails Secure Code Review Cheat Sheet|Grails Secure Code Review]]&lt;br /&gt;
* [[IOS Application Security Testing Cheat Sheet|IOS Application Security Testing]]&lt;br /&gt;
* [[PHP Security Cheat Sheet|PHP Security]]&lt;br /&gt;
* [[Regular Expression Security Cheatsheet]]&lt;br /&gt;
* [[Secure Coding Cheat Sheet|Secure Coding]]&lt;br /&gt;
* [[Secure SDLC Cheat Sheet|Secure SDLC]]&lt;br /&gt;
* [[Threat Modeling Cheat Sheet|Threat Modeling]]&lt;br /&gt;
}}&lt;br /&gt;
{{navigationBoxEnd|content=[[:Category:Cheatsheets|All Pages In This Category]]}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245436</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245436"/>
				<updated>2018-11-24T09:34:17Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not XSS, but Cascade Style Sheet) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascade Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering, “How is Cascade Style Sheet going to impact on Application Security? Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascade Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let’s demonstrate this risk with an example,&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascade Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - Permission Based Access Control) and Roles (RBAC - Role Based Access Control).Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
.login&lt;br /&gt;
.profileStudent&lt;br /&gt;
.changePassword&lt;br /&gt;
.addUsers&lt;br /&gt;
.deleteUsers&lt;br /&gt;
.addNewAdmin&lt;br /&gt;
.deleteAdmin&lt;br /&gt;
.exportUserData&lt;br /&gt;
.exportProfileData&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at *.CSS files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like .profileSettings, .editUser, .addUser, .deleteUser and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like .profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application. &lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means “Student” will have a different CSS file called as “StudentStyling.CSS” while “Administrator” has “AdministratorStyling.CSS” and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these *.CSS files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their *.CSS file and other *.CSS file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #1&amp;lt;/b&amp;gt;&lt;br /&gt;
 if Role(student):&lt;br /&gt;
 load(Student.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
 print(“Please login using your credentials”)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #2&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Student Role (authenticated user) tries to access AdministratorStyling.CSS forcefully through the URL by replacing StudentStyling.CSS with AdministratorStyling.CSS, the permission should not be granted and the request should be forbidden because the Student Role doesn’t have access to any other *.CSS file except “StudentStyling.CSS”.&lt;br /&gt;
&lt;br /&gt;
 if Role(student)&lt;br /&gt;
 load(AdministratorStyling.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
 print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascade Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use “Web Developer Tools” to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for addUser, addAdmin, profileSettings, changePassword can be something like aHj879JK, bHjsU, ahkrrE, lOiksn respectively. This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. You can read about how LinkedIn had a vulnerability through Cascade Style Sheet which was fixed once reported. You can read the article provided in the “References” section.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -santhosh[at]tuppad@gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245435</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245435"/>
				<updated>2018-11-24T09:33:21Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not XSS, but Cascade Style Sheet) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascade Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering, “How is Cascade Style Sheet going to impact on Application Security? Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascade Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let’s demonstrate this risk with an example,&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascade Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - Permission Based Access Control) and Roles (RBAC - Role Based Access Control).Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
.login&lt;br /&gt;
.profileStudent&lt;br /&gt;
.changePassword&lt;br /&gt;
.addUsers&lt;br /&gt;
.deleteUsers&lt;br /&gt;
.addNewAdmin&lt;br /&gt;
.deleteAdmin&lt;br /&gt;
.exportUserData&lt;br /&gt;
.exportProfileData&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at *.CSS files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like .profileSettings, .editUser, .addUser, .deleteUser and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like .profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application. &lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means “Student” will have a different CSS file called as “StudentStyling.CSS” while “Administrator” has “AdministratorStyling.CSS” and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these *.CSS files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their *.CSS file and other *.CSS file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #1&amp;lt;/b&amp;gt;&lt;br /&gt;
 if Role(student):&lt;br /&gt;
 load(Student.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
 print(“Please login using your credentials”)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #2&amp;lt;/b&amp;gt;&lt;br /&gt;
If Student Role (authenticated user) tries to access AdministratorStyling.CSS forcefully through the URL by replacing StudentStyling.CSS with AdministratorStyling.CSS, the permission should not be granted and the request should be forbidden because the Student Role doesn’t have access to any other *.CSS file except “StudentStyling.CSS”.&lt;br /&gt;
&lt;br /&gt;
 if Role(student)&lt;br /&gt;
 load(AdministratorStyling.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
 print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascade Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use “Web Developer Tools” to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for addUser, addAdmin, profileSettings, changePassword can be something like aHj879JK, bHjsU, ahkrrE, lOiksn respectively. This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. You can read about how LinkedIn had a vulnerability through Cascade Style Sheet which was fixed once reported. You can read the article provided in the “References” section.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -santhosh[at]tuppad@gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245434</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245434"/>
				<updated>2018-11-24T09:32:50Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: small fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not XSS, but Cascade Style Sheet) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascade Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering, “How is Cascade Style Sheet going to impact on Application Security? Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascade Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let’s demonstrate this risk with an example,&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascade Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - Permission Based Access Control) and Roles (RBAC - Role Based Access Control).Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
.login&lt;br /&gt;
.profileStudent&lt;br /&gt;
.changePassword&lt;br /&gt;
.addUsers&lt;br /&gt;
.deleteUsers&lt;br /&gt;
.addNewAdmin&lt;br /&gt;
.deleteAdmin&lt;br /&gt;
.exportUserData&lt;br /&gt;
.exportProfileData&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at *.CSS files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like .profileSettings, .editUser, .addUser, .deleteUser and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like .profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application. &lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense Mechanism #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means “Student” will have a different CSS file called as “StudentStyling.CSS” while “Administrator” has “AdministratorStyling.CSS” and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these *.CSS files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their *.CSS file and other *.CSS file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #1&amp;lt;/b&amp;gt;&lt;br /&gt;
 if Role(student):&lt;br /&gt;
	load(Student.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
	print(“Please login using your credentials”)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #2&amp;lt;/b&amp;gt;&lt;br /&gt;
If Student Role (authenticated user) tries to access AdministratorStyling.CSS forcefully through the URL by replacing StudentStyling.CSS with AdministratorStyling.CSS, the permission should not be granted and the request should be forbidden because the Student Role doesn’t have access to any other *.CSS file except “StudentStyling.CSS”.&lt;br /&gt;
&lt;br /&gt;
 if Role(student)&lt;br /&gt;
	load(AdministratorStyling.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
	print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascade Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use “Web Developer Tools” to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for addUser, addAdmin, profileSettings, changePassword can be something like aHj879JK, bHjsU, ahkrrE, lOiksn respectively. This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. You can read about how LinkedIn had a vulnerability through Cascade Style Sheet which was fixed once reported. You can read the article provided in the “References” section.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -santhosh[at]tuppad@gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245433</id>
		<title>Securing Cascade Style Sheets (CSS) Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_Cascade_Style_Sheets_(CSS)_Cheat_Sheet&amp;diff=245433"/>
				<updated>2018-11-24T09:32:08Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: css security cheatsheet&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
The goal of this “CSS (Not XSS, but Cascade Style Sheet) Cheat Sheet is intended for Programmers, Testers, Security Analysts, Front-End Developers and anyone who is interested in Web Application Security to use these recommendations or requirements in order to achieve better security from “Cascade Style Sheet” perspective.&lt;br /&gt;
&lt;br /&gt;
You may be confused and wondering, “How is Cascade Style Sheet going to impact on Application Security? Your situation is completely fair enough if you are confused to understand this and that is why this Cheat Sheet will help you to understand and also mitigate risks associated with Cascade Style Sheet that you use in your Web Application.&lt;br /&gt;
&lt;br /&gt;
Let’s demonstrate this risk with an example,&lt;br /&gt;
Santhosh is a programmer who works for a company called “X” and writes Cascade Style Sheet to implement styling of the web application. The application for which he is writing CSS Code has various roles like “Student”, “Teacher”, “Super User” &amp;amp; “Administrator” and these roles have different permissions (PBAC - Permission Based Access Control) and Roles (RBAC - Role Based Access Control).Not only these roles have different access controls, but also styling of the webpages for every role is totally different.&lt;br /&gt;
&lt;br /&gt;
Santhosh thinks that it would a great optimised idea to create a “global styling” css file which has all the CSS styling/selectors for all the roles. Note that, there is only login webpage through which all the roles can login and they will be authenticated based on their access control list or roles. According to their role, the specific features of a particular role will be loaded on to the pages. For instance, Administrator will have different features compared to “Student” or “Teacher” or “SuperUser”. However, some permissions or features maybe common to some roles. For example: Profile Settings will be applicable to all the users here while “Adding Users” or “Deleting Users” is only applicable for “Administrator”.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
.login&lt;br /&gt;
.profileStudent&lt;br /&gt;
.changePassword&lt;br /&gt;
.addUsers&lt;br /&gt;
.deleteUsers&lt;br /&gt;
.addNewAdmin&lt;br /&gt;
.deleteAdmin&lt;br /&gt;
.exportUserData&lt;br /&gt;
.exportProfileData&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
Now, let’s examine what are the risks associated with this style of coding.&lt;br /&gt;
&lt;br /&gt;
== Risk #1 ==&lt;br /&gt;
Motivated Attackers always take a look at *.CSS files to learn the features of the application even without being logged in.&lt;br /&gt;
&lt;br /&gt;
For instance: Jim is a motivated attacker and always tries to look into CSS files from the View-Source even before thinking of attacking the web application to compromise the accounts and gain unauthorized access. When Jim looks into the CSS file, he sees that there are different features and different roles based on the CSS selectors like .profileSettings, .editUser, .addUser, .deleteUser and so on. Jim does this intel gathering and this process of OSINT (Open Source Intelligence) motivates him to go further and attack the web application to gain access to sensitive roles. In an attacker’s perspective, it is him doing due diligence even before trying to perform dangerous attacks to gain access to the web application. Once an attacker knows what’s inside the house, he is fully sure that he would get that treasure once he exploits any vulnerability to reach that access.&lt;br /&gt;
&lt;br /&gt;
In a nutshell, having a global styling motivates malicious hackers / attackers to proceed further. Had Santhosh not created this kind of global styling, probably Jim would have not been motivated as much as he was motivated looking into global styling and learning about attack areas of the application.&lt;br /&gt;
&lt;br /&gt;
== Risk #2 ==&lt;br /&gt;
Let’s say, Santhosh has this habit of writing the descriptive selector names like .profileSettings, exportUserData, .changePassword, .oldPassword, .newPassword, .confirmNewPassword etcetera. He loves to keep his code readable and usable by other Code Reviewers in his team. Of course, code Readability is one of the good practice; but when you are thinking of “Security”, let’s not think about “Usability” because when I am setting up front-door for my home, I am thinking about my safety from thieves and this door has to be really be secure enough and I don’t think about usability by saying, “Ah, I don’t want to get this door because it wastes my time in terms of closing and opening while I also need to lock it using a key”.&lt;br /&gt;
&lt;br /&gt;
Going back to Santhosh’s context, the risk is hackers or attackers can always get great hint from these descriptive selector names which match with the features of the web application. &lt;br /&gt;
&lt;br /&gt;
= Defensive Mechanisms to Mitigate Attacker’s Motivation =&lt;br /&gt;
&lt;br /&gt;
==  Defense #1 ==&lt;br /&gt;
As a CSS Coder / Programmer, always keep the CSS isolated. By this, it means “Student” will have a different CSS file called as “StudentStyling.CSS” while “Administrator” has “AdministratorStyling.CSS” and so on.&lt;br /&gt;
&lt;br /&gt;
Once you do this, make sure these *.CSS files are accessed only for an authenticated user while you keep the public pages like login (login.CSS) same for everyone.&lt;br /&gt;
&lt;br /&gt;
And also, only users with a specific role should be able to access only their *.CSS file and other *.CSS file should not be loaded and also should have authorisation to access it.&lt;br /&gt;
&lt;br /&gt;
For instance, if the role is student we need to have a logic similar to following.&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #1&amp;lt;/b&amp;gt;&lt;br /&gt;
 if Role(student):&lt;br /&gt;
	load(Student.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
	print(“Please login using your credentials”)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Scenario #2&amp;lt;/b&amp;gt;&lt;br /&gt;
If Student Role (authenticated user) tries to access AdministratorStyling.CSS forcefully through the URL by replacing StudentStyling.CSS with AdministratorStyling.CSS, the permission should not be granted and the request should be forbidden because the Student Role doesn’t have access to any other *.CSS file except “StudentStyling.CSS”.&lt;br /&gt;
&lt;br /&gt;
 if Role(student)&lt;br /&gt;
	load(AdministratorStyling.CSS)&lt;br /&gt;
 else:&lt;br /&gt;
	print(“Sorry, you are not authorized to access this file”)&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #2 ==&lt;br /&gt;
&lt;br /&gt;
Being a programmer or a tester, take care of the naming conventions of your CSS (Cascade Style Sheet) Selectors. Obfuscate the selector names in such a fashion that hackers don’t get a hint of what a specific selector is linking to. Of course, your customers or users who have access to their roles can always use “Web Developer Tools” to perform reverse-engineering in order to know the features using those selectors as they are authorised to use your application. However, they are not under Threat Actor category based on the context.&lt;br /&gt;
&lt;br /&gt;
Example: CSS Selectors for addUser, addAdmin, profileSettings, changePassword can be something like aHj879JK, bHjsU, ahkrrE, lOiksn respectively. This is just an example and you can use your own custom obfuscation, but watch out for “Rogue Insiders” who leave the company or who share the information about this specific obfuscation that you use in your code. Also, there have to be guidelines in terms of who should do this obfuscation activity and what happens when they leave the company? Of course, someone in the company need to change this obfuscation because someone out there in the web world knows what keys are you using?&lt;br /&gt;
&lt;br /&gt;
Note that the usage of online obfuscators or some tools maybe deobfuscated very quickly and attacker can use the online de-obfuscators if you are using prefabricated tools.&lt;br /&gt;
&lt;br /&gt;
== Defense Mechanism #3 ==&lt;br /&gt;
&lt;br /&gt;
If your web application sends some styling via JSON request in specific features for various reasons, then make sure that the properties and values are not tampered with and also reject anything that appears to be suspicious or anything that is out of your whitelist. This attack may work even when you have escaped characters, or done input encoding and output encoding. &lt;br /&gt;
&lt;br /&gt;
Example: Someone may just tamper with the request body of a specific feature and edit the styling to create an attack where height or width can be changed to make it look like fullpage &amp;amp; also every part of the webpage is clickable which will redirect the users to malicious websites which will inturn have multitude of attacks. You can read about how LinkedIn had a vulnerability through Cascade Style Sheet which was fixed once reported. You can read the article provided in the “References” section.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
https://www.scmagazineuk.com/style-sheet-vulnerability-allowed-attacker-hijack-linkedin-pages/article/1479529&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Santhosh Tuppad -santhosh[at]tuppad@gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:Popular]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V20_Internet_of_Things&amp;diff=244937</id>
		<title>ASVS V20 Internet of Things</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V20_Internet_of_Things&amp;diff=244937"/>
				<updated>2018-11-07T16:48:35Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V19_Configuration&amp;diff=244936</id>
		<title>ASVS V19 Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V19_Configuration&amp;diff=244936"/>
				<updated>2018-11-07T16:48:21Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V18_API&amp;diff=244935</id>
		<title>ASVS V18 API</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V18_API&amp;diff=244935"/>
				<updated>2018-11-07T16:48:13Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V17_Mobile&amp;diff=244934</id>
		<title>ASVS V17 Mobile</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V17_Mobile&amp;diff=244934"/>
				<updated>2018-11-07T16:46:22Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V16_Files_and_Resources&amp;diff=244933</id>
		<title>ASVS V16 Files and Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V16_Files_and_Resources&amp;diff=244933"/>
				<updated>2018-11-07T16:46:12Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V15_Business_Logic_Flaws&amp;diff=244932</id>
		<title>ASVS V15 Business Logic Flaws</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V15_Business_Logic_Flaws&amp;diff=244932"/>
				<updated>2018-11-07T16:46:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V13_Malicious_Code&amp;diff=244931</id>
		<title>ASVS V13 Malicious Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V13_Malicious_Code&amp;diff=244931"/>
				<updated>2018-11-07T16:45:56Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V10_Communications&amp;diff=244930</id>
		<title>ASVS V10 Communications</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V10_Communications&amp;diff=244930"/>
				<updated>2018-11-07T16:45:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V9_Data_Protection&amp;diff=244929</id>
		<title>ASVS V9 Data Protection</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V9_Data_Protection&amp;diff=244929"/>
				<updated>2018-11-07T16:45:40Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V8_Error_Handling&amp;diff=244928</id>
		<title>ASVS V8 Error Handling</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V8_Error_Handling&amp;diff=244928"/>
				<updated>2018-11-07T16:45:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V7_Cryptography&amp;diff=244927</id>
		<title>ASVS V7 Cryptography</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V7_Cryptography&amp;diff=244927"/>
				<updated>2018-11-07T16:45:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V5_Input_validation_and_output_encoding&amp;diff=244926</id>
		<title>ASVS V5 Input validation and output encoding</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V5_Input_validation_and_output_encoding&amp;diff=244926"/>
				<updated>2018-11-07T16:45:15Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V4_Access_Control&amp;diff=244925</id>
		<title>ASVS V4 Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V4_Access_Control&amp;diff=244925"/>
				<updated>2018-11-07T16:45:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V3_Session_Management&amp;diff=244924</id>
		<title>ASVS V3 Session Management</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V3_Session_Management&amp;diff=244924"/>
				<updated>2018-11-07T16:44:58Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: de&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V2_Authentication&amp;diff=244923</id>
		<title>ASVS V2 Authentication</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V2_Authentication&amp;diff=244923"/>
				<updated>2018-11-07T16:44:46Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: delete&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ASVS_V1_Architecture&amp;diff=244922</id>
		<title>ASVS V1 Architecture</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ASVS_V1_Architecture&amp;diff=244922"/>
				<updated>2018-11-07T16:44:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: delete&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{taggedDocument&lt;br /&gt;
| type=delete&lt;br /&gt;
| comment=Tagged via fixme/delete.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=244921</id>
		<title>Category:OWASP Application Security Verification Standard Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Application_Security_Verification_Standard_Project&amp;diff=244921"/>
				<updated>2018-11-07T16:43:27Z</updated>
		
		<summary type="html">&lt;p&gt;Jmanico: 4.0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Home =&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:90px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File: flagship_big.jpg|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_Projects]]&amp;lt;/div&amp;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;
== What is ASVS? ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Application Security Verification Standard (ASVS) Project provides a basis for testing web application technical security controls and also provides developers with a list of requirements for secure development.&lt;br /&gt;
&lt;br /&gt;
The primary aim of the '''OWASP Application Security Verification Standard (ASVS) Project''' is to normalize the range in the coverage and level of rigor available in the market when it comes to performing Web application security verification using a commercially-workable open standard. The standard provides a basis for testing application technical security controls, as well as any technical security controls in the environment, that are relied on to protect against vulnerabilities such as Cross-Site Scripting (XSS) and SQL injection. This standard can be used to establish a level of confidence in the security of Web applications. The requirements were developed with the following objectives in mind: &lt;br /&gt;
&lt;br /&gt;
*'''Use as a metric''' - Provide application developers and application owners with a yardstick with which to assess the degree of trust that can be placed in their Web applications, &lt;br /&gt;
*'''Use as guidance''' - Provide guidance to security control developers as to what to build into security controls in order to satisfy application security requirements, and &lt;br /&gt;
*'''Use during procurement''' - Provide a basis for specifying application security verification requirements in contracts.&lt;br /&gt;
&lt;br /&gt;
== OWASP ASVS 4.0 will be released in late 2018 ==&lt;br /&gt;
&lt;br /&gt;
Please note there will &amp;lt;b&amp;gt;not be a 3.1 release&amp;lt;/b&amp;gt; and we will be going directly from ASVS 3.0.1 to 4.0 soon!&lt;br /&gt;
&lt;br /&gt;
== Email List ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]] [https://lists.owasp.org/mailman/listinfo/owasp-application-security-verification-standard Project Email List]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
&lt;br /&gt;
Daniel Cuthbert [mailto:Daniel.Cuthbert@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Andrew van der Stock [mailto:vanderaj@owasp.org @]&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico [mailto:jim.manico@owasp.org @]&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
*[https://www.owasp.org/index.php/OWASP_Proactive_Controls OWASP Top Ten Proactive Controls (2016)]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project OWASP Top Ten Risks (2013)] &lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Guide_Project OWASP Development Guide] &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;
ASVS 3.0.1 in English.&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== News and Events ==&lt;br /&gt;
&lt;br /&gt;
* [9 March 2018] [https://docs.google.com/spreadsheets/d/1ic7gsib--Cn4ujrA8rhvzuUmMFpQ2Jkl96SZDCEtqJg/edit?ts=5a6bafe1#gid=950526877 OWASP Application Security Verification Standard 3.1 Spreadsheet] created by August Detlefsen&lt;br /&gt;
* [29 June 2016] [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Version 3.0.1]] released!&lt;br /&gt;
* [9 Oct 2015] Version 3.0 released&lt;br /&gt;
* [20 May 2015] &amp;quot;First Cut&amp;quot; Version 3.0 released&lt;br /&gt;
* [11 Aug 2014] Version 2.0 released&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-flagship-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Flagship_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;
= Downloads =&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 3.0.1 '''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in English ==&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:OWASP_Application_Security_Verification_Standard_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Spanish==&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.pdf|Download PDF - 1.7 MB]]&lt;br /&gt;
* [[Media:Estándar_de_Verificación_de_Seguridad_en_Aplicaciones_3.0.1.docx|Download Word - 835 kB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Polish==&lt;br /&gt;
* [[Media:OWASP Application Security Verification Standard 3.0.1 PL.pdf|Download PDF - 1.5 MB]]&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0.1 in Persian==&lt;br /&gt;
* [[Media:OWASP ASVS 3.0.1 (Persian).pdf|Download PDF - 2.84 MB]]&lt;br /&gt;
&lt;br /&gt;
We are looking for translators for this version. If you can help us, please contact the project mail list!&lt;br /&gt;
&lt;br /&gt;
'''Legacy Application Security Verification Standard 3.0'''&lt;br /&gt;
&lt;br /&gt;
== ASVS 3.0 in English ==&lt;br /&gt;
* [[Media:OWASPApplicationSecurityVerificationStandard3.0.pdf|download PDF - 1.2 MB]]&lt;br /&gt;
* [[Media:ASVS-excel.xlsx|ASVS 3.0 excel sheet  - 39 kB]]&lt;br /&gt;
&lt;br /&gt;
== Older versions ==&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 2.0 (final)'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.pdf|download PDF - 1.6 MB]])&lt;br /&gt;
* ASVS 2.0 in English ([[Media:OWASP_ASVS_Version_2.docx|download Word - 1.0MB]])&lt;br /&gt;
* ASVS 2.0 in Persian ([[Media:OWASP_ASVS_Version_2_Persian.pdf|download PDF - 1.6MB]])&lt;br /&gt;
* ASVS 2.0 in Polish (checklist) ([[Media:Asvs_2_PL.xlsx|download Excel]])&lt;br /&gt;
&lt;br /&gt;
'''Application Security Verification Standard 1.0 - 2009'''&lt;br /&gt;
&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.pdf|download PDF - 2.5 MB]])&lt;br /&gt;
* ASVS 1.0 Final (English) ([[Media:OWASP_ASVS_2009_Web_App_Std_Release.doc|download Word - 2.3 MB]])&lt;br /&gt;
&lt;br /&gt;
= Acknowledgements =&lt;br /&gt;
&lt;br /&gt;
== Volunteers ==&lt;br /&gt;
&lt;br /&gt;
=== Version 3 (2015) ===&lt;br /&gt;
&lt;br /&gt;
Project Leaders&lt;br /&gt;
&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
&lt;br /&gt;
Lead Author&lt;br /&gt;
*Jim Manico&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Boy Baukema &lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Colin Watson &lt;br /&gt;
*François-Eric Guyomarc’h&lt;br /&gt;
*Cristinel Dumitru &lt;br /&gt;
*James Holland&lt;br /&gt;
*Gary Robinson&lt;br /&gt;
*Stephen de Vries&lt;br /&gt;
*Glenn Ten Cate&lt;br /&gt;
*Riccardo Ten Cate&lt;br /&gt;
*Martin Knobloch&lt;br /&gt;
*Abhinav Sejpal&lt;br /&gt;
*David Ryan&lt;br /&gt;
*Steven van der Baan&lt;br /&gt;
*Ryan Dewhurst&lt;br /&gt;
*Raoul Endres&lt;br /&gt;
*Roberto Martelloni&lt;br /&gt;
&lt;br /&gt;
=== Version 2 (2014) ===&lt;br /&gt;
&lt;br /&gt;
Project leaders&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
*Sahba Kazerooni&lt;br /&gt;
*Daniel Cuthbert&lt;br /&gt;
*Krishna Raja&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
*Jerome Athias&lt;br /&gt;
*Boy Baukema&lt;br /&gt;
*Archangel Cuison&lt;br /&gt;
*Sebastien.Deleersnyder&lt;br /&gt;
*Antonio Fontes&lt;br /&gt;
*Evan Gaustad&lt;br /&gt;
*Safuat Hamdy&lt;br /&gt;
*Ari Kesäniemi&lt;br /&gt;
*Scott Luc&lt;br /&gt;
*Jim Manico&lt;br /&gt;
*Mait Peekma&lt;br /&gt;
*Pekka Sillanpää&lt;br /&gt;
*Jeff Sergeant&lt;br /&gt;
*Etienne Stalmans&lt;br /&gt;
*Colin Watson&lt;br /&gt;
*Dr. Emin İslam Tatlı&lt;br /&gt;
&lt;br /&gt;
Translators&lt;br /&gt;
*Abbas Javan Jafari (Persian)&lt;br /&gt;
*Sajjad Pourali (Persian)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Version 2009 ===&lt;br /&gt;
&lt;br /&gt;
Project leader&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
&lt;br /&gt;
Lead authors&lt;br /&gt;
*Mike Boberski&lt;br /&gt;
*Jeff Williams&lt;br /&gt;
*Dave Wichers&lt;br /&gt;
&lt;br /&gt;
Other reviewers and contributors&lt;br /&gt;
&lt;br /&gt;
Pierre Parrend (OWASP Summer of Code), Andrew van der Stock, Nam Nguyen, John Martin, Gaurang Shah, Theodore Winograd, Stan Wisseman, Barry Boyd, Steve Coyle, Paul Douthit, Ken Huang, Dave Hausladen, Mandeep Khera Scott Matsumoto, John Steven, Stephen de Vries, Dan Cornell, Shouvik Bardhan, Dr. Sarbari Gupta, Eoin Keary, Richard Campbell, Matt Presson, Jeff LoSapio, Liz Fong, George Lawless, Dave van Stein, Terrie Diaz, Ketan Dilipkumar Vyas, Bedirhan Urgun, Dr. Thomas Braun, Colin Watson, Jeremiah Grossman.&lt;br /&gt;
&lt;br /&gt;
== OWASP Summer of Code 2008 ==&lt;br /&gt;
&lt;br /&gt;
The OWASP Foundation sponsored the OWASP Application Security Verification Standard Project during the OWASP Summer of Code 2008.&lt;br /&gt;
&lt;br /&gt;
= Glossary =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''ASVS Terminology''' &lt;br /&gt;
&lt;br /&gt;
*'''Access Control''' – A means of restricting access to files, referenced functions, URLs, and data based on the identity of users and/or groups to which they belong. &lt;br /&gt;
*'''Application Component''' – An individual or group of source files, libraries, and/or executables, as defined by the verifier for a particular application. &lt;br /&gt;
*'''Application Security''' – Application-level security focuses on the analysis of components that comprise the application layer of the Open Systems Interconnection Reference Model (OSI Model), rather than focusing on for example the underlying operating system or connected networks. &lt;br /&gt;
*'''Application Security Verification''' – The technical assessment of an application against the OWASP ASVS. &lt;br /&gt;
*'''Application Security Verification Report''' – A report that documents the overall results and supporting analysis produced by the verifier for a particular application. &lt;br /&gt;
*'''Application Security Verification Standard (ASVS)''' – An OWASP standard that defines four levels of application security verification for applications. &lt;br /&gt;
*'''Authentication''' – The verification of the claimed identity of an application user. &lt;br /&gt;
*'''Automated Verification''' – The use of automated tools (either dynamic analysis tools, static analysis tools, or both) that use vulnerability signatures to find problems. &lt;br /&gt;
*'''Back Doors''' – A type of malicious code that allows unauthorized access to an application. &lt;br /&gt;
*'''Blacklist''' – A list of data or operations that are not permitted, for example a list of characters that are not allowed as input. &lt;br /&gt;
*'''Common Criteria (CC)''' – A multipart standard that can be used as the basis for the verification of the design and implementation of security controls in IT products. &lt;br /&gt;
*'''Communication Security''' – The protection of application data when it is transmitted between application components, between clients and servers, and between external systems and the application. &lt;br /&gt;
*'''Design Verification''' – The technical assessment of the security architecture of an application. &lt;br /&gt;
*'''Internal Verification''' – The technical assessment of specific aspects of the security architecture of an application as defined in the OWASP ASVS. &lt;br /&gt;
*'''Cryptographic module''' – Hardware, software, and/or firmware that implements cryptographic algorithms and/or generates cryptographic keys. &lt;br /&gt;
*'''Denial of Service (DOS) Attacks''' – The flooding of an application with more requests than it can handle. &lt;br /&gt;
*'''Dynamic Verification''' – The use of automated tools that use vulnerability signatures to find problems during the execution of an application. &lt;br /&gt;
*'''Easter Eggs''' – A type of malicious code that does not run until a specific user input event occurs. &lt;br /&gt;
*'''External Systems''' – A server-side application or service that is not part of the application. &lt;br /&gt;
*'''FIPS 140-2''' – A standard that can be used as the basis for the verification of the design and implementation of cryptographic modules &lt;br /&gt;
*'''Input Validation''' – The canonicalization and validation of untrusted user input. &lt;br /&gt;
*'''Malicious Code''' – Code introduced into an application during its development unbeknownst to the application owner which circumvents the application’s intended security policy. Not the same as malware such as a virus or worm! &lt;br /&gt;
*'''Malware''' – Executable code that is introduced into an application during runtime without the knowledge of the application user or administrator. &lt;br /&gt;
*'''Open Web Application Security Project (OWASP)''' – The Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. Our mission is to make application security &amp;quot;visible,&amp;quot; so that people and organizations can make informed decisions about application security risks. See: http://www.owasp.org/ &lt;br /&gt;
*'''Output Validation''' – The canonicalization and validation of application output to Web browsers and to external systems. &lt;br /&gt;
*'''OWASP Enterprise Security API (ESAPI)''' – A free and open collection of all the security methods that developers need to build secure Web applications. See: http://www.owasp.org/index.php/ESAPI &lt;br /&gt;
*'''OWASP Risk Rating Methodology''' – A risk rating methodology that has been customized for application security. See: http://www.owasp.org/index.php/How_to_value_the_real_risk &lt;br /&gt;
*'''OWASP Testing Guide''' – A document designed to help organizations understand what comprises a testing program, and to help them identify the steps needed to build and operate that testing program. See: http://www.owasp.org/index.php/Category:OWASP_Testing_Project &lt;br /&gt;
*'''OWASP Top Ten''' – A document that represents a broad consensus about what the most critical Web application security flaws are. See: http://www.owasp.org/index.php/Top10 &lt;br /&gt;
*'''Positive''' – See whitelist. &lt;br /&gt;
*'''Salami Attack''' – A type of malicious code that is used to redirect small amounts of money without detection in financial transactions. &lt;br /&gt;
*'''Security Architecture''' – An abstraction of an application’s design that identifies and describes where and how security controls are used, and also identifies and describes the location and sensitivity of both user and application data. &lt;br /&gt;
*'''Security Control''' – A function or component that performs a security check (e.g. an access control check) or when called results in a security effect (e.g. generating an audit record). &lt;br /&gt;
*'''Security Configuration''' – The runtime configuration of an application that affects how security controls are used. &lt;br /&gt;
*'''Static Verification''' – The use of automated tools that use vulnerability signatures to find problems in application source code. &lt;br /&gt;
*'''Target of Verification (TOV)''' – If you are performing an application security verification according to the OWASP ASVS requirements, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. &lt;br /&gt;
*'''Threat Modeling''' - A technique consisting of developing increasingly refined security architectures to identify threat agents, security zones, security controls, and important technical and business assets. &lt;br /&gt;
*'''Time Bomb''' – A type of malicious code that does not run until a preconfigured time or date elapses. &lt;br /&gt;
*'''Verifier''' - The person or team that is reviewing an application against the OWASP ASVS requirements. &lt;br /&gt;
*'''Whitelist''' – A list of permitted data or operations, for example a list of characters that are allowed to perform input validation.&lt;br /&gt;
&lt;br /&gt;
= ASVS Users  =&lt;br /&gt;
[[Image:Asvs-handshake.JPG]]&lt;br /&gt;
&lt;br /&gt;
A broad range of companies and agencies around the globe have added ASVS to their software assurance tool boxes, including [http://www.aspectsecurity.com Aspect Security], [http://www.astyran.com Astyran], [http://www.boozallen.com Booz Allen Hamilton], [http://casabasecurity.com Casaba Security], [http://www.cgi.com/web/en/industries/governments/us_federal/services_solutions.htm CGI Federal], [http://denimgroup.com Denim Group], [http://etebaran.com Etebaran Informatics], [http://www.mindedsecurity.com Minded Security], [http://www.nixu.com Nixu], [http://www.pstestware.com/ ps_testware], [http://www.proactiverisk.com Proactive Risk], [http://quince.co.uk Quince Associates Limited (SeeMyData)], [http://www.serpro.gov.br/ Serviço Federal de Processamento de Dados (SERPRO)], [http://www.udistrital.edu.co/ Universidad Distrital Francisco José de Caldas] Organizations listed are not accredited by OWASP. Neither their products or services have been endorsed by OWASP. Use of ASVS may include for example providing verification services using the standard. Use of ASVS may also include for example performing internal evaluation of products with the OWASP ASVS in mind, and NOT making any claims of meeting any given level in the standard. Please let us know how your organization is using OWASP ASVS. Include your name, organization's name, and brief description of how you use the standard. The project lead can be reached [mailto:sahba@securitycompass.com here].&lt;br /&gt;
&lt;br /&gt;
= Precedents-Interpretations =&lt;br /&gt;
&lt;br /&gt;
'''PI-0001: Are there levels between the levels?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: Are there levels between the levels for the cases where &amp;quot;The specification for an application may require OWASP ASVS Level N, but it could also include other additional detailed requirements such as from a higher ASVS level&amp;quot;? &lt;br /&gt;
*Resolution: No. Use of alternate level definitions or notations such as &amp;quot;ASVS Level 1B+&amp;quot; is discouraged. &lt;br /&gt;
*References: ASVS section &amp;quot;Application Security Verification Levels&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''PI-0002: Is use of a master key simply another level of indirection?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: If a master key is stored as plaintext, isn't using a master key simply another level of indirection? &lt;br /&gt;
*Resolution: No. There is a strong rationale for having a &amp;quot;master key&amp;quot; stored in a secure location that is used to encrypt all other secrets. In many applications, there are lots of secrets stored in many different locations. This greatly increases the likelihood that one of them will be compromised. Having a single master key makes managing the protection considerably simpler and is not simply a level of indirection. &lt;br /&gt;
*References: ASVS verification requirement V2.14&lt;br /&gt;
&lt;br /&gt;
'''PI-0003: What is a &amp;quot;TOV&amp;quot; or &amp;quot;Target of Verification&amp;quot;?''' &lt;br /&gt;
&lt;br /&gt;
*Issue: New terminology &lt;br /&gt;
*Resolution: If you are performing an application security verification according to ASVS, the verification will be of a particular application. This application is called the &amp;quot;Target of Verification&amp;quot; or simply the TOV. The TOV should be identified in verification documentation as follows: &lt;br /&gt;
**TOV Identification – &amp;amp;lt;name and version of the application&amp;amp;gt; or &amp;amp;lt;Application name&amp;amp;gt;, &amp;amp;lt;application version&amp;amp;gt;, dynamic testing was performed in a staging environment, not the production environment &lt;br /&gt;
**TOV Developer – &amp;amp;lt;insert name of the developer or verification customer&amp;amp;gt; &lt;br /&gt;
*References: ASVS section &amp;quot;Approach&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Internationalization =&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]&lt;br /&gt;
If you can help with translations, please download the latest draft here:&lt;br /&gt;
&lt;br /&gt;
https://github.com/OWASP/ASVS&lt;br /&gt;
&lt;br /&gt;
If there are any incomprehensible English idiom or phrases in there, please don't hesitate to ask for clarification, because if it's hard to translate, it's almost certainly wrong in English as well. We recommend logging translation issues in GitHub, too, so please make yourself known. &lt;br /&gt;
&lt;br /&gt;
Translations are coordinated through OWASP's Crowd In account, so you don't have to do the entire thing yourself. &lt;br /&gt;
&lt;br /&gt;
https://crowdin.com/project/owasp-asvs/&lt;br /&gt;
&lt;br /&gt;
You don't HAVE to use Crowd In, but it would be nice to indicate to other native speakers of your language that you are willing to work together. This is a 70 page document, and in all honesty, will take a dedicated person a week or more to translate, so please please please work together rather than apart. You have full access to the original document and the original images, so you have everything I have.&lt;br /&gt;
&lt;br /&gt;
= Archive - Previous Version =&lt;br /&gt;
&lt;br /&gt;
'''*Please note that ASVS is currently on version 3.0.  The information on this page is for archival purposes only.*'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step1.jpg]]'1. About ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*Video presentation in English [https://www.youtube.com/watch?v=Ba6ncpIfaJA (YouTube)] &lt;br /&gt;
*ASVS vs. WASC et al [http://www.owasp.org/index.php/ASVS_vs_WASC_Et_Al (Wiki)]&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'2. Get ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS in Bahasa Indonesia (Indonesian language) ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-id.pdf PDF])&lt;br /&gt;
*ASVS in Bahasa Malaysia (Malay) (Currently under development!)&lt;br /&gt;
*ASVS in Chinese(Currently under development!) &lt;br /&gt;
*ASVS in English ([http://www.owasp.org/images/4/4e/OWASP_ASVS_2009_Web_App_Std_Release.pdf PDF], [http://www.owasp.org/images/3/35/OWASP_ASVS_2009_Web_App_Std_Release.doc Word], [http://code.google.com/p/owasp-asvs/wiki/ASVS '''Online'''], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-xml.zip XML]) &lt;br /&gt;
*ASVS in French ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-fr.odt OpenOffice]) &lt;br /&gt;
*ASVS in German ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-de.doc Word])&lt;br /&gt;
*ASVS in Hungarian (Currently under development!) &lt;br /&gt;
*ASVS in Japanese ([http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.pdf PDF], [http://owasp-asvs.googlecode.com/svn/trunk/documentation/asvs-webapp-release-2009-jp.doc Word]) &lt;br /&gt;
*ASVS in Persian (Farsi) ([http://abiusx.com/archive/document/OWASP-ASVS-fa-20111115.pdf PDF]) beta 0.7&lt;br /&gt;
*ASVS in Polish ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pl.pdf PDF])&lt;br /&gt;
*ASVS in Portuguese-Brazil ([http://owasp-asvs.googlecode.com/files/asvs-webapp-release-2009-pt-br.pdf PDF])&lt;br /&gt;
*ASVS in Spanish (Currently under development!)&lt;br /&gt;
*ASVS in Thai (Currently under development!)&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'3. Learn ASVS 1.0' &lt;br /&gt;
&lt;br /&gt;
*ASVS Article: Getting Started Using ASVS ([http://www.owasp.org/images/f/f8/OWASP_ASVS_Article_-_Getting_Started_Using_ASVS.pdf PDF]) &lt;br /&gt;
*ASVS Article: Code Reviews and Other Verification Activities: USELESS Unless Acted Upon IMMEDIATELY [http://www.owasp.org/index.php/Code_Reviews_and_Other_Verification_Activities:_USELESS_Unless_Acted_Upon_IMMEDIATELY (Wiki)] &lt;br /&gt;
*ASVS Article: Agile Software Development: Don't Forget EVIL User Stories ([http://www.owasp.org/index.php/Agile_Software_Development:_Don%27t_Forget_EVIL_User_Stories Wiki]) &lt;br /&gt;
*ASVS Article: Man vs. Code ([http://www.owasp.org/index.php/Man_vs._Code Wiki]) &lt;br /&gt;
*ASVS Article: Getting started designing for a level of assurance ([http://www.owasp.org/images/0/01/Getting_started_designing_for_a_level_of_assurance.pdf PDF]) &lt;br /&gt;
*ASVS Template: Sample verification fee schedule template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel]) &lt;br /&gt;
*ASVS Template: Sample verification report template ([http://www.owasp.org/index.php/Image:Sample_ASVS_Report_Template.doc Word]) &lt;br /&gt;
*ASVS Training: An ASVS training presentation ([http://www.owasp.org/index.php/Image:OWASP_AU_Secure_Architecture_and_Coding.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Executive-Level Presentation ([http://www.owasp.org/images/9/99/About_OWASP_ASVS_Executive_Presentation.ppt PowerPoint]) &lt;br /&gt;
*ASVS Presentation: Presentation Abstract ([http://www.owasp.org/images/1/10/OWASP_ASVS_Presentation_Abstract.doc Word]) &lt;br /&gt;
*Articles [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project#Articles_Below_-_More_About_ASVS_and_Using_It (More About ASVS and Using It)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP_Project|Application Security Verification Standard Project]]&lt;br /&gt;
[[Category:OWASP_Document]]&lt;br /&gt;
[[Category:OWASP_Download]]&lt;br /&gt;
[[Category:OWASP_Release_Quality_Document|OWASP Stable Quality Document]]&lt;br /&gt;
[[Category:SAMM-CR-1]]&lt;br /&gt;
[[Category:SAMM-DR-2]]&lt;br /&gt;
[[Category:SAMM-ST-3]]&lt;/div&gt;</summary>
		<author><name>Jmanico</name></author>	</entry>

	</feed>