<?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>Chirashi Security &#187; WebAppSec</title>
	<atom:link href="http://chirashi.zensay.com/category/webappsec/feed/" rel="self" type="application/rss+xml" />
	<link>http://chirashi.zensay.com</link>
	<description>a blog with scattered thoughts on security.</description>
	<lastBuildDate>Sun, 25 Jul 2010 05:25:30 +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>How I tell my clients that XSS is bad</title>
		<link>http://chirashi.zensay.com/2009/09/how-i-tell-my-clients-that-xss-is-bad/</link>
		<comments>http://chirashi.zensay.com/2009/09/how-i-tell-my-clients-that-xss-is-bad/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 06:28:22 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[Cross site scripting]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=197</guid>
		<description><![CDATA[The mixed bag of reactions to XSS or Cross Site Scripting vulnerabilities is interesting to watch.  As a security professional, I’ve audited banking applications based on web technologies and have in all cases come away with at least one XSS vulnerability.  When presented to the client and to the vendor, I get some interesting reactions.
“You [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-200" style="margin-right: 10px;" title="Bing" src="http://chirashi.zensay.com/wp-content/uploads/2009/09/Screen-shot-2009-09-14-at-12.26.17-PM.png" alt="Bing" width="308" height="142" />The mixed bag of reactions to XSS or Cross Site Scripting vulnerabilities is interesting to watch.  As a security professional, I’ve audited banking applications based on web technologies and have in all cases come away with at least one XSS vulnerability.  When presented to the client and to the vendor, I get some interesting reactions.</p>
<h3>“You can’t compromise an application using XSS”</h3>
<p>Before I open up this can of worms, I can tell you that both vendor and client have told me this.  I then try to explain to them how things are generally interwoven and connected to each other and how you CAN own an application through XSS if done in a correct manner.</p>
<p>With XSS, you usually end up owning the USER of the application and thus can build up on your attack.</p>
<h3>“You cannot alter any data using XSS”</h3>
<p>With a reflected XSS attack, yes, you cannot change any stored data on an application.  You can, however, change the User Interface significantly.  You can swap out an entire page using a reflected XSS attack to make a user think he is on another screen of the application.  Like the login page for example or injecting an iframe.  The only catch is that you have crafted this login page using HTML and JavaScript and have presented it to him as if it were part of the legitimate site.  The login form sends his password to a server you control, but nothing is altered on the application database to begin with.</p>
<p>In the above examples and all cases of XSS, one thing is common.  The scope of this vulnerability is confined to that of the application user.  You do not use XSS to attack the application directly.  You use it to attack the user and indirectly attack the application.  So an XSS is more comparable to a pseudo social-engineering attack where you are tricking the user into revealing his credentials (enter his password on a crafted password screen or stealing his cookie).</p>
<p>The easiest way I find to present an XSS vulnerability, even before I put it in a report, is to call all the project stakeholders into a room and demo it to them.  I tell them that I have some findings to share with them and would like a few minutes to show them a live demo.  I then load up the application page that they are all familiar with.  Open up my email client to a received message<strong>[1]</strong>, click on the XSS laden link<strong>[2]</strong> and show them a perfectly legitimate login screen of their application.  I log in using credentials I was given and then continue to access one of the application’s functions as normal.</p>
<p>After a few seconds, I stop and tell them that I was just a victim of an XSS attack.  Then I move into the technical details.  I find this approach to be quite effective<strong>[3]</strong>.  It raises awareness in a way that the client can relate to.  What they perceive to be a legitimate session turns out to be an attacker controlled phishing attack of sorts.</p>
<p><em>[1] I create this message and send it to myself to simulate a company employee receiving an email from another person.</em></p>
<p><em>[2] I sometimes obfuscate the link, but usually I use HTML mail to show them an underlined “Click Here” phrase when the actual link is a stager.  I send an include (hex encoded &lt;script src&gt; tag) to a remote JavaScript file that contains the code to render the fake login page.</em></p>
<p><em>[3] My setup includes a remote site under my control where I host the malicious, custom written JavaScript files.  I have a backend script to pick up the posted information and send me a neat little email containing the cookie (if any), username and password and some other relevant data.  If one of the executives has a connected laptop, I will invite him to try it himself.  In the early days, I would send the link out to all the application users first by spoofing an internal email.  Then, I’d compile a list of the users affected and share the information with the executives in the meeting.<br />
</em><br />
I’ve had more positive responses using this approach than trying to put it in the report only to have several opinions thrown back from the client and the vendor that show a lack of knowledge on the subject.</p>
<p>XSS attacks are very common and can be used to great effect.  I am not alone when I say that XSS is very badly misunderstood and the threat that it poses is often ignored.  I think a hands-on approach of this nature, even though it takes more time and effort, is worthwhile in spreading the word.  Sometimes, you just have to spend the effort to demo your vulnerabilities to put things into context.  Your clients will appreciate it and remember it more than just reading a report.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad&amp;bodytext=The%20mixed%20bag%20of%20reactions%20to%20XSS%20or%20Cross%20Site%20Scripting%20vulnerabilities%20is%20interesting%20to%20watch.%C2%A0%20As%20a%20security%20professional%2C%20I%E2%80%99ve%20audited%20banking%20applications%20based%20on%20web%20technologies%20and%20have%20in%20all%20cases%20come%20away%20with%20at%20least%20one%20XSS%20vulne" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad&amp;notes=The%20mixed%20bag%20of%20reactions%20to%20XSS%20or%20Cross%20Site%20Scripting%20vulnerabilities%20is%20interesting%20to%20watch.%C2%A0%20As%20a%20security%20professional%2C%20I%E2%80%99ve%20audited%20banking%20applications%20based%20on%20web%20technologies%20and%20have%20in%20all%20cases%20come%20away%20with%20at%20least%20one%20XSS%20vulne" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;t=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad&amp;annotation=The%20mixed%20bag%20of%20reactions%20to%20XSS%20or%20Cross%20Site%20Scripting%20vulnerabilities%20is%20interesting%20to%20watch.%C2%A0%20As%20a%20security%20professional%2C%20I%E2%80%99ve%20audited%20banking%20applications%20based%20on%20web%20technologies%20and%20have%20in%20all%20cases%20come%20away%20with%20at%20least%20one%20XSS%20vulne" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F&amp;t=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad&amp;s=The%20mixed%20bag%20of%20reactions%20to%20XSS%20or%20Cross%20Site%20Scripting%20vulnerabilities%20is%20interesting%20to%20watch.%C2%A0%20As%20a%20security%20professional%2C%20I%E2%80%99ve%20audited%20banking%20applications%20based%20on%20web%20technologies%20and%20have%20in%20all%20cases%20come%20away%20with%20at%20least%20one%20XSS%20vulne" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=How%20I%20tell%20my%20clients%20that%20XSS%20is%20bad&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F09%2Fhow-i-tell-my-clients-that-xss-is-bad%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/09/how-i-tell-my-clients-that-xss-is-bad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Re-login plugin for Burp Suite</title>
		<link>http://chirashi.zensay.com/2009/05/re-login-plugin-for-burp-suite/</link>
		<comments>http://chirashi.zensay.com/2009/05/re-login-plugin-for-burp-suite/#comments</comments>
		<pubDate>Fri, 08 May 2009 15:27:00 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[WebAppSec]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=10</guid>
		<description><![CDATA[One of the first things I do when I begin a web application security assessment is figure out how the login sequence works. Then as I begin to annoy the application, I figure out what makes the application say, &#8220;Enough!&#8221; and kick me out by invalidating my session. With this, I can automate the process [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things I do when I begin a web application security assessment is figure out how the login sequence works. Then as I begin to annoy the application, I figure out what makes the application say, &#8220;Enough!&#8221; and kick me out by invalidating my session. With this, I can automate the process and save a huge amount of time logging into the application manually when my session is made invalid.</p>
<p>I&#8217;m a big fan of <a href="http://www.portswigger.net/suite" target="_blank">Burp Suite</a>. Burp Suite is a set of tools that I believe every web application pen-tester should find indispensable. Developed by Dafydd Stuttard a.k.a. Port Swigger, it is available in both Free and Professional (read paid) versions. Its a great set of tools and I use it&#8217;s <a href="http://portswigger.net/suite/help.html#extensibility" target="_blank">extensibility</a> to achieve the automated login process. Dafydd has also co-authored the book <a href="http://www.amazon.com/gp/product/0470170778?ie=UTF8&amp;amp;tag=portswinet-20&amp;amp;link_code=as3&amp;amp;camp=211189&amp;amp;creative=373489&amp;amp;creativeASIN=0470170778" target="_blank">The Web Application Hacker&#8217;s Handbook</a>. No, I don&#8217;t personally know Dafydd, and no, he&#8217;s not paying me to say these things (although I would never dare to send back a free copy of the Pro version he would send me ), but I use the tools and I think they&#8217;re quite awesome.</p>
<p>I recently pen-tested a banking application that was being launched by a large bank and dusted off my re-login plugin. Given that the bank used the F5 Big IP appliance with the application security module and the fact that it employed a ticketing system, I had to make extensive changes to my once humble re-login plugin. So I did. In the spirit of giving back, I thought someone else might find the plugin useful or can even build off my one (if you do, please do share the improved version) so I&#8217;ll post my research and final plugin here.</p>
<p>Because of the pain in the ass Big IP, I had to craft my re-login plugin as follows:</p>
<ol>
<li>Record the error page of the Big IP and find a unique string to identify the page</li>
<li>Record the POST request for the login page</li>
<li>Write the plugin to detect if this string is in the response</li>
<li>If it is, then make an HTTP GET request to the start page.</li>
<li>Grab the cookies from the GET request</li>
<li>Replace the cookies from the POST request with the ones from the GET request</li>
<li>Make the HTTP POST request</li>
<li>Grab the response and send it back to the browser.</li>
</ol>
<p>Now when I send that incredibly long string in the &#8220;Amount&#8221; field or send a whole load of XSS in the &#8220;Description&#8221; field, I am no longer greeted by the Big IP error page. Instead, my plugin takes over, seamlessly logs me back in and brings me to the landing page.</p>
<p>Here is the source code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.Matcher</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.Pattern</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">burp.IBurpExtender</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">burp.IBurpExtenderCallbacks</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BurpExtender <span style="color: #000000; font-weight: bold;">implements</span> IBurpExtender <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> burp.<span style="color: #006633;">IBurpExtenderCallbacks</span> callBacks<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> applicationClosing<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> registerExtenderCallbacks<span style="color: #009900;">&#40;</span>IBurpExtenderCallbacks callbacks<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		callBacks <span style="color: #339933;">=</span> callbacks<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setCommandLineArgs<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> cla<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> processProxyMessage<span style="color: #009900;">&#40;</span>
			<span style="color: #000066; font-weight: bold;">int</span> messageReference,
			<span style="color: #000066; font-weight: bold;">boolean</span> messageIsRequest,
			<span style="color: #003399;">String</span> remoteHost,
			<span style="color: #000066; font-weight: bold;">int</span> remotePort,
			<span style="color: #000066; font-weight: bold;">boolean</span> serviceIsHttps,
			<span style="color: #003399;">String</span> httpMethod,
			<span style="color: #003399;">String</span> url,
			<span style="color: #003399;">String</span> resourceType,
			<span style="color: #003399;">String</span> statusCode,
			<span style="color: #003399;">String</span> responseContentType,
			<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> message,
			<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> action<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> firstRequest<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> nextRequest<span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> initialCookies <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>messageIsRequest<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isBigIPError<span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					callBacks.<span style="color: #006633;">issueAlert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Attempting to re-login...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					firstRequest <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[Enter First Request separated by <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					nextRequest <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[Enter Second Request separated by <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> firstResp <span style="color: #339933;">=</span> callBacks.<span style="color: #006633;">makeHttpRequest</span><span style="color: #009900;">&#40;</span>remoteHost, remotePort, serviceIsHttps, firstRequest<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					initialCookies <span style="color: #339933;">=</span> grabCookies<span style="color: #009900;">&#40;</span>firstResp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> interimReq <span style="color: #339933;">=</span> buildRequest<span style="color: #009900;">&#40;</span>initialCookies,nextRequest<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					message <span style="color: #339933;">=</span> callBacks.<span style="color: #006633;">makeHttpRequest</span><span style="color: #009900;">&#40;</span>remoteHost, remotePort, serviceIsHttps, interimReq<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> message<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> grabCookies<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getRequest<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> getReq <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>getRequest<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> regEx <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Set-Cookie:<span style="color: #000099; font-weight: bold;">\\</span>s(.*?);&quot;</span><span style="color: #339933;">;</span>
		Pattern pattern <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span>regEx, Pattern.<span style="color: #006633;">DOTALL</span> <span style="color: #339933;">|</span> Pattern.<span style="color: #006633;">MULTILINE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Matcher matcher <span style="color: #339933;">=</span> pattern.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>getReq<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		StringBuilder cookies <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		cookies.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cookie: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			cookies.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">group</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		cookies.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> cookies.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> buildRequest<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> cookies, <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> postRequest<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> carvedPost <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> postReq <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>postRequest<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		carvedPost <span style="color: #339933;">=</span> postReq.<span style="color: #006633;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		postReq <span style="color: #339933;">=</span> carvedPost<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Content-Length: &quot;</span><span style="color: #339933;">+</span>carvedPost<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">+</span>carvedPost<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">StringBuffer</span> finalReq <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> regEx <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Cookie:<span style="color: #000099; font-weight: bold;">\\</span>s(.*?)<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		Pattern pattern <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span>regEx, Pattern.<span style="color: #006633;">DOTALL</span> <span style="color: #339933;">|</span> Pattern.<span style="color: #006633;">MULTILINE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Matcher matcher <span style="color: #339933;">=</span> pattern.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>postReq<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			matcher.<span style="color: #006633;">group</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			matcher.<span style="color: #006633;">appendReplacement</span><span style="color: #009900;">&#40;</span>finalReq,cookies.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		matcher.<span style="color: #006633;">appendTail</span><span style="color: #009900;">&#40;</span>finalReq<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> finalReq.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> isBigIPError<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> message <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">String</span> regEx <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;[Enter the regex of an identifying term appearing in the error page]&quot;</span><span style="color: #339933;">;</span>
			Pattern pattern <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span>regEx,Pattern.<span style="color: #006633;">DOTALL</span><span style="color: #339933;">|</span>Pattern.<span style="color: #006633;">MULTILINE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			Matcher matcher <span style="color: #339933;">=</span> pattern.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				callBacks.<span style="color: #006633;">issueAlert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Received error from F5 Big-IP!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				result <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>To get this to work in Burp, I will provide you with instructions directly from PortSwigger:</p>
<p>Before you proceed, make sure to change the GET, POST and RegEx to match your own scenario. Just place them into the areas surrounded by square brackets. Remove the square brackets after that.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;SNIP&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>If you want to play with this example yourself, you can download the source here: <a title="source" href="http://chirashi.zensay.com/wp-content/uploads/2009/06/burpextender.java">BurpExtender.java</a>. The steps to compile and run the plugin are as follows:</p>
<ol>
<li>If you don&#8217;t already have it, download and install the Java Development Kit (JDK) from Sun.</li>
<li>Create a directory to work in, and cd into it from the command line.</li>
<li>Copy the plugin source file (BurpExtender.java) into your working directory.</li>
<li>Create a subdirectory called &#8220;burp&#8221;, and copy theIBurpExtenderCallbacks.java file into this directory. You will need this file in the correct relative path, because the plugin code makes use of the IBurpExtenderCallbacks interface.</li>
<li>In your working directory, compile the BurpExtender.java source file into a .class file using javac, the Java compiler. The exact command will depend on the location of your JDK &#8211; for example, on Windows, you might type: &#8220;\Program Files\Java\jdk1.6.0_04\bin\javac.exe&#8221; BurpExtender.java</li>
<li>Confirm that the file BurpExtender.class has appeared in your working directory.</li>
<li>Build a Java archive (JAR) file containing your .class file. Depending again on your JDK location, you might type:&#8221;\Program Files\Java\jdk1.6.0_04\bin\jar.exe&#8221; -cf burpextender.jar BurpExtender.class</li>
<li>Confirm that the file burpextender.jar has appeared in your working directory.</li>
<li>Copy your normal Burp JAR file into your working directory.</li>
<li>Using the actual name of your Burp JAR file, start Burp using the command: java -Xmx512m -classpath burpextender.jar;burp.jar burp.StartBurp</li>
</ol>
<p>If everything works, Burp should launch with a number of entries in the alerts tab, confirming which IBurpExtender methods were successfully loaded from your plugin (in this case, processProxyMessage and registerExtenderCallbacks):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;SNIP&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>If you need any clarifications on this or some help, just post some comments and I&#8217;ll do my best to answer them.</p>
<p>That should be it for now. Go forth and Haxx0r!</p>
<p>&#8211;<br />
Chopstick</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;title=Re-login%20plugin%20for%20Burp%20Suite&amp;bodytext=One%20of%20the%20first%20things%20I%20do%20when%20I%20begin%20a%20web%20application%20security%20assessment%20is%20figure%20out%20how%20the%20login%20sequence%20works.%20Then%20as%20I%20begin%20to%20annoy%20the%20application%2C%20I%20figure%20out%20what%20makes%20the%20application%20say%2C%20%22Enough%21%22%20and%20kick%20me%20out%20by%20invalidati" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;title=Re-login%20plugin%20for%20Burp%20Suite&amp;notes=One%20of%20the%20first%20things%20I%20do%20when%20I%20begin%20a%20web%20application%20security%20assessment%20is%20figure%20out%20how%20the%20login%20sequence%20works.%20Then%20as%20I%20begin%20to%20annoy%20the%20application%2C%20I%20figure%20out%20what%20makes%20the%20application%20say%2C%20%22Enough%21%22%20and%20kick%20me%20out%20by%20invalidati" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;t=Re-login%20plugin%20for%20Burp%20Suite" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;title=Re-login%20plugin%20for%20Burp%20Suite&amp;annotation=One%20of%20the%20first%20things%20I%20do%20when%20I%20begin%20a%20web%20application%20security%20assessment%20is%20figure%20out%20how%20the%20login%20sequence%20works.%20Then%20as%20I%20begin%20to%20annoy%20the%20application%2C%20I%20figure%20out%20what%20makes%20the%20application%20say%2C%20%22Enough%21%22%20and%20kick%20me%20out%20by%20invalidati" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;title=Re-login%20plugin%20for%20Burp%20Suite" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;title=Re-login%20plugin%20for%20Burp%20Suite" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F&amp;t=Re-login%20plugin%20for%20Burp%20Suite&amp;s=One%20of%20the%20first%20things%20I%20do%20when%20I%20begin%20a%20web%20application%20security%20assessment%20is%20figure%20out%20how%20the%20login%20sequence%20works.%20Then%20as%20I%20begin%20to%20annoy%20the%20application%2C%20I%20figure%20out%20what%20makes%20the%20application%20say%2C%20%22Enough%21%22%20and%20kick%20me%20out%20by%20invalidati" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Re-login%20plugin%20for%20Burp%20Suite%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Re-login%20plugin%20for%20Burp%20Suite&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fre-login-plugin-for-burp-suite%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/05/re-login-plugin-for-burp-suite/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
