<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>ocCODE</title>
	<atom:link href="http://occ0de.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://occ0de.wordpress.com</link>
	<description>obsessive-compulsive coding stuff.</description>
	<lastBuildDate>Wed, 20 Sep 2006 04:18:59 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='occ0de.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/d9c63f426e5e59304463274ada540608?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>ocCODE</title>
		<link>http://occ0de.wordpress.com</link>
	</image>
			<item>
		<title>Full shownotes for L3pprd/ocC0DE&#8217;s Cross-site Scripting episode</title>
		<link>http://occ0de.wordpress.com/2006/09/19/hello-world/</link>
		<comments>http://occ0de.wordpress.com/2006/09/19/hello-world/#comments</comments>
		<pubDate>Tue, 19 Sep 2006 21:05:46 +0000</pubDate>
		<dc:creator>occ0de</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[What is Cross-site Scripting?
Cross-site scripting (XSS) is a very common vulnerability in web applications which can have a variety of different unintented effects.
The basics of cross-site scripting are simple:  You use a website in an unintended way such that you can insert javascript code in with the HTML pages that the user normally sees. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=occ0de.wordpress.com&blog=424990&post=1&subd=occ0de&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>What is Cross-site Scripting?</b></p>
<p>Cross-site scripting (XSS) is a very common vulnerability in web applications which can have a variety of different unintented effects.</p>
<p>The basics of cross-site scripting are simple:  You use a website in an unintended way such that you can insert javascript code in with the HTML pages that the user normally sees.  </p>
<p><b>What can it do?</b></p>
<p>Cross-site scripting can cause all sorts of problems.  Since cross-site scripting is all javascript-based, an attacker who successfully exploits your site can do anything that Javascript can do.  In a worst-case scenario, a cross-site scripting attack can execute anything on the local machine, with privileges of the logged-on user.</p>
<p>Nefarious hackers have done all sorts of things that are anything from annoying to incredibly malicious and profiteering.</p>
<p>Cross-site scripting is often used for cookie theft.  A crafted cross-site scripting attack can be used to steal cookies from users who browse your site.  If your site is an e-commerce site, it could expose their shopping history.  It could their usernames and passwords, and be used to track where your users go on the net and what they do.</p>
<p><b>How the bad guys exploit it:</b></p>
<p>According to Wikipedia, there are three major types of Cross-site scripting attacks.</p>
<p>A Type-0 vulnerability is one where a malicious page tricks your browser into running Javascript code on your local computer in a trusted mode.</p>
<p>A Type-1 vulnerability is the most common type.  In a Type-1 vulnerability, a text string is input from the user and written out to a browser without validation, which could possibly contain script.  This is no big deal, usually, since a user can only write code out to their own browser.  This becomes a big deal, however, if a spammer or phisher sends out a link containing some malicious script code.</p>
<p>A Type-2 vulnerability is similar with the exception that the user&#8217;s input is stored to a database or similar storage facility.  This malicious script will usually be visible to the browser of anyone who visits the site.  This can be devastating since there are a large number of users potentially affected, and the malicious code becomes persistent.</p>
<p><b>How to prevent against it if you&#8217;re a webmaster:</b></p>
<p>It may seem simple, but validate everything!  Every piece of text that comes from the user needs to be validated, to ensure there is no javascript included.  As a web programmer, this becomes incredibly complex when you take into account that there are a huge number of HTML tags that can contain javascript in their events, such as onclick.  There is a very extensive cheat sheet on ha.ckers.org which shows different strings to test against forms and url parameters in your website to ensure it&#8217;s fairly safe against XSS vulnerabilities.</p>
<p>Most server-side scripting languages provide some sort of escape function to take potentially dangerous characters and translate them to something which is safe to write out to the web page a user&#8217;s browser will render.</p>
<p>The more complex a website becomes, the more places you have input coming from.  Add a database, and your complexity increases again.  It takes a lot of thought, testing, and thinking like a hacker to really make sure you&#8217;re safe.  Preventing XSS vulnerabilities may even keep other exploits from working, like SQL injection (check out TWAT radio episode 33, by livinded).</p>
<p>Quite a few big-named websites have had very public XSS vulnerabilities:  Hotmail, MySpace, Paypal, and even the new Netscape.com website.  You can follow the Bugtraq and/or Full Disclosure Mailing Lists at http://seclists.org/ to see that there are new ones reported and fixed every day.</p>
<p><b>Demonstration:</b></p>
<p>The following page is sufficient to demonstrate the XSS vulnerabilities at the ha.ckers.org cheatsheet; simply save the contents as a .php file.  WARNING:  Do not put this page on any public internet-facing webserver!  </p>
<p>
<code><br />
&lt;html&gt;<br />
 &lt;head&gt;<br />
  &lt;title&gt;XSS Test&lt;/title&gt;<br />
 &lt;/head&gt;<br />
 &lt;body&gt;<br />
  &lt;h1&gt;XSS test&lt;/h1&gt;<br />
 &lt;p&gt;Hey there, &lt;?= $_GET['hithere'] ?&gt;!&lt;/p&gt;<br />
 &lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p>After installing this vulnerable php page, (again, only recommended on a machine which is not visible to the outside world &#8212; you have been warned!) you can call it with parameters such as:</p>
<p><code>http://localhost/test.php?hithere=&lt;script&gt;alert('I am vulnerable!');&lt;/script&gt;</code></p>
<p><b>How to guard yourself as a websurfer:</b></p>
<p>If you use Internet Explorer, it does include a zone-based security model which allows you to lock down a site until you give it explicit permission to execute Javascript.  Steve Gibson, in Security Now episode 38, outlines the method he uses to secure IE.</p>
<p>If you use Firefox, install the free NoScript extension, which very simply performs the very same task.  There is a small icon in the bottom right of the browser which you can click to temporarily or permanently allow a website to execute Javascript, once you trust it.</p>
<p><b>Referenced pages and links for more information:</b></p>
<p><a href="http://www.cgisecurity.com/articles/xss-faq.shtml">Cgisecurity.com: Cross Site Scripting questions and answers</a></p>
<p><a href="http://en.wikipedia.org/wiki/Cross_site_scripting">Cross-site scripting &#8211; Wikipedia entry</a></p>
<p><a href="http://seclists.org/">SecLists.org Security Mailing List Archives</a></p>
<p><a href="http://twatech.org/index.php?page=118">TWAT ep. 33 &#8211; SQL Injection, by Livinded</a></p>
<p><a href="http://ha.ckers.org/xss.html">XSS (Cross Site Scripting) Cheat Sheet</a></p>
<p><a href="http://www.grc.com/securitynow.htm">Security Now Episodes</a></p>
<p><a href="http://www.noscript.net/">NoScript Plugin for Firefox</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/occ0de.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/occ0de.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/occ0de.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/occ0de.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/occ0de.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/occ0de.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/occ0de.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/occ0de.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/occ0de.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/occ0de.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/occ0de.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/occ0de.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=occ0de.wordpress.com&blog=424990&post=1&subd=occ0de&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://occ0de.wordpress.com/2006/09/19/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adcdd161663e0079817411ae7110d9f0?s=96&#38;d=identicon" medium="image">
			<media:title type="html">occ0de</media:title>
		</media:content>
	</item>
	</channel>
</rss>