<?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> &#187; SQL injection</title>
	<atom:link href="http://travisaltman.com/category/sql-injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://travisaltman.com</link>
	<description></description>
	<lastBuildDate>Sun, 25 Jul 2010 19:55:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XSS-Me tool &amp; html frames</title>
		<link>http://travisaltman.com/xss-me-tool-html-frames/</link>
		<comments>http://travisaltman.com/xss-me-tool-html-frames/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 05:48:20 +0000</pubDate>
		<dc:creator>travis</dc:creator>
				<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://travisaltman.com/xss-me-tool-html-frames/</guid>
		<description><![CDATA[Security Compass has created a series of Firefox add-ons that aid in performing web application assessment. These tools are a great convenient way of finding vulnerabilities within web applications. I do want to point out that even though these tools are useful there is no guarantee all vulnerabilities will be found.
XSS-Me is one of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.securitycompass.com/">Security Compass</a> has created a <a href="https://addons.mozilla.org/en-US/firefox/user/1792636">series of Firefox add-ons</a> that aid in performing web application assessment. These tools are a great convenient way of finding vulnerabilities within web applications. I do want to point out that even though these tools are useful there is no guarantee all vulnerabilities will be found.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/7598">XSS-Me</a> is one of the tools in the series that helps to find cross site scripting (<a href="http://www.darkreading.com/document.asp?doc_id=103774&amp;WT.svl=news1_1">XSS</a>) vulnerabilities within web applications. The tool works by locating forms within a web page then tries various inputs into those forms to see if the inputs on that page are vulnerable. A screen shot of how the tool should look inside Firefox can be seen below.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/travisaltman.png" title="How XSS-Me should look inside Firefox"><img src="http://travisaltman.com/wp-content/travisaltman.png" alt="How XSS-Me should look inside Firefox" align="left" /></a></p>
<p align="left">&nbsp;</p>
<p align="left">Now all you have to do is click &#8220;Run all tests&#8221; and let XSS-Me do its thing. Keep in mind that XSS-Me will also find any hidden forms within a page as well. So this is how things are suppose to work but you&#8217;ll eventually come across a page that has forms but XSS-Me doesn&#8217;t detect them, this is because the page you are viewing has <a href="http://www.w3schools.com/HTML/html_frames.asp">frames</a>. A good example of this is <a href="http://em386.blogspot.com/">Chris Rohlf&#8217;s</a> site seen below.</p>
<p align="left"><a href="http://travisaltman.com/wp-content/em386homepage.png" title="XSS-Me doesnâ€™t detect the search form"><img src="http://travisaltman.com/wp-content/em386homepage.png" alt="XSS-Me doesnâ€™t detect the search form" /></a></p>
<p align="left">From the screen shot you can see there is a search form at the top of the page but XSS-Me doesn&#8217;t detect its presence. This is because the search form is wrapped inside of a frame. A quick little tip to get around this problem is to open the frame in another tab/window. All you have to do in Firefox is right click on the frame then select &#8220;This Frame &gt; Open Frame in New Tab&#8221;. A screen shot can be seen below.</p>
<p align="left"><a href="http://travisaltman.com/wp-content/rightclick.jpg" title="Right click to open frame"><img src="http://travisaltman.com/wp-content/rightclick.jpg" alt="Right click to open frame" /></a></p>
<p align="left">Once you have the frame in a new tab XSS-Me will detect the form as normal. This can be seen in the screen shot below.</p>
<p align="left"><a href="http://travisaltman.com/wp-content/forminnewtab.png" title="Frame in new tab"><img src="http://travisaltman.com/wp-content/forminnewtab.png" alt="Frame in new tab" /></a></p>
<p align="left">This same technique will apply to the SQL Inject Me tool from Security Compass as well because it also tries to search for forms within a web page.</p>
<p align="left">This tip was passed along to me by Sahba Kazerooni who works at Security Compass. I have no affiliation with Security Compass but I met Sahba and some other Security Compass employees at a conference and they were all down to earth guys who had great knowledge and experience when it came to information security. So thanks for the tip Sahba and hopefully this tip will help others secure their web applications as well.</p>
<p align="left">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://travisaltman.com/xss-me-tool-html-frames/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Widespread SQL injection &amp; Javascript malware</title>
		<link>http://travisaltman.com/widespread-sql-injection-javascript-malware/</link>
		<comments>http://travisaltman.com/widespread-sql-injection-javascript-malware/#comments</comments>
		<pubDate>Thu, 15 May 2008 15:40:16 +0000</pubDate>
		<dc:creator>travis</dc:creator>
				<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[malware]]></category>

		<guid isPermaLink="false">http://travisaltman.com/widespread-sql-injection-javascript-malware/</guid>
		<description><![CDATA[This is the first time I have ever seen SQL injection this widespread and in an automated fashion. Before it&#8217;s all said and done this could be !!! HUGE !!!. News of this has been trickling out since the end of April with the first hint of it at the beginning of the year.
Basically what&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first time I have ever seen SQL injection this widespread and in an automated fashion. Before it&#8217;s all said and done this could be !!! HUGE !!!. News of this has been trickling out since the end of April with the first hint of it at the beginning of the year.</p>
<p>Basically what&#8217;s happening is attackers are using SQL injection, in some sort of automated fashion, to insert Javascript malware into databases of some popular websites, the <a href="http://ddanchev.blogspot.com/2008/04/united-nations-serving-malware.html">United Nations for example</a>. Once a user visits an infected website (un.org) they will unknowingly be sent to a malicious site where attackers try numerous exploits to see if they succeed. Keep in mind the user will remain on un.org as if everything is fine and dandy but in the background exploits are being launched.</p>
<p>What&#8217;s so scary about these widespread infections is that the Javascript malware will remain on the database until the webmaster removes it. Even then the websites will still be vulnerable to SQL injection so attackers could reinsert malware until the vulnerability is fixed. Also attackers could easily update the location of their malicious site through SQL injection. For example lets say attackers are using http://evilattacker.com for launching their exploits but this URL gets blacklisted, they could then update infected databases with a new URL, say http://maliciousattacker.com. So this type of widespread epidemic is the gift that keeps on giving.</p>
<p>I&#8217;ve seen these attacks come across the IDS (intrusion detection system) where users are visiting infected URL&#8217;s. Of course attackers could easily move their operations to different URL&#8217;s. Some exploit URL&#8217;s I&#8217;ve seen so far are nihaorr1.com, nmidahena.com, aspder.com, rirwow.cn, and wowyeye.cn. I performed searches to get an idea of the infection numbers, now doing a search for the offending URL won&#8217;t give you a 1 to 1 relationship but it will give you a ballpark figure. Take a look at the &#8220;Results&#8221; numbers in the following screen shots.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/nihaorr1cominfections.png" title="nihaorr1.com Infections"><img src="http://travisaltman.com/wp-content/nihaorr1cominfections.png" alt="nihaorr1.com Infections" /></a></p>
<p align="center"><a href="http://travisaltman.com/wp-content/nmidahenacominfections.png" title="nmidahena.com Infections"><img src="http://travisaltman.com/wp-content/nmidahenacominfections.png" alt="nmidahena.com Infections" /></a></p>
<p align="center"><a href="http://travisaltman.com/wp-content/aspdercominfections.png" title="aspder.com Infections"><img src="http://travisaltman.com/wp-content/aspdercominfections.png" alt="aspder.com Infections" /></a></p>
<p align="left">Also check out this screen shot from ririwow.cn, you&#8217;ll get a laugh from it.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/ririwowcn.png" title="ririwow.cn"><img src="http://travisaltman.com/wp-content/ririwowcn.png" alt="ririwow.cn" /></a></p>
<p align="left">So the ballpark infection just from these three URL&#8217;s is 500,000, scary isn&#8217;t it. Even if this number is 400,000 off that still leaves 100,000 sites infected. There&#8217;s no way at this point to verify the number but this is definitely the largest SQL injection campaign I have ever seen. It&#8217;s these URL&#8217;s along with others that are hosting the Javascript malware. It&#8217;s common to see the attackers use Javascript to open zero pixel iframes so the attack appears hidden. The Javascript files I&#8217;ve seen so far are short names with either a single letter or number (e.g. m.js, 1.js, jp.js, etc). So the request that happens in the background will look like http://ririwow.cn/jp.js. In order to see the request one would have to use a <a href="http://travisaltman.com/webscarab-tutorial-part-1-learning-the-basics/">local web proxy</a>. Without a proxy you would never see the request. So I&#8217;m going to keep my eyes peeled in the coming months to see how this epidemic plays out.</p>
<p>Below are some other good articles related to this topic</p>
<p><a href="http://isc.sans.org/diary.html?storyid=4294">Internet Storm Center</a></p>
<p><a href="http://securitylabs.websense.com/content/Alerts/3070.aspx">Websense</a></p>
<p><a href="http://www.shadowserver.org/wiki/pmwiki.php?n=Calendar.20080424">ShadowServer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://travisaltman.com/widespread-sql-injection-javascript-malware/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Webscarab Tutorial Part 3 (fuzzing)</title>
		<link>http://travisaltman.com/webscarab-tutorial-part-3-fuzzing/</link>
		<comments>http://travisaltman.com/webscarab-tutorial-part-3-fuzzing/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 15:30:45 +0000</pubDate>
		<dc:creator>travis</dc:creator>
				<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://travisaltman.com/webscarab-tutorial-part-3-fuzzing/</guid>
		<description><![CDATA[Part 2 covered the neat functionality of session ID analysis within Webscarab.  Now we&#8217;ll focus on another great function within Webscarab, fuzzing.  I define fuzzing as testing the input of an application by trying various parameters that the input may not expect.  These parameters don&#8217;t have to be random, in my opinion [...]]]></description>
			<content:encoded><![CDATA[<p>Part 2 covered the neat functionality of session ID analysis within Webscarab.  Now we&#8217;ll focus on another great function within Webscarab, fuzzing.  I define fuzzing as testing the input of an application by trying various parameters that the input may not expect.  These parameters don&#8217;t have to be random, in my opinion it&#8217;s best when you tailor your parameters depending on the application.  When fuzzing you typically want to inject &#8220;command &amp; control&#8221; parameters into the input to find the most serious vulnerability.  For example if a web application is expecting a social security number I may inject html parameters such as &#8221; &lt; / &gt; &#8221; to manipulate the look, feel, and operation of a web application.  I don&#8217;t want to delve a whole lot into fuzzing because there are books out there that talk about this one subject.  This tutorial is going to focus on using Webscarab to fuzz web applications and find vulnerabilities.  Hopefully by the end of this tutorial you will better understand the technical aspects of fuzzing as oppose to the concept of fuzzing, but more reading on fuzzing web applications may be required.</p>
<p><span id="more-50"></span></p>
<p>This tutorial will once again be targeting Foundstone&#8217;s Hacme Casino which intentionally has vulnerabilities built into the application.  Fuzzing can focus on different types of vulnerabilities and parameters within web applications (e.g. XSS, SQL injection, queries, directory paths, etc&#8230;), although this tutorial will focus on parameters vulnerable to SQL injection.  Foudstone&#8217;s documentation lets us know that the username input is vulnerable to SQL injection so we can try fuzzing it with Webscarab to find other possible injections.  First we&#8217;ll try and login with the username &#8216;test&#8217; and password &#8216;test&#8217;.  This can be seen in Figure 1.</p>
<p align="center"> <a href="http://travisaltman.com/wp-content/loginhacmecasinowithusernametest.png" title="Try logging into Hacme Casino"><img src="http://travisaltman.com/wp-content/loginhacmecasinowithusernametest.png" alt="Try logging into Hacme Casino" /></a></p>
<p align="center">Figure 1: Trying to login</p>
<p>This will not log us into the application but Webscarab will capture the login process in the summary tab.  Once this has happened find the login conversation in the summary tab.  After you have found the login conversation simply right click and select &#8220;Use as fuzz template&#8221;, this will send the parameters and headers associated with that request / conversation to the fuzzing tab.  Selection of the login request can be seen in Figure 2.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/rightclickuseasfuzztemplateforhacmecasinologin.png" title="Right click request to use as a fuzz template"><img src="http://travisaltman.com/wp-content/rightclickuseasfuzztemplateforhacmecasinologin.png" alt="Right click request to use as a fuzz template" /></a></p>
<p align="center">Figure 2: Send conversation to fuzz template</p>
<p align="left">Now navigate to the Fuzzer tab within Webscarab.  Here you&#8217;ll see all the parameters that are associated with that request / conversation.  You could add parameters to the request and see how the web application reacts to different paths, value, or types.  You could also delete parameters for simplicity and to also see how the application reacts with those parameters missing.  Once you have determined the parameters for fuzzing you&#8217;ll need to define a fuzz source.  So click on the &#8220;Sources&#8221; button beside &#8220;Start&#8221; and &#8220;Stop&#8221; within the Fuzzer tab.  Here you will choose a dictionary style text file that contains parameters you want to fuzz with.  I chose a SQL injection dictionary because we know the &#8220;username&#8221; field is vulnerable to SQL injections.  The selection of the SQL injection dictionary can be seen in Figure 3.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/pickingsqlinjectionfuzzsources.png" title="Choosing SQL injection dictionary as a fuzz source"><img src="http://travisaltman.com/wp-content/pickingsqlinjectionfuzzsources.png" alt="Choosing SQL injection dictionary as a fuzz source" /></a></p>
<p align="center">Figure 3: Choosing fuzz source</p>
<p align="left">In my SQL injection dictionary I have 66 items, but Webscarab does not have a limit.  There are lots of SQL injection dictionaries out there, some are even dedicated towards different platforms (e.g. MySQL, MS SQL Server, DB2, etc&#8230;).  I got most of my SQL attacks from Andres Andreu&#8217;s website <a href="http://www.neurofuzz.com/">Neurofuzz</a>, the dictionary I pulled from can be found <a href="http://www.neurofuzz.com/modules/software/wsfuzzer/All_attack.txt">here</a>.  In this tutorial we won&#8217;t be trying to fuzz for XSS vulnerabilities but <a href="http://ha.ckers.org/">ha.ckers.org</a> has a now infamous <a href="http://ha.ckers.org/xss.html">XSS dictionary</a> which is a great resource.  Once all dictionary sources are added go to the main Fuzzer tab and assign parameters a fuzz source.  This can be done via a drop down menu as seen in Figure 4.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/choosesqlinjectionfuzzsourcefromdropdownlist.png" title="Choosing fuzz source for each parameter"><img src="http://travisaltman.com/wp-content/choosesqlinjectionfuzzsourcefromdropdownlist.png" alt="Choosing fuzz source for each parameter" /></a></p>
<p align="center">Figure 4: Drop down menu containing fuzz source</p>
<p align="left">In order to prevent a parameter from being fuzzed simply leave the &#8220;Fuzz Source&#8221; field blank or delete the parameter altogether.  In this case the &#8220;user_login&#8221; is the only parameter that will reiterate through the SQLattack dictionary.  The next step is to click on &#8220;Start&#8221; and let Webscarab try all of your parameters within the dictionary.  This means the value &#8220;test&#8221; will be replaced with values inside the SQL injection attack dictionary and new request  is sent to the web server for every attack parameter inside your dictionary.  The fuzzer in action can be seen in Figure 5.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/runningfuzzerandwatchingrequests.png" title="Running the fuzzer"><img src="http://travisaltman.com/wp-content/runningfuzzerandwatchingrequests.png" alt="Running the fuzzer" /></a></p>
<p align="center">Figure 5: Running the fuzzer</p>
<p align="left">Notice the &#8220;Total Requests&#8221; and the &#8220;Current Request&#8221;, once the fuzzer has run through all of the parameters in the SQL injection dictionary both of these numbers will be 68.  Also notice the ID number 97 on the left hand side of the table, this is the first request of the fuzzing operation.  The last request will have an ID number of 164, it&#8217;s important to keep track of these request ID&#8217;s when reviewing results of the fuzzing operation.  I have found myself reviewing requests that weren&#8217;t fuzzed and accidentally identified requests as not being vulnerable when in fact they were.</p>
<p align="left">Once the fuzzer has made all of the requests a review of the results is needed to see if any of the attack parameters succeeded in a SQL injection.  I do this simply by going back to the summary tab and opening up the first conversation of the fuzzing process.  I then manually step through every conversation involved in the fuzzing operation and look for any &#8220;interesting differences&#8221; between responses.  The phrase interesting differences is in quotation marks because fuzzing and looking for SQL injections is not an exact science but knowing how an application normally deals with the input will be helpful in determining what should and should not be expected in a HTTP response.  Let&#8217;s take a look at some of our fuzzing conversations to get a better idea of discovering differences.  Have a look at the first fuzzing request, note the value of the &#8220;user_login&#8221; parameter in the request and the value of the &#8220;Location&#8221; in the response.  This can be seen in Figure 6.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/nosqlinjectionfuzzparameterconversation97markedup.png" title="First fuzzed conversation"><img src="http://travisaltman.com/wp-content/nosqlinjectionfuzzparameterconversation97markedup.png" alt="First fuzzed conversation" /></a></p>
<p align="center">Figure 6: First fuzzed conversation</p>
<p align="left">Here it&#8217;s seen that the first value in the attack dictionary was actually used for the username value, good to know Webscarab is functioning properly.  The top of Figure 6 shows that a POST request is sent to /account/login to check the credentials of the user, since the first SQL injection is not a valid user the response is to redirect back to the login screen.  Keep in mind when looking at these conversation screen shots that the top half of the figure is the request and the lower half is the response.  It can be deferred from this conversation that if an invalid username is inserted into the web application the response will be a redirect to the login screen.  So when looking through the other SQL injected conversations it would be a good idea to look for a redirect to another location or an error message.  It&#8217;s always a good idea to look for database error messages when trying to find SQL injection vulnerabilities within a web application.  Stepping through the other conversations I notice something different, this can be seen in Figure 7.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/sqlinjectionfuzzparameterconversation103withredtext.png" title="Successful SQL injection"><img src="http://travisaltman.com/wp-content/sqlinjectionfuzzparameterconversation103withredtext.png" alt="Successful SQL injection" /></a></p>
<p align="center">Figure 7: SQL injection changed redirect location</p>
<p align="left">Looks like on conversation 103 one of the SQL injections in the attack dictionary changed the location of the redirect to /lobby/games.  Let&#8217;s throw the injection value back into the web application and see what the response may be.  The request can be seen in Figure 8.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/sqlinjectiononusernamewithcommentsatendofinjection.png" title="SQL injection on Hacme Casino username"><img src="http://travisaltman.com/wp-content/sqlinjectiononusernamewithcommentsatendofinjection.png" alt="SQL injection on Hacme Casino username" /></a></p>
<p align="center">Figure 8: SQL injection request on Hacme Casino</p>
<p align="left">The response to this SQL injection can be seen below in Figure 9.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/aftersqlinjectionviawebinterface.png" title="Successful SQL injection"><img src="http://travisaltman.com/wp-content/aftersqlinjectionviawebinterface.png" alt="Successful SQL injection" /></a></p>
<p align="center">Figure 9: SQL injection response (Great success!)</p>
<p align="left">Looks like the SQL injection gave us access to Andy Aces&#8217; account.  This occurred because we added the phrase &#8220;or 1=1&#8243; (which is always true) to the end of the SQL query that authenticates the users to Hacme Casino.  The reason Andy Aces&#8217; account was hijacked is because his name is the first one in the database.  Guess having the last name Altman could be bad for me as well?  Looking through the other conversations there appears to be another SQL injection that worked as well, this can be seen in Figure 10.</p>
<p align="center"><a href="http://travisaltman.com/wp-content/sqlinjectionfuzzparameterconversation117withredtext.png" title="Another successful SQL injection"><img src="http://travisaltman.com/wp-content/sqlinjectionfuzzparameterconversation117withredtext.png" alt="Another successful SQL injection" /></a></p>
<p align="center">Figure 10: Another successful SQL injection</p>
<p align="left">The hits just keep on coming.  This may seem to easy but there are plenty of web applications out in the wild that don&#8217;t validate input and let malicious users manipulate their application and backend databases.  SQL injections within a web application can be a serious vulnerability depending on the data held within the database.  Had this scenario been real a malicious user could have taken over Andy Aces&#8217; account and had his way inside the online casino.</p>
<p align="left">The fuzzing functionality of Webscarab makes web application vulnerability assessment a more automated process.  Manually entering all of those SQL injection attacks can take a very long time.  There is a downside to the dictionary approach though, your dictionary may not be as creative as a malicious user.  Some people believe that a fuzzer should generate random input and that you should try thousands of requests in order to properly test a web application.  Thousands of random requests could be better but stepping through those requests to determine validity can make for a long day.  Although if one were to take the random input approach Webscarab has a solution for stepping through those results, the Compare and Search functionality.  I may dive into the Compare and Search functionality at a later date, these functions can really speed up the process of web vulnerability assessment.  Also keep your eye open for a video tutorial of Webscarab coming soon, you could always subscribe to my feed for the latest and greatest.</p>
<p align="left">Once again I hope this tutorial was helpful in showing you the great features of Webscarab, as always your comments and feedback are welcomed.</p>
<p align="left">travis@home:~$ more references</p>
<p align="left"><a href="http://www.owasp.org/index.php/Fuzzing_with_WebScarab">Owasp Webscarab fuzzing tutorial</a></p>
<p align="left"><a href="http://dawes.za.net/rogan/webscarab/docs/">Rogan Dawes documentation for Webscarab</a></p>
<p align="left"><a href="http://www.foundstone.com/us/resources/proddesc/hacmecasino.htm">Foundstone Hacme Casino</a></p>
]]></content:encoded>
			<wfw:commentRss>http://travisaltman.com/webscarab-tutorial-part-3-fuzzing/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>
