<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Web App Pentesting</title>
	<atom:link href="http://webapp-pentest.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://webapp-pentest.com</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Mon, 24 Dec 2012 10:31:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='webapp-pentest.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Web App Pentesting</title>
		<link>http://webapp-pentest.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://webapp-pentest.com/osd.xml" title="Web App Pentesting" />
	<atom:link rel='hub' href='http://webapp-pentest.com/?pushpress=hub'/>
		<item>
		<title>Hacme Books Week 5</title>
		<link>http://webapp-pentest.com/2012/12/24/hacme-books/</link>
		<comments>http://webapp-pentest.com/2012/12/24/hacme-books/#comments</comments>
		<pubDate>Mon, 24 Dec 2012 10:30:16 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Access Control Flaws]]></category>
		<category><![CDATA[Access Control]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=396</guid>
		<description><![CDATA[This is the last in a series five posts for the vulnerable web application Hacme Books. Broken Access Control Access control is one of the major security concerns in any application.  Elevated access to a system may result in disaster &#8230; <a href="http://webapp-pentest.com/2012/12/24/hacme-books/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=396&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the last in a series five posts for the vulnerable web application Hacme Books.</p>
<p><strong>Broken Access Control</strong></p>
<p>Access control is one of the major security concerns in any application.  Elevated access to a system may result in disaster ranging from lost data to bringing the system down for some time. It is possible to overlook the access control scenarios that are horizontal in nature. Most developers effectively check for administrator privileges within the escalated code blocks.</p>
<p>In this case, I, as an attacker, will try to look at my profile or any previous order.  When I check my profile I would not be logged on to the system with my used id and password but I will break in without an authentication token.</p>
<p>If we look at the application, there is a major problem in the <strong>‘Forgot Your Password’ </strong>option. The screen does not ask for any information from the user except the username. In a real-time application it might not be a problem because the password may be sent using a different channel such as e-mail, but in this case the problem is that the attacker comes to know that database interaction is taking place just with one reference to the user name.  This has the ability to cause a serious security issue.</p>
<p>Sometimes the developers might leave comments in HTML code that is in JSP. Often the confusion is mistaking HTML for JSP comments. To start this attack we need some additional information.  We will need to have a couple of user accounts on the system and will need to complete a couple of purchases.  This will generate the seed data for the underlying attack.</p>
<p>The accounts must be created on the system so it is obvious that we will create bogus accounts, here I am going to create two accounts named <strong>test </strong>and<strong> hacker</strong>.<br />
First I will logon with the test account, we have not made any purchase using this account, so if we click on view orders we will see the screen with message that explains that this user has never purchased anything.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/124.jpg"><img class="aligncenter size-full wp-image-397" title="1" src="http://webapppentest.files.wordpress.com/2012/07/124.jpg?w=640" alt=""   /></a></p>
<p><strong>Browse Orders Screen for user ‘Test’</strong></p>
<p>Now we will try to see the records for the other user name that we created, because nothing has been purchased by the ‘test’user<strong>, </strong>we’ll try getting information for the other user ‘hacker’. To do this we just go ahead and modify the contents of the address bar to point the other user we want to see the orders for.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/214.jpg"><img class="aligncenter size-full wp-image-398" title="2" src="http://webapppentest.files.wordpress.com/2012/07/214.jpg?w=640" alt=""   /></a></p>
<p><strong>Insecure Direct Object Reference</strong></p>
<p>The url to view the previous orders of user with user name ‘hacker’ would be:</p>
<p><a href="http://localhost:8080/HacmeBooks/browseOrders.html?userId=hacker">http://localhost:8080/HacmeBooks/browseOrders.html?userId=hacker</a> this will display all the previous orders by the user ‘hacker’. So the theory was correct and we were able to bypass the access token needed to view the previous orders placed by a user. If we have a look at the result, the screen contains the credit card numbers as well that can be misused.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/313.jpg"><img class="aligncenter size-full wp-image-399" title="3" src="http://webapppentest.files.wordpress.com/2012/07/313.jpg?w=640" alt=""   /></a></p>
<p><strong>Retrieving the other User Data  </strong></p>
<p>This attack scenario highlighted two major problems during working with this application.  The first was that developer left comments in source code that provided the attacker with the clues necessary to launch the attack.  In fact, that was the platform to launch the attack.</p>
<p>Second, there is no horizontal privilege check.  So instead of the user who made purchases, the attacker was able to view the data by sending a manipulated http request in URL of the application page.  This is a classic example of the OWASP Insecure Direct Object Reference web vulnerability.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/396/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=396&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/12/24/hacme-books/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/124.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/214.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/313.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>
	</item>
		<item>
		<title>Hacme Books Week 4</title>
		<link>http://webapp-pentest.com/2012/12/17/hacme-books-week-4/</link>
		<comments>http://webapp-pentest.com/2012/12/17/hacme-books-week-4/#comments</comments>
		<pubDate>Mon, 17 Dec 2012 10:30:14 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Cryptographic Attacks]]></category>
		<category><![CDATA[cross site scripting]]></category>
		<category><![CDATA[Crypto]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=390</guid>
		<description><![CDATA[This is the fourth in a series of five posts for the vulnerable web application Hacme Books. New posts for Hacme Books will post every Monday. Cross Site Scripting Attacks A Cross Site Scripting attack is most commonly used for &#8230; <a href="http://webapp-pentest.com/2012/12/17/hacme-books-week-4/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=390&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the fourth in a series of five posts for the vulnerable web application Hacme Books. New posts for Hacme Books will post every Monday.</p>
<p><strong>Cross Site Scripting Attacks</strong></p>
<p>A Cross Site Scripting attack is most commonly used for luring attacks (i.e. to take the user to another site or page by using an injected script tag in the HTML). Cross Site Scripting, or, <strong>XSS</strong>, works by entering &lt;script&gt; alert() &lt;/script&gt;. The most common use of this vulnerability is to steal the sensitive information from the user system, this can be the cookies from the site written on the user system to provide personalized contents and/or auto login features. A typical XSS attack is regularly part of Social Engineering techniques used by hackers.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/123.jpg"><img class="aligncenter size-full wp-image-391" title="1" src="http://webapppentest.files.wordpress.com/2012/07/123.jpg?w=640" alt=""   /></a></p>
<p><strong>Use of &lt;Script&gt; &lt;/Script&gt; Tags in XSS attacks</strong></p>
<p>In the above picture I have used the &lt;Script&gt;&lt;/Script&gt; tags to write a small script which when executed will prompt the user with a small message box. There is not specific function being performed by the script generated Message Box, but if an attacker wants he/she can run the OS level commands with privilege of the user working on at that time. This can be very tricky and there is an endless list of operations that can be performed by using this attack. For example, the user can be redirected to another site, the hacker could delete, add or modify some information on the user’s system, even the sensitive login information can be sent to a different website than it is intended for.  You have now inserted a “persistent” or “stored” XSS into the server in the location of user feedback data.  Now whenever someone views the page for that book, your user XSS “feedback” will be run in the browser of the person viewing it.  Generically, it will look like this:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/213.jpg"><img class="aligncenter size-full wp-image-392" title="2" src="http://webapppentest.files.wordpress.com/2012/07/213.jpg?w=640" alt=""   /></a></p>
<p>Though this is just a message box that does nothing more the asking the user to push the ‘OK’ button and as soon as user does that, the box will go away and the user will return to normal screen. This can be used when we need some user interaction to perform a malicious activity on the user system. Most of the remote code execution vulnerabilities found in the browsers make use of XSS to do that.</p>
<p><strong>Cryptographic Attacks: “Crypto Wannabe”</strong></p>
<p>Most of the information that is used by the backend system is jumbled &#8212; encrypted to be precise. In this application, which is an online book store, there is a discount of 15% to 25% on all the books purchased during a given time which means the discount on purchase is a limited time offer.</p>
<p>So an attacker goes to website like any other user to buy a book. The limited period discount offer was not there when the site was created for the first time, so the developers must apply some code to provide the discount on purchase for a given period. The amount of discount depends on various factors which may vary from one user to another, but we are not concerned with that scheme at this time. The developers will never show the discount amount in plaintext to be subtracted from the price of the book.</p>
<p>There has to be some way for the application to understand what amount of discount has to be given on any given item.  Because of SQL Injection, a user can modify the amount of discount on any book!  For example if a book is offered on 15% discount the attacker can manipulate the data in such a way that system would end up giving 25% discount on the book which was eligible for only 15 %. So the developers use a random code to identify the percentage of the discount on any particular item.</p>
<p>For example</p>
<ul>
<ul>
<li>• 15% -</li>
<li>o AEODBOBOOE</li>
<li>• 25 % -</li>
<li>o BEAAABBOOE</li>
<li>o BEOABDBOOE</li>
</ul>
</ul>
<p>If we stack the codes one on top of the other, we will get some interesting information that will be very helpful to manipulate the discounts. We are looking for the method used to jumble the discounts to make a distinct value for 15% and 25%.</p>
<p>A careful look on the codes below reveals some interesting information.</p>
<p><strong>A</strong><strong>E</strong><strong>ODBO</strong><strong>BOOE</strong></p>
<p><strong>            </strong><strong>BE</strong><strong>AAAB</strong><strong>BOOE</strong></p>
<p><strong>            BE</strong><strong>OABD</strong><strong>BOOE</strong></p>
<p>The last four letters in every value are the same. In two values, the first two letters are again the same. Two out of the three values are for 25% and one is for 15 %. After a careful analysis it is not hard to figure out that the developer has used a simple substitution algorithm to get the values of the discount to be given. Now, let’s start to understand the algorithm ,we will start with last four digits. The last four digits are the same in all, a Year also has four digits and they will remain same throughout the year so let’s try ‘<strong>2005’ </strong>instead of the BOOE in all the codes and see what we get.</p>
<p>BOOE – The alphabet ‘B’ is the second alphabet so let’s take it as a representation of the number 2 (we get this by placing 2005 on top of BOOE and then comparing corresponding digits and letters). The letter E is taken for number 5. O represents Zero in actual number. The other letters can be replaced by their corresponding numbers derived from the above rule. When we do this let’s see what we get?</p>
<p>AEODBOBOOE – 1504202005 is the decoded form. Let’s see what this means, there are couple of things hidden in this code, one is the date (time bound offer), percentage discount. So the value we get would look like:</p>
<p>Discount      Month    Day    Year</p>
<p>15                 04          20      2005  &#8212; this is how the developer implemented the discount algorithm that takes care of the date as well because it is a time bound offer and beyond the specified date, no discount should be given to any person buying any books. Now that we have the method, it is possible to get as much discount as we want and whatever we use would be validated because we know how it works and we can put in the values straight in a custom HTTP request. For example if I want to get 95% discount I will make the code –</p>
<p>95                 04          20      2007 – IEODBOBOOG &#8212; so by using this value I would get a discount of 95% on whatever book I want.</p>
<p>I will use the coupon created by breaking the algorithm used to buy a book on 95% discount. All I need to do is that go to the site and add the books I want to my shopping cart. Proceed to checkout and enter the discount code I created in the discount coupon box to avail 95% discount.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/312.jpg"><img class="aligncenter size-full wp-image-393" title="3" src="http://webapppentest.files.wordpress.com/2012/07/312.jpg?w=640" alt=""   /></a></p>
<p><strong>Used 95% discount code in the check-out screen</strong></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/49.jpg"><img class="aligncenter size-full wp-image-394" title="4" src="http://webapppentest.files.wordpress.com/2012/07/49.jpg?w=640" alt=""   /></a></p>
<p><strong>Total Amount payable is just $ 5.41 (95% discount)</strong></p>
<p>Join us next Monday for the last in the series on Hacme Books.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/390/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=390&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/12/17/hacme-books-week-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/123.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/213.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/312.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/49.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>
	</item>
		<item>
		<title>Hacme Books Week 3</title>
		<link>http://webapp-pentest.com/2012/12/10/hacme-books-week-3/</link>
		<comments>http://webapp-pentest.com/2012/12/10/hacme-books-week-3/#comments</comments>
		<pubDate>Mon, 10 Dec 2012 10:30:41 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Denial of Service]]></category>
		<category><![CDATA[Data Tempering]]></category>
		<category><![CDATA[DoS]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=384</guid>
		<description><![CDATA[This is the third in a series of five posts for the vulnerable web application Hacme Books. New posts for WebGoat will post every Monday. Denial Of Service Attack Security should provide CIA (Confidentiality, Integrity and Availability). When an attacker &#8230; <a href="http://webapp-pentest.com/2012/12/10/hacme-books-week-3/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=384&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the third in a series of five posts for the vulnerable web application Hacme Books. New posts for WebGoat will post every Monday.</p>
<p><strong>Denial Of Service Attack</strong></p>
<p>Security should provide CIA (Confidentiality, Integrity and Availability). When an attacker attacks the system he/she will compromise one or more of these attributes. In here I will be discussing the Denial of Service attack.  I will be using SQL Injection as the basic attack techniques.</p>
<p>The attacker had the information on how to attack the Hypersonic SQL prior to starting the attack (Google is the best tool available to hackers) by using extensive searches on the target system. For example an attacker can search on Google about how to shut down Hypersonic SQL server.<br />
Most of the SQL Injection vulnerabilities are a result of concatenating the SQL statements including the user input taken using the application interface. Let’s see what a normal SQL statement looks like where we will use a value that is to be input by user at run time:</p>
<p>String Query = “Select * From PRODUCTS  Where Criteria = (USER INPUT Keyword)</p>
<p>The above code takes input from the user and processes the keywords into an SQL criteria via some method that iterates over the tokenized input. So the attacker can maliciously insert extra SQL statements.</p>
<p>In this case since we are creating a DoS attack, we will insert the SHUTDOWN command. A correct SQL statement code generated by the application would be like:</p>
<p>select * from products where title like ‘%<strong>USER KEY WORD</strong>%’ and like ‘%<strong>USER INPUTTED KEYWORDS</strong>%’<br />
<strong>Planning the Attack </strong> The attacker know knows how the SQL statements works, the attacker can now start manipulating the user inputs in SQL statement. Now to make it an effective shutdown statement should be like:</p>
<p>select * from products where title like ‘%’; SHUTDOWN; &#8211;% and like ‘%USER INPUTTED KEYWORDS%’</p>
<p>In SQL the symbol ‘-‘ is used to mark comments so the statement after – will be ignored by the SQL interpreter and the result of the query would be a system shutdown. Here is how I used this to shutdown the system and achieved a DoS attack.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/122.jpg"><img class="aligncenter size-full wp-image-385" title="1" src="http://webapppentest.files.wordpress.com/2012/07/122.jpg?w=640" alt=""   /></a></p>
<p><strong>DoS Attack using SQL Injection</strong></p>
<p>To start with, just type in user input parameter in the search box, but this will not work because it does not cause a DoS, to get around this problem we used the search engine properties, the search engines generally tokenize input into separate pieces for methods like createCriteria(), Since we know that using a ‘+’ symbol in a search engine make the engine treat the input as one keyword so to tweak the attack we just put a + symbol in the search box.  As a result, the SQL attack that works is:  &#8216;;+SHUTDOWN; &#8211;</p>
<p>You should see output that indicates the database has been shut down:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/212.jpg"><img class="aligncenter size-full wp-image-386" title="2" src="http://webapppentest.files.wordpress.com/2012/07/212.jpg?w=640&#038;h=212" alt="" width="640" height="212" /></a></p>
<p><strong>Database Shutdown</strong></p>
<p><strong>Data Tempering with SQL Injection</strong></p>
<p>Note: For this section you will need a valid user account to continue.  Use the Signup link on the main page to create a new user.</p>
<p>The Second type of attack I am going to work with is also a variant of SQL injection. This time we will not force the system shutdown but just modify the data; or Data Tempering. I will try to add a book title on the website (the book actually does not exist). This will cause a rather embarrassing situation for the website and online book store.</p>
<p>To modify the data within a database table the attacker must know the database schema which means that structure of the database table and organization of the data within the tables.</p>
<p>To add a new title in the database when there is no such title available, here again I used the SQL injection but I had more detailed information about the database schema.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/311.jpg"><img class="aligncenter size-full wp-image-387" title="3" src="http://webapppentest.files.wordpress.com/2012/07/311.jpg?w=640" alt=""   /></a></p>
<p><strong>Modify Data Using SQL Injection</strong></p>
<p>I will search for a title that I know is there for sure for example I searched for a book with title “HACKING EXPOSED” and I get the above screen.</p>
<p>Now we have to add a new title. Look at the feedback section, a user can leave the feedback for the title there; I used the Feedback input box to enter a SQL query to add a new title to the products table. It a typical insert query used in SQL, all we need is the name of fields and data type so that we can add the information without causing any errors during the query execution.</p>
<p>Here is the command to use:</p>
<p>my feedback&#8217;, 735); insert into products (title, description, popularity,</p>
<p>price, vendor, category, publisher, isbn, author, imgurl, quantity)</p>
<p>values (&#8216;Eat my shorts you pointy haired boss&#8217;,'A great</p>
<p>book&#8217;,4,29.95,&#8217;Amazon&#8217;,'Technical&#8217;,'Addison</p>
<p>Wesley&#8217;,&#8217;1234567890123&#8242;,&#8217;Disgruntled Employee&#8217;,'http://&#8217;,1); &#8211;</p>
<p>The above query when executed will insert a new book in the table Products with</p>
<p>TITLE – Eat my Shorts you pointy haired boss</p>
<p>Description – A Great Book</p>
<p>Popularity &#8211;   4</p>
<p>Price          &#8211; 29.95</p>
<p>Vendor      &#8211; Amazon</p>
<p>Category   &#8211; Technical</p>
<p>Publisher   &#8211; Addison Wesley</p>
<p>ISBN        &#8211; 1234567890102</p>
<p>In the SQL as I mentioned earlier the symbol ‘-‘is used to mark a comment, so everything after the – will be ignored by the SQL interpreter. Using the SQL injection I will search for the newly added title and find the entry for a book named “Eat My Shorts you Pointy Haired Boss”</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/48.jpg"><img class="aligncenter size-full wp-image-388" title="4" src="http://webapppentest.files.wordpress.com/2012/07/48.jpg?w=640" alt=""   /></a></p>
<p><strong>Search Results for newly added Title</strong></p>
<p>So the purpose of the attack was accomplished, we were able to add a title to the database of the book store. The newly added book does not even exist and has an embarrassing title.  This will sure make people think whether they want to purchase a book from this site or not, because the integrity is compromised.</p>
<p>Join us next Monday for the fourth in the series on Hacme Books.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/384/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=384&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/12/10/hacme-books-week-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/122.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/212.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/311.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/48.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>
	</item>
		<item>
		<title>Hacme Books Week 2</title>
		<link>http://webapp-pentest.com/2012/12/03/hacme-books-week-2/</link>
		<comments>http://webapp-pentest.com/2012/12/03/hacme-books-week-2/#comments</comments>
		<pubDate>Mon, 03 Dec 2012 10:30:10 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[sql injection]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=380</guid>
		<description><![CDATA[This is the second in a series of three posts for the vulnerable web application Hacme Books. New posts for Hacme Books will occur every Monday. Vulnerability Testing  There are two approaches to Vulnerability Testing; White Box testing and Black &#8230; <a href="http://webapp-pentest.com/2012/12/03/hacme-books-week-2/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=380&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the second in a series of three posts for the vulnerable web application Hacme Books. New posts for Hacme Books will occur every Monday.</p>
<p><strong>Vulnerability Testing </strong></p>
<p>There are two approaches to Vulnerability Testing; White Box testing and Black Box testing. The White Box testing provides more accurate results because the source code is available, going through the code makes it easy to find the loopholes in the code and login flow.</p>
<p>On the other hand the Black Box testing is suitable for all non developers, because in this case the source code is not available but just the application interface is provided as it would be to a normal user after implementation. In the current scenario we will be using <strong>Black Box testing. </strong></p>
<p>However, if you want to try the White Box testing, the source code can be downloaded.  I have used some information from the White Box testing techniques. I will call out specifically whenever an important piece of information is extracted by studying the source code of the application.</p>
<p>During the testing of this application we will use two different attack scenarios:</p>
<ol>
<ol>
<li>1) as a normal user using the application, and</li>
<li>2) from the Internet using a web browser.</li>
</ol>
</ol>
<p>One thing worth remember is that there are different approaches to complete the job. I have tried to follow a generic approach to break in starting from collecting information to actually breaking into the web server. We will start checking the application for known vulnerabilities in the web applications, by checking the system if a particular vulnerability is present in the system that can be exploited and how a developer can make the system secure by eliminating the vulnerabilities.</p>
<p>To attack a system, the attacker must have the enough information about the target system. More is the information available to the attacker the more successful will be the attack. The easiest way to find the information about a system is by studying an error message returned by the application.</p>
<p>An error message is returned when a fault condition is encountered during the execution of an application module. The error message tells the user about the error description and what caused this fault condition.</p>
<p>To start with, an attacker can try to create a fault condition and study the error message for extracting the information. Most common method of creating a fault condition is to provide an invalid input to any of the parameter.</p>
<p>All the developer can do is to make sure the user is provided with the least amount of information as possible by the error message (the error message can be restricted to a more generic statement just telling the user that an error has occurred and what caused it). The developer will have to trap an error condition and return a custom error message instead of presenting the user with the complete message returned by the back-end system. Unfortunately though, this is not possible in all the cases.</p>
<p>To see what information we can get from the system is by creating a fault condition, usually this can be done by giving invalid or wrong input to any of parameters. I have used the search box in the home page of Hacme Books,</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/120.jpg"><img class="aligncenter size-full wp-image-381" title="1" src="http://webapppentest.files.wordpress.com/2012/07/120.jpg?w=640" alt=""   /></a><strong>Invalid Input in Search Box</strong></p>
<p>Just put a single apostrophe in the search box.  The developer did not expect such a condition, so the system was not prepared to display an error message caused because of inputting a special character in the search box.  The result is a complete description of error and block of code written to handle the search function. The error message is as :</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/211.jpg"><img class="aligncenter size-full wp-image-382" title="2" src="http://webapppentest.files.wordpress.com/2012/07/211.jpg?w=640&#038;h=198" alt="" width="640" height="198" /></a></p>
<p><strong>Error Message Returned By the Application for Invalid Input to Search</strong></p>
<p>After the attacker hits the Search button, a considerable amount of information is returned. We used one fault condition and the information available is very important, by exploiting this fault condition, we now have following information about the target system:</p>
<ul>
<ul>
<ul>
<li>• <strong>Database Type: &#8211; </strong>The database type is very important because, it will provide the attacker a platform to start from. Every technology/application has some known and unknown flaws that can be exploited in one way or the other. The type of database system used is <strong>Hypersonic SQL</strong> (whole lot of information can be found and known flaws and tools for hypersonic SQL by searching on Google.com).</li>
<li>• <strong>Application Server:- </strong>The application server is the platform where the target application is running. The Application server in this case is <strong>Apache Tomcat.</strong></li>
<li>• Other <strong>filters</strong> that are running in the <strong>servlet stack</strong>.</li>
<li>• The java name spaces mean that this is a <strong>J2EE</strong> application.</li>
</ul>
</ul>
</ul>
<p>Now that we know enough about the system we can start launching the first attack on the target system. In almost all database dependent applications the most common type of attack is <strong>SQL Injection</strong>.</p>
<p>If we need to write or retrieve data to and from database tables we will use the SQL Injection (SQL Injection is more of trial and error approach). SQL injection is the process of inserting special SQL characters in the application input flow of an application. This is achieved via HTTP requests.</p>
<p>Since the attacker is aware of the type of target system, an attacker can analyze various SQL construct supported. The SQL Injection flaw causes different effects on the target system depending on the context used by the attacker, this means that there can be several variations in terms of the final state of the system.</p>
<p>Join us next Monday for the third in the series on Hacme Books.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=380&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/12/03/hacme-books-week-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/120.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/211.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>
	</item>
		<item>
		<title>Hacme Books Week 1</title>
		<link>http://webapp-pentest.com/2012/11/26/hacme-books-week-1/</link>
		<comments>http://webapp-pentest.com/2012/11/26/hacme-books-week-1/#comments</comments>
		<pubDate>Mon, 26 Nov 2012 10:30:01 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=373</guid>
		<description><![CDATA[This is the first in a series of three posts for the vulnerable web application Hacme Books. New posts for Hacme Books will occur every Monday. Hacme Books The Security of web applications is a big concern in today rapidly &#8230; <a href="http://webapp-pentest.com/2012/11/26/hacme-books-week-1/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=373&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the first in a series of three posts for the vulnerable web application Hacme Books. New posts for Hacme Books will occur every Monday.</p>
<p><strong>Hacme Books</strong></p>
<p>The Security of web applications is a big concern in today rapidly growing size of the Internet. The internet is no longer only used to send just e-mails and chat, the online shopping enable the seller to reach the remote user where there is no other way to reach them.</p>
<p>&nbsp;</p>
<p>E-commerce applications involve financial transactions such as credit card numbers and bank account details, so the security of the application and application data is critical to make an online business successful.</p>
<p>&nbsp;</p>
<p>Normally, the security side of things consists of tools that are used by the testers and quality control team after the programmers write the code and develop the application. It is usually difficult for the developers to figure out if the code they are writing is secure or not and normally this is discovered only when the application is ready to be deployed.</p>
<p>&nbsp;</p>
<p><strong>Hacme Books</strong> is designed to enable the programmers to write the secure code. This allows the developers to setup a standard procedure for writing source code in J2EE applications. Hacme Books is a fully functional application for an online book shop written using J2EE.</p>
<p>&nbsp;</p>
<p>This application includes some well known vulnerabilities. Hacme Books follows an MVC architecture that leverages the inversion of control design patterns to drive factory configuration.</p>
<p>&nbsp;</p>
<ol>
<ol>
<li><strong>Installation</strong></li>
</ol>
</ol>
<p>&nbsp;</p>
<p>Hacme Books comes in three formats: Windows binary executable, J2EE WAR File, and Complete Source code. I used the Windows binary executable file available here: <a href="http://downloadcenter.mcafee.com/products/tools/foundstone/hacmebooks2_installer.zip">http://downloadcenter.mcafee.com/products/tools/foundstone/hacmebooks2_installer.zip</a>  The downloaded file is in .zip format, the zip package contents contain the exe file for installation and user guide.</p>
<p>&nbsp;</p>
<p>To install the application just double click on the exe file and follow the instructions to install the Hacme book application. Before starting the installation make sure that JDK is installed on the system.  If it is not the installation will be aborted and setup will take you to the Java download site, download it from there and then again run the installation package.<br />
I am giving the detailed installation instructions with the screenshots of the installation process.</p>
<p>&nbsp;</p>
<ol>
<ol>
<li>1. The first screen that displays when the installation package is run is the License Agreement, to install the package we must click on I Agree, if we do not agree, the installation will abort.</li>
</ol>
</ol>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/1.png"><img class="aligncenter size-full wp-image-374" title="1" src="http://webapppentest.files.wordpress.com/2012/07/1.png?w=640" alt=""   /></a></p>
<ol>
<ol>
<li>2. Next, a screen appears warning users that Hacme Books purposefully introduces vulnerabilities to your system for testing reasons and that Foundstone accepts no liability for system compromises.  Click Next.</li>
</ol>
</ol>
<p>&nbsp;</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/210.jpg"><img class="aligncenter size-full wp-image-375" title="2" src="http://webapppentest.files.wordpress.com/2012/07/210.jpg?w=640" alt=""   /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<ol>
<ol>
<li>3. Leave the default option checked for install location. By default the install location is C:\Program Files\Foundstone Free Tools\Hacme Books 2.0</li>
</ol>
</ol>
<p>&nbsp;</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/310.jpg"><img class="aligncenter size-full wp-image-376" title="3" src="http://webapppentest.files.wordpress.com/2012/07/310.jpg?w=640" alt=""   /></a></p>
<p>&nbsp;</p>
<ol>
<ol>
<li>4. The installation will begin copying files and the progress indicator will show the progress of the installation.</li>
<li>5. Once the installation is finished we will go ahead and test the installed application. Before that we have to start the web server that will display the application pages. It can be started by double clicking the startup.bat file in the Start  All Programs  &#8230;  Hacme Books Server START or directly from the filesystem location at …\tomcat\bin\startup.bat.</li>
</ol>
</ol>
<p>&nbsp;</p>
<p>The application can be verified that it has started by doing a ‘netstat –ano’ and looking at new listening ports:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/47.jpg"><img class="aligncenter size-full wp-image-377" title="4" src="http://webapppentest.files.wordpress.com/2012/07/47.jpg?w=640" alt=""   /></a></p>
<p>&nbsp;</p>
<ol>
<ol>
<li>6. After successfully starting the tomcat server, open the web browser and go to <a href="http://localhost:8989/HacmeBooks">http://localhost:8989/HacmeBooks</a> , this will give the home page of the application. This is the starting point of everything we will be doing during this session.  If the page times out and does not load check your browser proxy settings!</li>
</ol>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>HacmeBooks home page</strong></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/57.jpg"><img class="aligncenter size-full wp-image-378" title="5" src="http://webapppentest.files.wordpress.com/2012/07/57.jpg?w=640" alt=""   /></a></p>
<p><strong>Home Page</strong></p>
<p>Join us next Monday for the second post on Hacme Books.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=373&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/11/26/hacme-books-week-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/1.png" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/210.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/310.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/47.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/57.jpg" medium="image">
			<media:title type="html">5</media:title>
		</media:content>
	</item>
		<item>
		<title>WebMaven Week 3</title>
		<link>http://webapp-pentest.com/2012/10/15/webmaven-week-3-2/</link>
		<comments>http://webapp-pentest.com/2012/10/15/webmaven-week-3-2/#comments</comments>
		<pubDate>Mon, 15 Oct 2012 10:30:01 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Blind SQL Injection]]></category>
		<category><![CDATA[Spoofing Cookies]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[sql injection]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=315</guid>
		<description><![CDATA[This is the last in a series of three posts for the vulnerable web application WebMaven. Cookie With SessionID Before Login Generally, a cookie is encrypted so only the site that created that cookie can read and get information from &#8230; <a href="http://webapp-pentest.com/2012/10/15/webmaven-week-3-2/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=315&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the last in a series of three posts for the vulnerable web application WebMaven.</p>
<p><strong>Cookie With SessionID Before Login</strong></p>
<p>Generally, a cookie is encrypted so only the site that created that cookie can read and get information from that, but if the encryption method used is not secure the cookie can be read by another site or person using a simple Java script. The cookies for Buggy Bank contain account information and a PIN, so it can be used to log in to the account.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/114.jpg"><img class="aligncenter size-full wp-image-316" title="1" src="http://webapppentest.files.wordpress.com/2012/07/114.jpg?w=640" alt=""   /></a></p>
<p><strong>Cookie With Account Number and Pin</strong></p>
<p>Another problem with WebMaven is that it can be used to run the system commands with the current user privilege, this is known that a command can be injected after the account cookie using the special characters (for example, Command Injection via special character in Account cookie). An operating system command can be run simply followed by a semicolon.  This command will be executed when the page with the script is loaded. In this version only <strong>ping</strong> and <strong>netstat</strong> commands are available to make sure the system running WebMaven is safe from any intentional or accidental loss of data because of this vulnerability. The command that I ran to verify this hole is ping (simple utility to check if a host is alive or not) in which a semicolon followed by an OS level command ends up with the web server running that command.</p>
<p><strong><em>SQL INJECTION</em></strong></p>
<p>SQL Injection is most widely used method to get hold of the information used by the application. SQL queries are used to fetch the data from the back-end database and provide it to the application to be presented to the user of the website at that time. The SQL queries are normally predefined in the application to prevent users from running custom queries.  This is not possible in all the cases which require the user input before running a query. In such a case a parameter is passed to the query.  The value of the parameter is entered by the user at run time.  In this case we need the account number to fetch the data for that particular account, but if this can be manipulated it is possible to display the data for all the accounts in system.</p>
<p><strong>Blind SQLi</strong></p>
<p>Another problem is the blind injection; in some cases the attacker does not have the information on what kind of system he/she is going to deal with, the best way to find is to get it from the system itself. Generally if there are any errors in running a query or command, the system returns an error message that tells a lot about the type of target system. While designing such applications, the developers try to maintain the error message limited to the basic information.  For example if the user entered a number instead of character in a query parameter the error message should be simple, such as, “Invalid Input: Numeric Values are not allowed”. But what if the error message that is returned tells the attacker everything he/she would like to know?</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/25.jpg"><img class="aligncenter size-full wp-image-317" title="2" src="http://webapppentest.files.wordpress.com/2012/07/25.jpg?w=640" alt=""   /></a></p>
<p><strong>The Paros Web Proxy</strong></p>
<p>The system we are studying here contains a serious flaw; if a special character is injected in the</p>
<p>Parameter value, the system will return a detailed error message telling the operating system, DBMS, Database name, tables names etc. I used the Paros proxy for intercepting the HTTP 1.1 requests from the web browser and HTTP response from the Web Server. Intercept the HTTP request and manually change the value of the hidden field to special characters. This will result in a detailed error message telling about the database server, database name, tables etc from here on the attacker can start making strategies to get hold of the sensitive account information.</p>
<p><strong><em>Account Number Harvesting </em></strong></p>
<p>There are a few ways in which the valid Account Numbers can be harvested. In this part; which is generally the first part of an attack, we are doing it to study the system and workflow logic.  Without this information it is much more difficult to exploit the vulnerabilities present. To exploit the vulnerabilities we must know if they exist or not.  Then, if they do, we can figure out how we would do it. So the information we need must be gained first hand by getting to know the system and using it to find out all we can.</p>
<p>To login to the account an Account Number and a PIN are needed. If any of these two are incorrect, we will not be allowed to login. An Account Number and PIN combination if tried using brute force attack may take years and can be easily detected by the server admin. So to get a valid account number we must narrow the search for information. When I tried using an Account Number and PIN, I got different error messages on different occasions. I already had two valid test accounts so I used them as known real accounts and known real pin numbers and tried a right/wrong combination to see what happens. There can be a number of combinations of right and wrong. Following is the brief idea on how to get the information we need. Here, an account number is more critical but can be found easily as compared to the PIN. To get a PIN, we must have an account number. Here is how I went after it:</p>
<p>Valid Account Number and PIN, but locked account: &#8211; For security reasons, if we try logging in with a wrong account number and pin, only three attempts can be made. After three unsuccessful attempts the account would be locked. This means that if anyone tries to login using a manual trial and error or more automated brute force, he/she will get only three chances before the account is locked.  The number of letters in ID and PIN are pretty long and will require millions of possible combination to be tried to guess the correct combination.  With only three available attempts, the possibility to login to the accounts are extremely low.  After an account is locked, even the correct Account Number and PIN combination will not work until the account is reactivated by the Admin. The catch is the message that is returned when the correct combination is tried, “Account is locked”, is different from what is displayed if wrong combination is tried. So even if the account is locked, it is possible to find the correct Account Number and PIN.</p>
<p>How hackers use this flaw is that almost anyone can get the account locked because it just needs three invalid login attempts. Once the account is locked, it will not be unlocked even if the correct Account Number + Pin combination is used. So an attacker can lock the account and then use exhaustive brute force attack to guess the correct PIN and Account Number combination.  The correct combination can be found by logging the error messages returned by the system for a locked account.</p>
<p><strong>Harvesting Valid Account Numbers</strong></p>
<p>The attacker can harvest the valid account numbers by exploiting the error messages returned by the system so as to handle different scenarios. Consider an attacker trying to get hold of an account using the known numbers combination to figure out an account number. Here, the attacker will get different messages as well. Let’s take all possible scenarios of Account Number and PIN combinations.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/35.jpg"><img class="aligncenter size-full wp-image-318" title="3" src="http://webapppentest.files.wordpress.com/2012/07/35.jpg?w=640" alt=""   /></a></p>
<p><strong>Valid Account Number Bruting</strong></p>
<ul>
<ul>
<ul>
<li>• <strong>Wrong Account Number and wrong PIN:</strong> This situation will result in generating the message <strong>‘Login failed because User ID does not exist in database’</strong>. This message explains a lot.  The first input is Account Number and if it is not valid nothing else will be processed. So the attacker knows that this is not Account Number…</li>
</ul>
</ul>
</ul>
<ul>
<ul>
<ul>
<li>• <strong>Correct Account Number but wrong PIN:</strong> In this case, the error message generated by the system would be <strong>‘Login failed because of Incorrect PIN” </strong>so the attacker knows that the Account Number is valid, but the PIN is not. Following this procedure, the valid Account Numbers can be figured out</li>
</ul>
</ul>
</ul>
<ul>
<ul>
<ul>
<li>• <strong>Correct Account Number and PIN:</strong> If the account is not locked the message will be success.  The user will be able to login to his/her account. But if the account is locked, the message returned will be specifying that the account is locked, and if the PIN is wrong the message would be <strong>‘Login failed because of invalid PIN’</strong> even if the account is locked. So the attacker can launch a brute force attack and get the correct PIN.</li>
</ul>
</ul>
</ul>
<p>Join us next week where we will begin our run on Hacme Bank.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/315/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=315&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/10/15/webmaven-week-3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/114.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/25.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/35.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>
	</item>
		<item>
		<title>WebMaven Week 2</title>
		<link>http://webapp-pentest.com/2012/10/08/webmaven-week-3/</link>
		<comments>http://webapp-pentest.com/2012/10/08/webmaven-week-3/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 10:30:22 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Spoofing Cookies]]></category>
		<category><![CDATA[Weak Authentication]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=308</guid>
		<description><![CDATA[This is the second in a series of three posts for the vulnerable web application WebMaven. New posts for WebMaven will occur every Monday. Account Option Screen After Valid Login Account Summary Page Funds Transfer Once the task is finished &#8230; <a href="http://webapp-pentest.com/2012/10/08/webmaven-week-3/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=308&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div>This is the second in a series of three posts for the vulnerable web application WebMaven. New posts for WebMaven will occur every Monday.</div>
<div></div>
<div><strong><strong>Account Option Screen After Valid Login</strong><br />
</strong></div>
<p><a href="http://webapppentest.files.wordpress.com/2012/10/1.jpg"><img class="aligncenter size-full wp-image-311" title="1" src="http://webapppentest.files.wordpress.com/2012/10/1.jpg?w=640" alt=""   /></a><strong>Account Summary Page</strong></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/10/2.jpg"><img class="aligncenter size-full wp-image-312" title="2" src="http://webapppentest.files.wordpress.com/2012/10/2.jpg?w=640" alt=""   /></a><strong>Funds Transfer</strong></p>
<p>Once the task is finished the user will click on the logout button to get out of the account summary window and get back to the login screen again.</p>
<p>Now that we know how to work with accounts and funds transfer etc., we will go ahead and start looking for vulnerabilities that can be exploited to get unauthorized access or hack the server.</p>
<p>To hack a system we must know how it works.  That is, how the control flows in the program to accomplish the required objective and exploit any loopholes. First thing is to figure out the flow of logic in an application i.e. how particular conditions are handled and if there is a way we can exploit the logic flow.  To see how the program works or how a particular transaction is handled we look at the <strong>Source Code</strong> of the page. To get the source code of login page, right click on the page and click on ‘View Source’ this will open the source file for that page.</p>
<p>&lt;!DOCTYPE html</p>
<p>PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</p>
<p>&#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#038;gt" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#038;gt</a>;</p>
<p>&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;en-US&#8221; xml:lang=&#8221;en-US&#8221;&gt;</p>
<p>&lt;head&gt;</p>
<p>&lt;title&gt;Welcome to Buggy Bank &#8211; Login&lt;/title&gt;</p>
<p>&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;BODY BGCOLOR=&#8221;#FFFFFF&#8221; LINK=&#8221;#000099&#8243; VLINK=&#8221;#336699&#8243; TEXT=&#8221;#000000&#8243; TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0&gt;</p>
<p>&lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=610&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD WIDTH=4 HEIGHT=11&gt;&lt;IMG SRC=&#8221;../clearpixel.gif&#8221; WIDTH=4 HEIGHT=1 BORDER=0&gt;&lt;/TD&gt;</p>
<p>&lt;TD&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=303&gt;&lt;IMG SRC=&#8221;../clearpixel.gif&#8221; WIDTH=303 HEIGHT=1 BORDER=0&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD HEIGHT=36&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=606 COLSPAN=2&gt;&lt;IMG ID=&#8221;Banner1&#8243; HEIGHT=36 WIDTH=606 SRC=&#8221;../wm-header_NProfessionalBanner.gif&#8221; BORDER=0 ALT=&#8221;Buggy Bank Account Access&#8221;&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD HEIGHT=18&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=303&gt;</p>
<p>&lt;TABLE ID=&#8221;NavigationBar3&#8243; BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=303&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD WIDTH=101&gt;&lt;A HREF=&#8221;../index.html&#8221;&gt;&lt;IMG ID=&#8221;NavigationButton7&#8243; HEIGHT=18 WIDTH=101 SRC=&#8221;../webmaven_NProfessional_up.gif&#8221; BORDER=0 ALT=&#8221;WebMaven Home&#8221;&gt;&lt;/A&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=101&gt;&lt;A HREF=&#8221;../install_guide.html&#8221;&gt;&lt;IMG ID=&#8221;NavigationButton8&#8243; HEIGHT=18 WIDTH=101 SRC=&#8221;../Install_Guide_NProfessional_up.gif&#8221; BORDER=0 ALT=&#8221;Install Guide&#8221;&gt;&lt;/A&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=101 HEIGHT=18&gt;&lt;A HREF=&#8221;../user_guide.html&#8221;&gt;&lt;IMG ID=&#8221;NavigationButton9&#8243; HEIGHT=18 WIDTH=101 SRC=&#8221;../User_Guide_NProfessional_up.gif&#8221; BORDER=0 ALT=&#8221;User Guide&#8221;&gt;&lt;/A&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;/TABLE&gt;</p>
<p>&lt;/TD&gt;</p>
<p>&lt;TD&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;/TABLE&gt;</p>
<p>&lt;/BODY&gt; &lt;!&#8211; The source code for the old sign-on CGI is at /backup/login.cgi.bak &#8211;&gt;&lt;img src=&#8221;/money_burning_md_wht.gif&#8221; /&gt;&lt;h1&gt;Please sign in.&lt;/h1&gt;&lt;form method=&#8221;get&#8221; action=&#8221;/cgi-bin/wm.cgi&#8221; enctype=&#8221;multipart/form-data&#8221;&gt;</p>
<p>Account Number &lt;input type=&#8221;text&#8221; name=&#8221;userid&#8221; value=&#8221;1234567890123750&#8243; /&gt;&lt;p /&gt;PIN &lt;input type=&#8221;password&#8221; name=&#8221;pin&#8221;  /&gt;&lt;p /&gt;&lt;input type=&#8221;hidden&#8221; name=&#8221;transaction&#8221; value=&#8221;login&#8221;  /&gt;&lt;p /&gt;&lt;input type=&#8221;submit&#8221; name=&#8221;.submit&#8221; /&gt;&lt;/form&gt;&lt;p /&gt;&lt;a href=&#8221;/cgi-bin/wm.cgi?transaction=reset&#8221;&gt;Reset all accounts to beginning state.&lt;/a&gt;&lt;hr /&gt;&lt;BODY BGCOLOR=&#8221;#FFFFFF&#8221; LINK=&#8221;#000099&#8243; VLINK=&#8221;#336699&#8243; TEXT=&#8221;#000000&#8243; TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0&gt;</p>
<p>&lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD WIDTH=131 HEIGHT=11&gt;&lt;IMG SRC=&#8221;../clearpixel.gif&#8221; WIDTH=131 HEIGHT=1 BORDER=0&gt;&lt;/TD&gt;</p>
<p>&lt;TD&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD&gt;&lt;/TD&gt;</p>
<p>&lt;TD NOWRAP&gt; [&lt;A HREF="../index.html"&gt;WebMaven&amp;nbsp;Home&lt;/A&gt;]  [&lt;A HREF="../install_guide.html"&gt;Install&amp;nbsp;Guide&lt;/A&gt;]  [&lt;A HREF="../user_guide.html"&gt;User&amp;nbsp;Guide&lt;/A&gt;] &lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;/TABLE&gt;</p>
<p>&lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=459&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD WIDTH=108 HEIGHT=11&gt;&lt;IMG SRC=&#8221;../clearpixel.gif&#8221; WIDTH=108 HEIGHT=1 BORDER=0&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=351&gt;&lt;IMG SRC=&#8221;../clearpixel.gif&#8221; WIDTH=351 HEIGHT=1 BORDER=0&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;TR VALIGN=TOP ALIGN=LEFT&gt;</p>
<p>&lt;TD&gt;&lt;/TD&gt;</p>
<p>&lt;TD WIDTH=351&gt;&lt;P ALIGN=CENTER&gt;&lt;FONT SIZE=&#8221;-1&#8243;&gt;Please contact our &lt;/FONT&gt;&lt;A HREF=&#8221;mailto:webmaven@mavensecurity.com&#8221;&gt;&lt;FONT SIZE=&#8221;-1&#8243;&gt;Webmaster&lt;/FONT&gt;&lt;/A&gt;&lt;FONT SIZE=&#8221;-1&#8243;&gt; with questions or comments. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT SIZE=&#8221;-2&#8243;&gt;©</p>
<p>&lt;/FONT&gt;&lt;FONT SIZE=&#8221;-1&#8243;&gt; &lt;/FONT&gt;&lt;FONT SIZE=&#8221;-2&#8243;&gt;Copyright 2002 David Rhoades&lt;/FONT&gt;&lt;/TD&gt;</p>
<p>&lt;/TR&gt;</p>
<p>&lt;/TABLE&gt;</p>
<p>&lt;/BODY&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p>The code seems to be ok, but if we look carefully the first flaw in this code is the method used to send the credential for authentication is GET.  This means the account number and password would be visible during the login. So the ID and Password can be stolen because the GET method will expose it and it is not encrypted while going from the client web browser to the Buggy Bank server.</p>
<p>The second problem is there are no anti-caching methods used on the pages where sensitive data is displayed. Normally in almost all the Banking sites there is a idle time limit after which the session will expire and we must log back in to get back into the account.  This is a very important property as normally a user might not sign out from the account and instead just click the Close button on top right hand side of the page.  The page will be closed but the session is still there, so the attacker can get into the system by using the previous session ID without being asked for a PIN.  Moreover, the cookie contains the encrypted account name and password that can be decoded easily.  If we login to the Buggy Bank with the first ID and password provided on the home page, we will get the account details like Balance, Total Amount etc.  Now, if we close the browser window and open it again it should ask for an Account Number and PIN again. It does ask for them, but we can bypass that. All we need to do is get the session ID from the previous successful login and we will be able to access the last session without knowing Account Number and PIN.</p>
<p>In all the sites, especially secure sites like online shopping and banking, the user ID or account number field has Auto Complete property disabled. This means that when we click in the Account Number box, the list of all account numbers that were used to login prior to that will not be there, so that no one gets an account number from that list.  In the current application, the Auto Complete is on in the Account Name field so the user trying to login will be able to see the account numbers that were used by other users to login to their accounts. This makes the job of an attacker easy because they don’t have to use their resources on finding the account numbers.</p>
<p><strong><em>Attacks</em></strong></p>
<p><strong>Weak Authentication Cookie </strong></p>
<p>A cookie is used by the web server to show personalized content to the user every time they visit a web site. A cookie is created when a website is opened; it is nothing but a small text file containing user preferences and sometimes the login information and session ID.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/10/3.jpg"><img class="aligncenter size-full wp-image-313" title="3" src="http://webapppentest.files.wordpress.com/2012/10/3.jpg?w=640" alt=""   /></a></p>
<div>Joint us next Monday for the final week of WebMaven.</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/308/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=308&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/10/08/webmaven-week-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/10/1.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/10/2.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/10/3.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>
	</item>
		<item>
		<title>WebMaven Week 1</title>
		<link>http://webapp-pentest.com/2012/10/01/webmaven-week-1/</link>
		<comments>http://webapp-pentest.com/2012/10/01/webmaven-week-1/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 10:30:50 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=301</guid>
		<description><![CDATA[This is the first in a series of three posts for the vulnerable web application WebMaven. New posts for WebMaven will occur every Monday. WebMaven WebMaven v.1.01 is an interactive web application that simulates several vulnerabilities at the application-level. WebMaven &#8230; <a href="http://webapp-pentest.com/2012/10/01/webmaven-week-1/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=301&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the first in a series of three posts for the vulnerable web application WebMaven. New posts for WebMaven will occur every Monday.</p>
<ol>
<li><strong>WebMaven</strong></li>
</ol>
<p>WebMaven v.1.01 is an interactive web application that simulates several vulnerabilities at the application-level. WebMaven is useful for the following:</p>
<ul>
<li>• Training: practicing security assessment techniques</li>
<li>• Benchmarking: ensure web security tools perform their tests correctly</li>
</ul>
<p>This program helps in explaining the problems found in application. It is an Online banking application and session id hijacking and cookie tracking can be performed in real time, in our case we use the web server and client on the same machine, so we would be able to use the cookie in any way we need to.</p>
<ol>
<ol>
<li><strong><em>Install Requirements</em></strong></li>
</ol>
</ol>
<p>WebMaven v.1.01 must be installed on a system that has a web server that supports Perl CGI scripts. I used a Windows XP SP3 computer, with Internet Explorer 8 and Paros web proxy. The proxy is needed to intercept and modify the HTTP requests. The Web server I used is Apache 2.2.</p>
<ol>
<ol>
<ol>
<li><strong>Installing Perl</strong></li>
</ol>
</ol>
</ol>
<p>You will need to install Perl, go to <a href="http://www.perl.org">http://www.perl.org</a> and download the appropriate client for whichever operating system you are running.</p>
<ol>
<ol>
<ol>
<li><strong>Installing Web Server</strong></li>
</ol>
</ol>
</ol>
<p>The web server of choice for WebMaven is Apache since it is open source.</p>
<p>See <a href="http://httpd.apache.org/">http://httpd.apache.org/</a> for Apache installation instructions.</p>
<p>(NOTE: You will need to add CGI Script support to Apache to get the WebMaven CGI scripts to work correctly.  For instructions on how to do this, consult The Site Wizard’s Tutorial: <a href="http://www.thesitewizard.com/archive/addcgitoapache.shtml">http://www.thesitewizard.com/archive/addcgitoapache.shtml</a>)</p>
<ol>
<ol>
<ol>
<li><strong>Install WebMaven Files</strong></li>
</ol>
</ol>
</ol>
<p>You can download WebMaven from this website: <a href="http://www.mavensecurity.com/WebMaven.php">http://www.mavensecurity.com/WebMaven.php</a></p>
<p>Uncompress the WebMaven archive distribution file. The contents of the WebMaven1.1 folder would be directory “<strong>doc”</strong> and “<strong>src” </strong>and some files (Install, License and Readme).  Place the <strong>\wm</strong> directory outside server’s document root but within reach of CGI scripts. This would be <strong>C:\Program Files\Apache Group\Apache2\wm.  </strong>Place the WebMaven CGI script (<strong>wm.cgi</strong>) within the normal CGI directory for the web server. This would be <strong>C:\Program Files\Apache Group\Apache2\cgi-bin\wm.cgi.  </strong>Place the <strong>./templates</strong> folder within the normal CGI directory for the web server, this would be <strong>C:\Program Files\Apache Group\Apache2\cgi-bin\templates.  </strong>Place all the files within the <strong>./webmaven_html</strong> folder directly into the web server document root.</p>
<p><strong>Begin!</strong></p>
<p>The installation is complete and we are ready to start exploring the WebMaven1.1 interface and try to break in and find vulnerabilities that can be exploited. The aim here is to go through every aspect of a web application and figure out the weak points and bad logic flow that can be used to get what we want.</p>
<p>To start working make sure that web-server i.e. Apache is running, we can check for the Apache icon in task-bar or go to All programs and look for Apache folder and click on Start Server, this will start the server if it is not running.  Now open the Internet Explorer and in the address bar type:  <a href="http://localhost:8080/index.html"><strong>http://localhost:8080/index.html</strong></a>(you might need to use port 80 if that is the port Apache is configured to run on).</p>
<p>Localhost (127.0.0.1) is the address of the loop-back adapter and 8080 is the port on which apache is running, if everything is setup right, we get the following page, this is the home page of WebMaven1.1  Another name for WebMaven1.1 is Buggy Bank.</p>
<p>Click on the login link on the left hand side to go to the bank account login.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/113.jpg"><img class="aligncenter size-full wp-image-302" title="1" src="http://webapppentest.files.wordpress.com/2012/07/113.jpg?w=640" alt=""   /></a></p>
<ol>
<ol>
<ol>
<li><strong>Buggy Bank Login Page</strong></li>
</ol>
</ol>
</ol>
<p>We need an account number and a pin to login to the account. For starting we have two accounts that we will be using, there are other accounts as well but that is up to the hacker, how many accounts can he/she get.</p>
<p><strong>Acct No: 1234567890123660 and Pin – 1234</strong></p>
<p><strong>Acct No: 1234567890123661 and pin – 4321</strong></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/24.jpg"><img class="aligncenter size-full wp-image-303" title="2" src="http://webapppentest.files.wordpress.com/2012/07/24.jpg?w=640" alt=""   /></a></p>
<ol>
<ol>
<ol>
<li><strong>Login to Account screen</strong></li>
</ol>
</ol>
</ol>
<p>Use any one of the two accounts to login to the application and check the account balance, funds transfers etc.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/07/34.jpg"><img class="aligncenter size-full wp-image-304" title="3" src="http://webapppentest.files.wordpress.com/2012/07/34.jpg?w=640" alt=""   /></a></p>
<p>Join us again next Monday for the send in the series on WebMaven.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/301/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=301&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/10/01/webmaven-week-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/113.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/24.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/07/34.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>
	</item>
		<item>
		<title>WebGoat Week 10</title>
		<link>http://webapp-pentest.com/2012/09/24/webgoat-week-10/</link>
		<comments>http://webapp-pentest.com/2012/09/24/webgoat-week-10/#comments</comments>
		<pubDate>Mon, 24 Sep 2012 10:30:21 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[SOAP Request]]></category>
		<category><![CDATA[WSDL Scanning]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=117</guid>
		<description><![CDATA[This is the last in a series of ten posts for the OWSAP WebGoat vulnerable web application. New posts for WebGoat will post every Monday. Session Fixation For this task you are the hacker named Joe and you are trying &#8230; <a href="http://webapp-pentest.com/2012/09/24/webgoat-week-10/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=117&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the last in a series of ten posts for the OWSAP WebGoat vulnerable web application. New posts for WebGoat will post every Monday.</p>
<p><strong>Session Fixation</strong></p>
<p>For this task you are the hacker named Joe and you are trying to steal a session from a user named Jane. You are instructed to send an email that has already been prepared to Jane which looks like an official bank email. You are told that you need to add the sessionID (SID) to the email which will be appended to the link in the fake email.</p>
<p>To append the SID to the link you will need to use this:</p>
<p>&amp;SID=sessionID where sessionID is whatever you would like</p>
<p>So enter the appeneded statement to the link and click the Send Mail button.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/114.jpg"><img class="aligncenter size-full wp-image-278" title="1" src="http://webapppentest.files.wordpress.com/2012/09/114.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/27.jpg"><img class="aligncenter size-full wp-image-279" title="2" src="http://webapppentest.files.wordpress.com/2012/09/27.jpg?w=640" alt=""   /></a></p>
<p>Now you are acting as Jane looking at the email she received from the hacker Joe. Click on the link you see for Goat Hills Financial.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/33.jpg"><img class="aligncenter size-full wp-image-280" title="3" src="http://webapppentest.files.wordpress.com/2012/09/33.jpg?w=640" alt=""   /></a></p>
<p>Now you, as Jane, are prompted to enter your name and password.</p>
<p>You can see that the SID is visible in the URL bar:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/43.jpg"><img class="aligncenter size-full wp-image-281" title="4" src="http://webapppentest.files.wordpress.com/2012/09/43.jpg?w=640" alt=""   /></a></p>
<p>Now login as Jane with password tarzan:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/53.jpg"><img class="aligncenter size-full wp-image-282" title="5" src="http://webapppentest.files.wordpress.com/2012/09/53.jpg?w=640" alt=""   /></a></p>
<p>Click the Login button to continue.</p>
<p>Now that Jane has logged in using her credentials we can hijack her session because we know the SID. You are told to follow the link to reach the login screen.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/63.jpg"><img class="aligncenter size-full wp-image-283" title="6" src="http://webapppentest.files.wordpress.com/2012/09/63.jpg?w=640" alt=""   /></a></p>
<p>As you see the SID is not what we need it to be to hijack Jane’s session&#8230;yet. Let’s change the SID to 0wn3d to continue and go to that address with the updated SID.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/73.jpg"><img class="aligncenter size-full wp-image-284" title="7" src="http://webapppentest.files.wordpress.com/2012/09/73.jpg?w=640" alt=""   /></a></p>
<p>After going to the address you can see that we have hijacked Jane’s session:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/83.jpg"><img class="aligncenter size-full wp-image-285" title="8" src="http://webapppentest.files.wordpress.com/2012/09/83.jpg?w=640" alt=""   /></a></p>
<p><strong>Web Services</strong></p>
<p><strong>Create a SOAP Request</strong></p>
<p>The create a SOAP request lesson wants you to connect to the web service description language (WSDL). You are given a URL for the web service at:</p>
<p><a href="http://localhost/WebGoat/services/SoapRequest">http://localhost/WebGoat/services/SoapRequest</a></p>
<p>You are also told that you can view the WSDL by adding ?WSDL on the end of the web service request.</p>
<p>To complete the lesson you have to look at the WSDL and determine the number of operations that are defined in teh WSDL. Once you have this information enter it into the textbox and click the Submit button.</p>
<p>First enter the below address into your web browser and go to it.</p>
<p><a href="http://127.0.0.1:8088/">http://127.0.0.1:8088/WebGoat/services/SoapRequest?WSDL</a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/93.jpg"><img class="aligncenter size-full wp-image-286" title="9" src="http://webapppentest.files.wordpress.com/2012/09/93.jpg?w=640" alt=""   /></a></p>
<p>You should see the WSDL file, now just figure out how many operations this file has defined.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/103.jpg"><img class="aligncenter size-full wp-image-287" title="10" src="http://webapppentest.files.wordpress.com/2012/09/103.jpg?w=640" alt=""   /></a></p>
<p>I see four in total.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/115.jpg"><img class="aligncenter size-full wp-image-288" title="11" src="http://webapppentest.files.wordpress.com/2012/09/115.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/123.jpg"><img class="aligncenter size-full wp-image-289" title="12" src="http://webapppentest.files.wordpress.com/2012/09/123.jpg?w=640" alt=""   /></a></p>
<p>Next up we are prompted to type in the id parameter in the getFirstNameRequest method.</p>
<p>The type for the getFirstNameRequest is int</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/133.jpg"><img class="aligncenter size-full wp-image-290" title="13" src="http://webapppentest.files.wordpress.com/2012/09/133.jpg?w=640" alt=""   /></a></p>
<p>Type int into the textbox and click the Submit button.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/143.jpg"><img class="aligncenter size-full wp-image-291" title="14" src="http://webapppentest.files.wordpress.com/2012/09/143.jpg?w=640" alt=""   /></a></p>
<p>Next we are told to intercept the request and invoke any method by sending a valid SOAP request for a valid account. Press Generate an HTTP Request and go to WebScarab and take a look at the webservices. Make sure the WSDL is correct,a nd verify the operation, finally modify the value field with 101 and execute it.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/153.jpg"><img class="aligncenter size-full wp-image-292" title="15" src="http://webapppentest.files.wordpress.com/2012/09/153.jpg?w=640" alt=""   /></a></p>
<p><strong>WSDL Scanning</strong></p>
<p>This lesson we are tasked with trying to get credit card number from a database through a web service.</p>
<p>We are told to reference a WSDL file to assist us with getting this information. Go ahead and open up the file that is linked and take a look around. You should see a parameter named getCreditCard:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/163.jpg"><img class="aligncenter size-full wp-image-293" title="16" src="http://webapppentest.files.wordpress.com/2012/09/163.jpg?w=640" alt=""   /></a></p>
<p>On with the attack, first select any one of the elements in the listbox and make sure that 101 is in the id textbox. Start the Tamper Data service; click the Submit button followed by the Tamper button. Next change the field parameter to getCreditCard and click the OK button:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/173.jpg"><img class="aligncenter size-full wp-image-294" title="17" src="http://webapppentest.files.wordpress.com/2012/09/173.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/183.jpg"><img class="aligncenter size-full wp-image-295" title="18" src="http://webapppentest.files.wordpress.com/2012/09/183.jpg?w=640" alt=""   /></a></p>
<p><strong>Web Service SAX Injection</strong></p>
<p>This lesson we are going to use a SOAP request to execute a function defined in the WSDL file.</p>
<p>The goal of this lesson is to reset the password for a user who is different than the user who has user-ID 101.</p>
<p>When the password textbox has a value  in it and the Go button is pressed an XML request is created, submitted and parsed by the SAX server:</p>
<p>&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;</p>
<p>&lt;wsns0:Envelope</p>
<p>? xmlns:xsi=&#8217;<a href="http://www.w3.org/2001/XMLSchema-instance&#038;#8217" rel="nofollow">http://www.w3.org/2001/XMLSchema-instance&#038;#8217</a>;</p>
<p>? xmlns:xsd=&#8217;<a href="http://www.w3.org/2001/XMLSchema&#038;#8217" rel="nofollow">http://www.w3.org/2001/XMLSchema&#038;#8217</a>;</p>
<p>? xmlns:wsns0=&#8217;<a href="http://schemas.xmlsoap.org/soap/envelope/&#038;#8217" rel="nofollow">http://schemas.xmlsoap.org/soap/envelope/&#038;#8217</a>;</p>
<p>? xmlns:wsns1=&#8217;<a href="http://lessons.webgoat.owasp.org&#8217;&#038;gt" rel="nofollow">http://lessons.webgoat.owasp.org&#8217;&#038;gt</a>;</p>
<p>? &lt;wsns0:Body&gt;</p>
<p>??? &lt;wsns1:changePassword&gt;</p>
<p>????? &lt;id xsi:type=&#8217;xsd:int&#8217;&gt;101&lt;/id&gt;</p>
<p>????? &lt;password xsi:type=&#8217;xsd:string&#8217;&gt;[password]&lt;/password&gt;</p>
<p>??? &lt;/wsns1:changePassword&gt;</p>
<p>? &lt;/wsns0:Body&gt;</p>
<p>&lt;/wsns0:Envelope&gt;</p>
<p>To complete this attack we need to ensure that the XML request that is sent to the server is this:</p>
<p>&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;</p>
<p>&lt;wsns0:Envelope</p>
<p>? xmlns:xsi=&#8217;<a href="http://www.w3.org/2001/XMLSchema-instance&#038;#8217" rel="nofollow">http://www.w3.org/2001/XMLSchema-instance&#038;#8217</a>;</p>
<p>? xmlns:xsd=&#8217;<a href="http://www.w3.org/2001/XMLSchema&#038;#8217" rel="nofollow">http://www.w3.org/2001/XMLSchema&#038;#8217</a>;</p>
<p>? xmlns:wsns0=&#8217;<a href="http://schemas.xmlsoap.org/soap/envelope/&#038;#8217" rel="nofollow">http://schemas.xmlsoap.org/soap/envelope/&#038;#8217</a>;</p>
<p>? xmlns:wsns1=&#8217;<a href="http://lessons.webgoat.owasp.org&#8217;&#038;gt" rel="nofollow">http://lessons.webgoat.owasp.org&#8217;&#038;gt</a>;</p>
<p>? &lt;wsns0:Body&gt;</p>
<p>??? &lt;wsns1:changePassword&gt;</p>
<p>????? &lt;id xsi:type=&#8217;xsd:int&#8217;&gt;101&lt;/id&gt;</p>
<p>????? &lt;password xsi:type=&#8217;xsd:string&#8217;&gt;[password]&lt;/password&gt;</p>
<p>??? &lt;/wsns1:changePassword&gt;</p>
<p>??? &lt;wsns1:changePassword&gt;</p>
<p>????? &lt;id xsi:type=&#8217;xsd:int&#8217;&gt;102&lt;/id&gt;</p>
<p>????? &lt;password xsi:type=&#8217;xsd:string&#8217;&gt;newpassword&lt;/password&gt;</p>
<p>??? &lt;/wsns1:changePassword&gt;</p>
<p>? &lt;/wsns0:Body&gt;</p>
<p>&lt;/wsns0:Envelope&gt;</p>
<p>In order to accomplish this we need to inject this statement:</p>
<p>ewpassword&lt;/password&gt;</p>
<p>??? &lt;/wsns1:changePassword&gt;</p>
<p>??? &lt;wsns1:changePassword&gt;</p>
<p>????? &lt;id xsi:type=&#8217;xsd:int&#8217;&gt;102&lt;/id&gt;</p>
<p>????? &lt;password xsi:type=&#8217;xsd:string&#8217;&gt;newpassword</p>
<p>We cannot do this within the textbox form due to HTML field limitations. Open up the Tamer Data tool and start the service. Click the Go button and then the Tamper button. In the password field enter the injection code from above and click OK.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/193.jpg"><img class="aligncenter size-full wp-image-296" title="19" src="http://webapppentest.files.wordpress.com/2012/09/193.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/203.jpg"><img class="aligncenter size-full wp-image-297" title="20" src="http://webapppentest.files.wordpress.com/2012/09/203.jpg?w=640" alt=""   /></a></p>
<p>Join us again next Monday when we start the series on WebMaven.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=117&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/09/24/webgoat-week-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/114.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/27.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/33.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/43.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/53.jpg" medium="image">
			<media:title type="html">5</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/63.jpg" medium="image">
			<media:title type="html">6</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/73.jpg" medium="image">
			<media:title type="html">7</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/83.jpg" medium="image">
			<media:title type="html">8</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/93.jpg" medium="image">
			<media:title type="html">9</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/103.jpg" medium="image">
			<media:title type="html">10</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/115.jpg" medium="image">
			<media:title type="html">11</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/123.jpg" medium="image">
			<media:title type="html">12</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/133.jpg" medium="image">
			<media:title type="html">13</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/143.jpg" medium="image">
			<media:title type="html">14</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/153.jpg" medium="image">
			<media:title type="html">15</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/163.jpg" medium="image">
			<media:title type="html">16</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/173.jpg" medium="image">
			<media:title type="html">17</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/183.jpg" medium="image">
			<media:title type="html">18</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/193.jpg" medium="image">
			<media:title type="html">19</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/203.jpg" medium="image">
			<media:title type="html">20</media:title>
		</media:content>
	</item>
		<item>
		<title>WebGoat Week 9</title>
		<link>http://webapp-pentest.com/2012/09/17/webgoat-week-9/</link>
		<comments>http://webapp-pentest.com/2012/09/17/webgoat-week-9/#comments</comments>
		<pubDate>Mon, 17 Sep 2012 10:30:54 +0000</pubDate>
		<dc:creator>Ma5t3rX</dc:creator>
				<category><![CDATA[Bypass Client Side Validation]]></category>
		<category><![CDATA[Client-Side Attacks]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Session Hijacking]]></category>
		<category><![CDATA[Spoofing Cookies]]></category>
		<category><![CDATA[Client Side Attacks]]></category>
		<category><![CDATA[cross site scripting]]></category>

		<guid isPermaLink="false">http://webapp-pentest.com/?p=115</guid>
		<description><![CDATA[This is the ninth in a series of ten posts for the OWSAP WebGoat vulnerable web application. New posts for WebGoat will post every Monday. Exploit Unchecked Email This lesson has two steps: first you are to send a malicious &#8230; <a href="http://webapp-pentest.com/2012/09/17/webgoat-week-9/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=115&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is the ninth in a series of ten posts for the OWSAP WebGoat vulnerable web application. New posts for WebGoat will post every Monday.</p>
<p><strong>Exploit Unchecked Email</strong></p>
<p>This lesson has two steps: first you are to send a malicious script to the website admin and second you are to send a malicious script to a ‘friend’ from OWASP.</p>
<p>So the first thing you are going to do is put the input shown below into the Questions or Comments textbox and click send:</p>
<p>&lt;script&gt;alert(&#8220;XSS&#8221;)&lt;/script&gt;</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/112.jpg"><img class="aligncenter size-full wp-image-250" title="1" src="http://webapppentest.files.wordpress.com/2012/09/112.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/26.jpg"><img class="aligncenter size-full wp-image-251" title="2" src="http://webapppentest.files.wordpress.com/2012/09/26.jpg?w=640" alt=""   /></a></p>
<p>Next we need to send it to a ‘friend’ from OWASP.</p>
<p>Again put the script into the same textbox as before but before you click Send open up Tamer Data and start the tamper service. Intercept the request and change the to field to another email address.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/32.jpg"><img class="aligncenter size-full wp-image-252" title="3" src="http://webapppentest.files.wordpress.com/2012/09/32.jpg?w=640" alt=""   /></a></p>
<p>You can see here that the email was going to <a href="mailto:webgoat.admin@owasp.org">webgoat.admin@owasp.org</a> (40 is the ASCII for @, you need to put the % for URL encoding). So let’s send this to <a href="mailto:friend@owasp.org">friend@owasp.org</a>. You will need to enter this:</p>
<p>Friend%40owasp.org</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/42.jpg"><img class="aligncenter size-full wp-image-253" title="4" src="http://webapppentest.files.wordpress.com/2012/09/42.jpg?w=640" alt=""   /></a></p>
<p>Click the OK button and you should see this:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/52.jpg"><img class="aligncenter size-full wp-image-254" title="5" src="http://webapppentest.files.wordpress.com/2012/09/52.jpg?w=640" alt=""   /></a></p>
<p><strong>Bypass Client Side JavaScript Validation</strong></p>
<p>For this lesson you are given seven JavaScript validation mechanisms, all of which must have valid values in to submit successfully. You are told that both client-side and server side validation occur on these mechanisms; break the client-side validation.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/62.jpg"><img class="aligncenter size-full wp-image-255" title="6" src="http://webapppentest.files.wordpress.com/2012/09/62.jpg?w=640" alt=""   /></a></p>
<p>Open WebScarab and check off request intercepts make sure to have everything highlighted.  Now go the page and hit submit. Go to the WebScarab window and check the encoded url tabbed, and you will see the values. Simply modify them, in the screenshot below I simply added the @ to each field and then press accept.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/72.jpg"><img class="aligncenter size-full wp-image-256" title="7" src="http://webapppentest.files.wordpress.com/2012/09/72.jpg?w=640" alt=""   /></a></p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/82.jpg"><img class="aligncenter size-full wp-image-257" title="8" src="http://webapppentest.files.wordpress.com/2012/09/82.jpg?w=640" alt=""   /></a></p>
<p><strong>Session Management Flaws</strong></p>
<p><strong>Hijack a Session</strong></p>
<p>For this lesson you are attempting to gain access to a user’s session.</p>
<p>You will need the jhijack tool available at <a href="%22ht">http://sourceforge.net/projects/jhijack/</a>.  Go head and startup WebScarab and set your proxies. Turn on request intercepts, view hidden fields and finally launch the Jhijack.  Now reload the page and we will look at webscarab.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/92.jpg"><img class="aligncenter size-full wp-image-258" title="9" src="http://webapppentest.files.wordpress.com/2012/09/92.jpg?w=640" alt=""   /></a></p>
<p>Let&#8217;s take a moment and configure out jHijack. We need put our Host, and port into it first.  In the example below we see the IP address of this particular VM and port number, yours maybe different. Now we need to find a success message of some kind. So far we have noticed in Webgoat, that every time we complete a mission we get a &#8220;Congratulations&#8221; so let&#8217;s use that in our Grep (it&#8217;s case sensitive).  The last part we need to fill in is the URL.  See below.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/102.jpg"><img class="aligncenter size-full wp-image-259" title="10" src="http://webapppentest.files.wordpress.com/2012/09/102.jpg?w=640" alt=""   /></a></p>
<p>Now we need to go back to WebScarab and select the Session ID tab (if you don&#8217;t see it make sure you are using WebScarab in it&#8217;s full version. Select previous requests and choose the appropriate url (picture below).  Now select the cookie weakid and remove it.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/113.jpg"><img class="aligncenter size-full wp-image-260" title="11" src="http://webapppentest.files.wordpress.com/2012/09/113.jpg?w=640" alt=""   /></a></p>
<p>Go to the bottom of the screen and hit test. You should receive this success message.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/122.jpg"><img class="aligncenter size-full wp-image-261" title="12" src="http://webapppentest.files.wordpress.com/2012/09/122.jpg?w=640" alt=""   /></a></p>
<p>Now we need to collect some data. Set the fetch number to 50 and hit fetch. Go up to the Analysis tab and set the session ID and you should receive the list of cookies out there.  We want to look specifically at the Session ID numerical value. Not that it is incrementing by 1.  Now, there is a gap there, between 19400 and 19402. That&#8217;s an open session so let&#8217;s focus on that.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/132.jpg"><img class="aligncenter size-full wp-image-262" title="13" src="http://webapppentest.files.wordpress.com/2012/09/132.jpg?w=640" alt=""   /></a></p>
<p>The second part of the values has a large gap between them so we need to &#8220;guess&#8221; at what that value is, but we have JjHijack to make this really simple. Copy out the one above and below the target and  paste them into a notepad. Doing this makes it easier to see and copy.  See the example below. Notice the [] is a range.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/142.jpg"><img class="aligncenter size-full wp-image-263" title="14" src="http://webapppentest.files.wordpress.com/2012/09/142.jpg?w=640" alt=""   /></a></p>
<p>Now it&#8217;s simply filling in the missing information in jHijack. Go back to WebScarab and gather the JsessionID, parameters and  enter them in. Note we want to place a $ at the end of our WEAKID value. Finally, take the range and enter that in.  Then hit hijack. See below.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/152.jpg"><img class="aligncenter size-full wp-image-264" title="15" src="http://webapppentest.files.wordpress.com/2012/09/152.jpg?w=640" alt=""   /></a></p>
<p>We refresh the page one last time and go back to the WebScarab intercept and swap out the weakid.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/162.jpg"><img class="aligncenter size-full wp-image-265" title="16" src="http://webapppentest.files.wordpress.com/2012/09/162.jpg?w=640" alt=""   /></a></p>
<p>And hit accept and we have our congratulations message.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/172.jpg"><img class="aligncenter size-full wp-image-266" title="17" src="http://webapppentest.files.wordpress.com/2012/09/172.jpg?w=640" alt=""   /></a></p>
<p><strong>Spoof an Authentication Cookie</strong></p>
<p>For this lesson you are told to login using either webgoat/webgoat or aspect/aspect as the username/password combination. Next you are told to edit the cookie to change your identity to alice.</p>
<p>So first off log in as webgoat and click the Login button.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/182.jpg"><img class="aligncenter size-full wp-image-267" title="18" src="http://webapppentest.files.wordpress.com/2012/09/182.jpg?w=640" alt=""   /></a></p>
<p>On the top of the webgoat page you should see a link that says Show Cookies. Click on the Show Cookies option and you will see the cookie that was created when you logged in as webgoat.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/192.jpg"><img class="aligncenter size-full wp-image-268" title="19" src="http://webapppentest.files.wordpress.com/2012/09/192.jpg?w=640" alt=""   /></a></p>
<p>The authorization cookie or the user webgoat is 65432ubphcfx as shown above.</p>
<p>Go ahead and click the Logout button and then login with aspec/aspect next:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/202.jpg"><img class="aligncenter size-full wp-image-269" title="20" src="http://webapppentest.files.wordpress.com/2012/09/202.jpg?w=640" alt=""   /></a></p>
<p>Click on the Show Cookies link again (might have to click twice) and you should get your authorization cookie:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/212.jpg"><img class="aligncenter size-full wp-image-270" title="21" src="http://webapppentest.files.wordpress.com/2012/09/212.jpg?w=640" alt=""   /></a></p>
<p>For this authorization cookie we see that aspect has a value of 65432udfqtb.</p>
<p>So the different between the two logins is the letters after 65432.</p>
<p>The key to this attack is that the username is a really basic cipher. Let’s take a look at these authorization cookies versus their usernames:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/221.jpg"><img class="aligncenter size-full wp-image-271" title="22" src="http://webapppentest.files.wordpress.com/2012/09/221.jpg?w=640" alt=""   /></a></p>
<p>The first thing that I noticed was that both the aspect and webgoat ciphers both start with u as the first character. The second thing that I noticed is that both webgoat and aspect both end in t. Next you can see that the last character of the webgoat cipher is x and x is one letter ahead of w. Also u is one character ahead of t which explains why both ciphers tart with u. The cipher pattern is a reverse of the login name and all letters are shifted up one. Now that we know this we can begin editing the cookie to change our login name to alice.</p>
<p>To do this lets first do the cipher by hand:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/231.jpg"><img class="aligncenter size-full wp-image-272" title="23" src="http://webapppentest.files.wordpress.com/2012/09/231.jpg?w=640" alt=""   /></a></p>
<p>Ok now open up Firebug and edit the cookie value so that it is 65432fdjmb</p>
<p>To do this right click on the AuthCookie value when the menu for it is expanded and click Edit:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/241.jpg"><img class="aligncenter size-full wp-image-273" title="24" src="http://webapppentest.files.wordpress.com/2012/09/241.jpg?w=640" alt=""   /></a></p>
<p>You will see a popup window called Edit Cookie. Change the value to the one we determined for user alice:</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/251.jpg"><img class="aligncenter size-full wp-image-274" title="25" src="http://webapppentest.files.wordpress.com/2012/09/251.jpg?w=640" alt=""   /></a></p>
<p>Click the OK button and refresh the page.</p>
<p><a href="http://webapppentest.files.wordpress.com/2012/09/261.jpg"><img class="aligncenter size-full wp-image-275" title="26" src="http://webapppentest.files.wordpress.com/2012/09/261.jpg?w=640" alt=""   /></a></p>
<p>Join us again next Monday for the last in the series on WebGoat.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webapppentest.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webapppentest.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webapp-pentest.com&#038;blog=24030582&#038;post=115&#038;subd=webapppentest&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webapp-pentest.com/2012/09/17/webgoat-week-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8a90c2deb892e6a4ca848bbb4bb56c3e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ma5t3rx</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/112.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/26.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/32.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/42.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/52.jpg" medium="image">
			<media:title type="html">5</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/62.jpg" medium="image">
			<media:title type="html">6</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/72.jpg" medium="image">
			<media:title type="html">7</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/82.jpg" medium="image">
			<media:title type="html">8</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/92.jpg" medium="image">
			<media:title type="html">9</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/102.jpg" medium="image">
			<media:title type="html">10</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/113.jpg" medium="image">
			<media:title type="html">11</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/122.jpg" medium="image">
			<media:title type="html">12</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/132.jpg" medium="image">
			<media:title type="html">13</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/142.jpg" medium="image">
			<media:title type="html">14</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/152.jpg" medium="image">
			<media:title type="html">15</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/162.jpg" medium="image">
			<media:title type="html">16</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/172.jpg" medium="image">
			<media:title type="html">17</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/182.jpg" medium="image">
			<media:title type="html">18</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/192.jpg" medium="image">
			<media:title type="html">19</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/202.jpg" medium="image">
			<media:title type="html">20</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/212.jpg" medium="image">
			<media:title type="html">21</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/221.jpg" medium="image">
			<media:title type="html">22</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/231.jpg" medium="image">
			<media:title type="html">23</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/241.jpg" medium="image">
			<media:title type="html">24</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/251.jpg" medium="image">
			<media:title type="html">25</media:title>
		</media:content>

		<media:content url="http://webapppentest.files.wordpress.com/2012/09/261.jpg" medium="image">
			<media:title type="html">26</media:title>
		</media:content>
	</item>
	</channel>
</rss>
