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

<channel>
	<title>ITSec Packets &#187; Web App Security</title>
	<atom:link href="http://www.itsecpackets.com/blog/category/web-application-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itsecpackets.com/blog</link>
	<description>A Progammer explores the IT Security field; offering packets of useful information he picks up along the way.</description>
	<lastBuildDate>Wed, 09 Sep 2009 15:31:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Clickjacking</title>
		<link>http://www.itsecpackets.com/blog/2008/12/30/clickjacking/</link>
		<comments>http://www.itsecpackets.com/blog/2008/12/30/clickjacking/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 04:10:51 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[Internet security]]></category>
		<category><![CDATA[Web App Security]]></category>

		<guid isPermaLink="false">http://itsecpackets.com/blog/?p=68</guid>
		<description><![CDATA[It&#8217;s been a while since I last posted, I do apologize; things have been heck-tick.  I hope to make it up to you with a post on a new web vulnerability called ClickJacking.  There has been a lot of buzz in  the security community around Clickjacking ever since Robert Hanson and Jeremiah Grossman decided to cancel their talk on a new exploit they [...]]]></description>
			<content:encoded><![CDATA[<div>It&#8217;s been a while since I last posted, I do apologize; things have been heck-tick.  I hope to make it up to you with a post on a new web vulnerability called ClickJacking.  There has been a lot of buzz in  the security community around Clickjacking ever since Robert Hanson and Jeremiah Grossman decided to cancel their talk on a new exploit they were going to introduce  at the OWASP conference which I attended back in September.  Adobe got wind of their talk and asked them to postpone &#8220;airing the issues&#8221; to give them time to put a fix out to their users.  Turns out that it&#8217;s really a browser flaw and not Adobe&#8217;s problem, though, we&#8217;ll get into that.</p>
<p>So what is Clickjacking?   Clickjacking is an interesting exploit since it is not a bug or defect in the browser software, but rather,  a design flaw which will get clearer as we go on. Clickjacking, as it&#8217;s name alludes to, is about getting a user to click on something they didn&#8217;t intend to click on and are not even aware they are clicking on it.  This is accomplished by loading a web page that has a hidden page or multiple pages behind the web page you are actually seeing.  The way this is done is by placing a &#8220;click here&#8221; button that looks perfectly fine but &#8220;underneath&#8221; the button is where a malicious site would place something that might be harmful.  There is a great demo <a href="http://www.planb-security.net/notclickjacking/iframetrick.html#really">here</a> on the topic of clickjacking where you can see the  hidden page behind the one with the buttons that say &#8220;click here&#8221;.  They say a picture is worth a thousand words &#8211; it&#8217;s one thing for me to explain it and another to actually see the hidden page appear.   </p>
<p>One of Robert and Jeremiah&#8217;s  examples to demonstrate Clickjacking used Adobe Flash player.  They showed how easy it was to have a user click on something benign that turned on your computers&#8217; video camera (if you had one).  It is a real scary thing for a malicious site to be able to turn on your video camera without your knowledge!  Robert and Jeremiah postponed their talk and Adobe has since taken responsibility and fixed the Clickjacking issue only when Flash-player is the avenue of a Clickjacking attack.  Clickjacking is an issue for all browsers with or without Javascript enabled, since Clickjacking can be accomplished with CSS and DHTML alone.  This exploit, however,  must be viewed within the larger picture.  It isn&#8217;t a flaw or a browser software bug but, rather, a complex vulnerability that became real due to the way we&#8217;ve evolved with the Internet.   Our browsers have become  more and more complex, which creates an environment where sophisticated exploits can breed and grow and become a reality.  It turns out that the concept behind this exploit was documented as far back as 2002.  However, back in 2002 the internet was a much simpler place and the idea of clickjacking wasn&#8217;t much of a threat.  We live in a much different 2.0 Internet world now. </p>
</div>
<div>Firefox users that have the &#8220;NoScript&#8221; plugin can go out and get an update that will protect them from Clickjacking.  The users on all other browsers will need to wait.  In the meantime, as usual, please be careful where you go out on the net.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/12/30/clickjacking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get your kicks with PCI 6.6</title>
		<link>http://www.itsecpackets.com/blog/2008/10/29/get-your-kicks-with-pci-66/</link>
		<comments>http://www.itsecpackets.com/blog/2008/10/29/get-your-kicks-with-pci-66/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 12:19:40 +0000</pubDate>
		<dc:creator>brothke</dc:creator>
				<category><![CDATA[Web App Security]]></category>
		<category><![CDATA[PCI 6.6 Rothke security]]></category>

		<guid isPermaLink="false">http://itsecpackets.com/blog/?p=66</guid>
		<description><![CDATA[Get Your Kicks on Route 66 was a popular song and rhythm and blues standard from the 1940’s. For those in the application security space, their idea of kicks on 66 may be found in the PCI DSS requirement for code reviews and application firewalls, specifically DSS requirement 6.6. PCI 6.6 is significant in that [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="justify;"><!--[if gte mso 9]&amp;gt;  Normal 0     false false false  EN-US X-NONE X-NONE              MicrosoftInternetExplorer4              &amp;lt;![endif]--><!--[if gte mso 9]&amp;gt;                                                                                                                                            &amp;lt;![endif]--><em><span style="115%;">Get Your Kicks on Route 66</span></em><span style="115%;"> was a popular song and rhythm and blues standard from the 1940’s.<span> </span>For those in the application security space, their idea of kicks on 66 may be found in the </span><a href="https://www.pcisecuritystandards.org/"><span style="115%;">PCI DSS</span></a><span style="115%;"> requirement for code reviews and application firewalls, specifically </span><a href="https://www.pcisecuritystandards.org/pdfs/infosupp_6_6_applicationfirewalls_codereviews.pdf"><span style="115%;">DSS requirement 6.6.</span></a><span style="115%;"><span> </span>PCI 6.6 is significant in that it, combined with </span><a href="http://www.owasp.org/index.php/Main_Page"><span style="115%;">OWASP</span></a><span style="115%;"> may be the biggest forces to advance application security in recent memory.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">Application security is a big deal and that is why it is at the heart of the </span><a href="https://www.pcisecuritystandards.org/"><span style="115%;">Payment Card Industry (PCI)</span></a><span style="115%;"> security standards and requirements.<span> </span></span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">Requirement 6.6 became mandatory in June and requires the validated security of web-based applications.<span> </span>Requirement 6.6 requires organizations that process credit card transactions to address the security of web applications, either via manual or automated source code reviews or vulnerability scans, or via the installation of a web application firewall between a client and application.<span> </span><span> </span>In the US alone, there are a huge amount of merchants that not must deal with application security, something many of them have never thought of until PCI made them wake up from their slumber.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">There is a plethora of information available on the web regarding 6.6, so it is not necessary to fully repeat that here.<span> </span>But in a nutshell, the application code review requirement mandates organizations to meet this requirement 6.6 via an application code review or automated vulnerability scanning tool to identify application security issues.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">The requirement to have a web application firewalls in front of web applications are to ensure that attacks can be blocked before credit card data is compromised.<span> </span>A web application firewall can also mitigate the risk of an insure application, in that it can detect and block attacks before an attack can occur.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">Its been known for decades that the basis of nearly every software vulnerability is insecure or poorly written code.<span> </span>Yet for decades, application security has been ignored.<span> </span>PCI 6.6 is the long-awaited wake-up call for application security. Go get your kicks.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;"> </span></p>
<p class="MsoNormal" style="justify;"><span style="115%;"> </span></p>
<p class="MsoNormal" style="justify;"><span style="115%;">Ben Rothke is a security consultant and author of </span><a href="http://www.amazon.com/dp/0072262826?tag=benrothkswebp-20&amp;camp=14573&amp;creative=327641&amp;linkCode=as1&amp;creativeASIN=0072262826&amp;adid=1J568GC6NDN92JTGVDP3&amp;"><span style="115%;">Computer Security: 20 Things Every Employee Should Know</span></a><span style="115%;">.</span></p>
<p class="MsoNormal" style="justify;"><span style="115%;"> </span></p>
<p class="MsoNormal">
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/10/29/get-your-kicks-with-pci-66/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OWASP 2008 and Fortify</title>
		<link>http://www.itsecpackets.com/blog/2008/10/06/owasp-2008-and-fortify/</link>
		<comments>http://www.itsecpackets.com/blog/2008/10/06/owasp-2008-and-fortify/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 13:26:17 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[On the Job]]></category>
		<category><![CDATA[Web App Security]]></category>

		<guid isPermaLink="false">http://itsecpackets.com/blog/?p=59</guid>
		<description><![CDATA[I was fortunate to attend this year&#8217;s OWASP  Web Application Security conference in New York city.   It was a fantastic experience where  I networked with some really interesting and nice people, participated in intriguing talks about application security and was introduced to some security vendors who captured my attention.  I chatted with Jeremiah Grossman from [...]]]></description>
			<content:encoded><![CDATA[<p>I was fortunate to attend this year&#8217;s OWASP  Web Application Security <a href="http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference" target="_blank">conference</a> in New York city.   It was a fantastic experience where  I networked with some really interesting and nice people, participated in intriguing talks about application security and was introduced to some security vendors who captured my attention.  I chatted with Jeremiah Grossman from Whitehat security.  Jeremiah has contributed greatly to the world of web application security and is well known in the community.  You can visit his blog <a href="http://jeremiahgrossman.blogspot.com/" target="_blank">here</a>.  <a href="http://www.owasp.org/index.php/Main_Page" target="_blank">OWASP</a>, which stands for Open Web Application Security Projects, is an outstanding organization whose mission is to educate organizations and individuals around the world about Web application security through various means including articles, methodologies and tools.  OWASP set an industry standard with their <a href="http://www.owasp.org/index.php/OWASP_Top_Ten_Project" target="_blank">OWASP Top 10</a> Web application security vulnerabilities.  In a previous post I talked about <a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project" target="_blank">WebGoat </a>which is created and maintained by OWASP.   In that post I discussed <a href="http://itsecpackets.com/blog/2008/07/13/webgoat/" target="_blank">SQL injection</a>, which is one the of the OWASP top ten &#8220;vulns&#8221; (vulnerabilities).</p>
<p><a href="http://www.fortify.com/" target="_blank">Fortify</a> was one of the vendors I met.  I had a nice talk with Erik about Fortify and the solutions they offer companies.  As it turns out, unbeknown to me, my company has an enterprise site license from Fortify.  The suite of products is called <a href="http://www.fortify.com/products/" target="_blank">Fortify 360</a> and one of the features allows organizations to conduct static analysis of an application’s source code.  Later in the conference I met someone from my organization who also mentioned that we have a site license and told me how to go about getting the Fortify source code analyzer installed on my machine at work.  He also gave me a demo of the product.  I really appreciate his involvement in assisting me with Fortify.  Getting my security fix at work is a big milestone for me.</p>
<p>I wanted to share my initial experience with Fortify&#8217;s audit workbench (code scanning product).  My first code scan using this product was WebGoat application.  What better way to prove that a code analyzer is up to snuff than to use it on a web application replete with known vulnerabilities.  It turns out WebGoat is a demo application included with the Fortify product.  I pointed the Audit Workbench to the directory where the WebGoat source code resided on my PC and it started it&#8217;s thing.   Below is a screen shot as the scan is taking place:</p>
<p><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_scan.jpg"><img class="aligncenter size-medium wp-image-60" title="Fortify Scanning" src="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_scan-300x199.jpg" alt="" width="300" height="199" /></a></p>
<p>Ok , here is the summary of issues that Fortify found after the scan completed.</p>
<p><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_summary.jpg"><img class="aligncenter size-medium wp-image-61" title="fortify issues summary" src="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_summary-300x240.jpg" alt="" width="300" height="240" /></a></p>
<p>Notice how the issues are broken down by Hot, Warning and Info.  The Hot issues are known vulnerabilities that are considered critical and can be exploited.  You can see the different classes in the left upper corner; Command Injection, Cross-Site Scripting etc.  We discussed SQL injection in the WebGoat application on a previous post so I thought it would be cool to show you what Fortify found for this class of vulnerablity.  I  drilled down into the SQL Injection section and whala! take a look at this!!</p>
<p><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_sql_injection.jpg"><img class="aligncenter size-medium wp-image-62" title="fortify sql injection" src="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_sql_injection-300x205.jpg" alt="" width="300" height="205" /></a></p>
<p>Remember that I wrote, &#8220;SQL injection vulnerabilities are remedied by sanitizing the user supplied input. &#8220;  Fortify found that exact problem in the code; sanitizing user  input was not occurring.  Just in case you can&#8217;t read it in the Details section,  it says, &#8220;On line 166 of Login.java, the method login_BACKUP() invokes a SQL query build using unvalidated input. This call could allow an attacker to modify the statement&#8217;s meaning or to execute  arbitrary SQL commands&#8221;.  Exactly what we demonstrated in the SQL Injection post was possible!</p>
<p>Here is another &#8220;Hot&#8221; issue that Fortify uncovered that I want to share.  Take a look at the  screen shot below:</p>
<p><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_hardcoded_config.jpg"><img class="aligncenter size-medium wp-image-65" title="fortify hardcoded config" src="http://itsecpackets.com/blog/wp-content/uploads/2008/10/fortify_hardcoded_config-300x205.jpg" alt="" width="300" height="205" /></a></p>
<p>This is more stupidity than an explicit vulnerability.  In the highlighted  line of code there is a Database connection being made and the username/password is hardcoded.   The reason why this isn&#8217;t smart is that usernames/passwords can change often and each time changed would necessitate a programming modification.   I know from experience as a Developer that where, applicable, one should always put config values like these username/passwords in config files.</p>
<p>So far, my experience with the Fortify product has been very positive.  I plan in the future to use the analyzer against my own code to ascertain the vulnerabilities in the code that I write.  As a developer, it is a challenge to meet deadlines and write securely by thinking like an attacker.  Fortify is a good tool to make this possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/10/06/owasp-2008-and-fortify/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WebGoat</title>
		<link>http://www.itsecpackets.com/blog/2008/07/13/webgoat/</link>
		<comments>http://www.itsecpackets.com/blog/2008/07/13/webgoat/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 22:49:07 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[Web App Security]]></category>

		<guid isPermaLink="false">http://itsecpackets.com/blog/?p=50</guid>
		<description><![CDATA[I came across the perfect hands on learning tool that teaches about the common web application vulnerabilities. It&#8217;s called WebGoat, an open source J2EE insecure web application created by OWASP. The purpose of WebGoat is to educate people and organizations on the various risks that are, unfortunately, plaguing our websites. What better way to learn [...]]]></description>
			<content:encoded><![CDATA[<p>I came across the perfect hands on learning tool that teaches about the common web application vulnerabilities. It&#8217;s called <a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project">WebGoat</a>, an open source J2EE insecure web application created by <a href="http://www.owasp.org/" target="_blank">OWASP</a>. The purpose of WebGoat is to educate people and organizations on the various risks that are, unfortunately, plaguing our websites. What better way to learn about website hacking than to hack an insecure website with different known exploits. WebGoat has different lessons and some hints that guide the student. It&#8217;s a great, fun way to learn web application security. You can be up and running with WebGoat in no time by downloading a zip file that contains the WebGoat code, the Java run time environment and a configured Tomcat 5.5 server. <a href="http://tomcat.apache.org/">Tomcat </a>is a free Servlet container that implements Java Servlets/Jsp specification. Tomcat also contains a Java webserver. I chose to download the war file and import it into my Java IDE, called <a href="http://www.eclipse.org/">Eclipse</a>, so I can analyze the source code. I put my Mac to the challenge; running Eclipse and Tomcat. Using the Mac turned out to be such a pleasure since everything installed and ran smoothly. After installing and configuring everything, I was able to start the Tomcat server from Eclipse and then point my Firefox browser to http://localhost:8080/WebGoat/attack and run the WebGoat application.</p>
<p><span style="text-decoration: underline;"><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-5.png"></a><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-7.png"><img class="aligncenter size-medium wp-image-52" title="picture-7" src="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-7-300x177.png" alt="Eclipse running WebGoat" width="300" height="177" /></a><br />
</span></p>
<p>Databases are typically used as the back end to web applications. SQL is a query language that is used to interact with the database. SQL Injection is a common web application &#8220;vulnerability&#8221; that allows an attacker to send data to the back end database. This &#8220;string&#8221; is then inserted into an SQL query within the application code and executed in the database. If an SQL injection vulnerability exists, then the application may be severely compromised. In some cases an SQL Injection flaw may even allow an attacker to bypass authentication schemes.  In the below WebGoat lesson the student, acting as the attacker, needs to craft some &#8220;string&#8221; that, when submitted as the “password”, allows access.</p>
<p><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-6.png"><img class="aligncenter size-medium wp-image-53" title="Logon screen" src="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-6-300x256.png" alt="" width="300" height="256" /></a></p>
<p> In order to proceed with the hack we will need to alter the HTML or submit the form and intercept the request in order to modify the password field. We can alter the HTML file locally on our computer and then modify the HTML code. We will change the password field to type=&#8217;text&#8217; in order for us to see what we type. We will also change the size of the input field (currently it&#8217;s only allows 8 characters). A quicker way I found to do this was to use an awesome &#8220;Plugin&#8221; to Firefox called <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug </a>that allowed me to modify the HTML on the fly. The other way to proceed with the hack would be to use a tool called WebScarab to manipulate the data passed back to the server. Notice in the screen shot below that you can now see what I typed in the password field instead of asterisks. Also, my password field now allows 30 characters. </p>
<div><a href="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-5.png"><img class="aligncenter size-medium wp-image-51" title="WebGoat with firebug plugin" src="http://itsecpackets.com/blog/wp-content/uploads/2008/07/picture-5-300x192.png" alt="" width="300" height="192" /></a></div>
<p> </p>
<p>Here is the altered HTML in case you can&#8217;t see it :</p>
<p><span id="jk0c23"><span><span><span style="font-family: Tahoma;">&lt;input type=&#8221;</span></span></span><span><span style="font-family: Tahoma;">text</span></span></span><span id="jk0c25"><span><span><span style="font-family: Tahoma;">&#8221; maxlength=&#8221;</span></span></span><span><span style="font-family: Tahoma;">30</span></span></span><span id="jk0c27"><span><span><span style="font-family: Tahoma;">&#8221; size=&#8221;</span></span></span><span><span style="font-family: Tahoma;">30</span></span></span><span id="jk0c29"><span><span><span style="font-family: Tahoma;">&#8221; name=&#8221;password&#8221;/&gt;.</span></span></span></span></p>
<p>Why did the &#8220;password&#8221; I used admin or &#8216;1&#8242;=&#8217;1 allow me to logon and bypass the authentication? We need a little background first on basic authentication for websites. The “password” supplied by the user needs to be verified that. indeed, it is the correct password for this user and whoever is logging on is who they say they are. This is done by querying the database and passing the supplied “password” as a parameter to the query. Here is a simple SQL statement that might be constructed in a web application:</p>
<p>SELECT * FROM user_data WHERE password = &#8216;?&#8217; and username=&#8217;admin&#8217;</p>
<p>If the query returns the record from the user_data table then we have a match on the user&#8217;s supplied password. If there is no match, then the authentication should fail and a message should be sent back to the user as &#8220;Login Failed&#8221;.</p>
<p>Now let&#8217;s substitute the “password” I supplied into the query:</p>
<p>SELECT * FROM user_data WHERE password = &#8216;admin&#8217; or &#8216;1&#8242;=&#8217;1&#8242; and username=&#8217;admin&#8217;</p>
<p>The or &#8216;1&#8242; = &#8216;1&#8242; makes the entire query true, which returns the user admin record and bypasses the logon scheme. With this crafty string we have successfully exploited the SQL injection vulnerability. SQL injection vulnerabilities are remedied by sanitizing the user supplied input. In the above example, if the server side code had some kind of logic to reject the single quote, our method of attack would have been foiled. In fact, there should be a series of validations for the characters that are white-listed versus those that are not allowed and in this way, an invalid character would be stripped out. The fundamental concept here is that only server side code can thwart attacks such as the SQL injection since, as we demonstrated, the client side code can be easily modified. That’s why it is essential that all input validation is performed on the server side. With some knowledge of these types of attacks and diligence at the development phase, SQL injection vulnerabilities can be avoided.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/07/13/webgoat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Yubikey implementation</title>
		<link>http://www.itsecpackets.com/blog/2008/06/01/my-yubikey-implementation/</link>
		<comments>http://www.itsecpackets.com/blog/2008/06/01/my-yubikey-implementation/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 12:47:29 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Web App Security]]></category>

		<guid isPermaLink="false">http://www.itsecpackets.com/blog/2008/06/01/my-yubikey-implementation/</guid>
		<description><![CDATA[Today we&#8217;re going to continue our discussion on the Yubikey from Yubico. I received mine in the mail a few weeks ago and had the opportunity to play around with the device a bit. Many people were attracted to the Yubikey because of it&#8217;s cool, tiny keyboard &#8211; so they ordered them. When it arrived [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;re going to continue our discussion on the <a href="http://itsecpackets.com/blog/2008/05/02/rsa-2008-and-yubikey/" target="_self">Yubikey </a>from <a href="http://www.yubico.com/home/index/" target="_blank">Yubico</a>. I received mine in the mail a few weeks ago and had the opportunity to play around with the device a bit. Many people were attracted to the Yubikey because of it&#8217;s cool, tiny keyboard &#8211; so they ordered them. When it arrived they plugged it into their computers and touched the green surface which then spits out a 44 character encrypted one time password. That&#8217;s all nice and very cool but now what? How can this very innovative security token that is a tiny USB keyboard be put to good use? I, therefore, devised a way to prove that this cool token can really deliver. My plan was to customize this blog&#8217;s &#8220;admin logon&#8221; and incorporate the Yubikey authentication as an added layer of security.</p>
<p>Good news, Yubikey authentication is open source! This means that developers are able write code both on the client side as well as the server side to leverage the Yubikey in their own environments. There are not too many options for do-it-yourself hardware authentication solutions! Yubico offers sample <a href="http://www.yubico.com/developers/intro/" target="_blank">code</a> in a variety of languages that can help you get going. You can also authenticate against Yubico&#8217;s authentication server, hosted by them. This would come in handy for companies that plan on implementing their own server authentication, however, are not there yet and would like to test their client side code. In my case I decided to authenticate against Yubico, since it&#8217;s simpler and quicker. There is a downside to this approach that is worth mentioning. If I wanted to log onto my blog&#8217;s &#8220;admin panel&#8221; and for some reason the Yubico authentication server was down, I would be locked out of my blog&#8217;s admin panel.</p>
<p>This blog uses <a href="http://wordpress.org/" target="_blank">Wordpress</a>, the popular open source PHP blogging software. Modifying the admin logic to include the Yubikey as a 2nd level of authentication was very easy. I utilized the code written for PHP. First, I dropped in the Yubico class on my server. I then added in some code to the wp-login.php file.</p>
<p>Here is the function that calls the Auth_Yubico class:</p>
<p>function verifyYubikey ($token) {<br />
global $error;</p>
<p>$yubi = &amp;new Auth_Yubico(&#8217;77&#8242;,&#8217;5dFRPaFvjBvwiiB023ZWu4Qb++U&#8217;);<br />
$auth = $yubi-&gt;verify($token);<br />
if (PEAR::isError($auth)) {<br />
$yub_error = $auth-&gt;getMessage();<br />
$error = __(&#8217;&lt;strong&gt;ERROR&lt;/strong&gt;: &#8216;. $yub_error);<br />
return false;<br />
} else {<br />
return true;<br />
}</p>
<p>}</p>
<p>Here is where I modified the logic for logging on in the wp-login.php file.</p>
<p>if (verifyYubikey($user_yub) &amp;&amp; wp_login($user_login, $user_pass, $using_cookie)) {</p>
<p>I verify the yubikey string prior to verifying my static password so people can try it out by putting in a password and see what errors are returned back from Yubico’s authentication server; more on that shortly&#8230;</p>
<p>So, how does the Yubikey work? We talked about <a href="http://itsecpackets.com/blog/2007/09/12/the-beauty-of-asymetric-key-encryption/">asymmetric encryption</a> in a prior post. Each Yubikey contains a unique private key that encrypts some data, turning it into the encrypted OTP (One Time Password). The Yubikey uses a conversion scheme to ASCII, which they call mod-hex. The 44 character blob is made up of 12 characters plus the 32 character OTP. The first 12 characters never change; they are your Yubikey&#8217;s unique id. So you have the 48 bits plus an AES encrypted 128 bits sent over to the authentication provider (in my case, the Yubico server). Yubico then does a lookup with my unique 12 characters and pulls the &#8220;public&#8221; key to do the decryption. Now, if the authentication side is able to decrypt this blog then you are successfully authenticated. After decryption you have 128 bits of cipher text. Besides containing your unique id, the cipher text also contains some additional useful information about how your Yubikey has just been used. For example, the time-stamp of when the OTP was generated is included, as well as a session &#8220;use counter&#8221; showing how many times you generated an OTP. This information can be used to thwart some sneaky phishing attacks. Another thing to note is that your secret AES key in the Yubikey is never able to be read out; nothing you can do to the device can force it to give you it&#8217;s secret key. All in all, this hardware solution is extremely secure.</p>
<p>Below are two Yubikey passcodes generated from my Yubikey that I used to authenticate myself when creating this post. I highlighted the first 12 characters, my unique serial number indentifying my Yubikey. You can copy and paste the string in the Yubikey field on my <a href="http://www.itsecpackets.com/blog/wp-admin/" target="_blank">admin page</a> and then type in anything for the static password (logic for verifying Yubikey is done prior to the static password as you can see in the PHP code above).</p>
<p><strong>jdteklknnhcf</strong>fbfgjebejhbbgnrtrevingnldlctiulj<br />
<strong>jdteklknnhcf</strong>nfidtedkcelbrkvngurddrclghnidgfh</p>
<p>To make sure the responses come from Yubico, they offer you the ability to create an id with a shared key. When you authenticate, there is an extra field returned to which you can apply a signature algorithm. To apply this algorithm you use your shared key to validate that the response actually came from Yubico. In the code of the &#8220;verify method&#8221; above I included my id of 77 and the shared key that was assigned to me. I just tried changing the shared key by adding a &#8220;1&#8243; to the end of that string and wasn&#8217;t alerted that my signature algorithm failed; which it should have done. Perhaps I&#8217;m doing something incorrectly; feel free to comment. I&#8217;d like to say thank you to Simon from Yubico who was responsive to the questions I posed. Yubico also set up a <a href="http://www.yubico.com/news/080523/" target="_blank">forum </a>where you can learn more about Yubikey.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/06/01/my-yubikey-implementation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>.htaccess file</title>
		<link>http://www.itsecpackets.com/blog/2008/04/06/htaccess-file/</link>
		<comments>http://www.itsecpackets.com/blog/2008/04/06/htaccess-file/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 22:42:45 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[Web App Security]]></category>

		<guid isPermaLink="false">http://www.itsecpackets.com/blog/2008/04/06/htaccess-file/</guid>
		<description><![CDATA[I&#8217;ve been reading and learning about web application security lately.  As a programmer with experience in web redevelopment, I thought web application security would be the perfect place for me to get my security fix.  I&#8217;m finding it very interesting.  I decided that a good place to start learning was with my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading and learning about web application security lately.  As a programmer with experience in web redevelopment, I thought web application security would be the perfect place for me to get my security fix.  I&#8217;m finding it very interesting.  I decided that a good place to start learning was with my blog application; how can I better lock down this blog.  My blog uses the very popular open-source blogging solution called Wordpress.  Recently I found a <a href="http://www.mattcutts.com/blog/three-tips-to-protect-your-wordpress-installation/">posting</a> on Matt Cutt&#8217;s blog on some things you can do to secure your Wordpress blog.  Let&#8217;s discuss one his simple recommendations I implemented.The first thing I did was create a .hatches file in my &#8220;wp-admin&#8221; directory.<BR><br />
<em><strong>AuthName &#8220;Access Control&#8221;</strong></em><br />
<em><strong>AuthType Basic </strong></em><br />
<em><strong>order deny,allow deny from all</strong></em><br />
<em><strong># whitelist home IP address</strong></em><br />
<em><strong>allow from 71.172.62.228</strong></em></p>
<p>The .htaccess files are also called &#8220;distributed configuration files&#8221; which allow you to restrict access to a particular resource in a web application.  If you have access to the main configuration files (usually httd.conf) on the server it is better to make theseconfiguration changes there, since modifying the .htaccess file may cause your application to take a performance hit.  My blog is hosted in a shared environment and therefore, I don&#8217;t have access to the main configuration file.  My .htaccess file essentially blocks everyone (all IP&#8217;s) from accessing the <a href="http://www.itsecpackets.com/blog/wp-admin">www.itsecpackets.com/blog/wp-admin</a> directory unless the TCP connection is made from the IP specified, which is my home IP address.  When I access the admin page as the admin, I will still need to enter my username/password.  This solution gives me another layer of security. Now keep in mind, with security comes a loss of convenience.  I will not be able to logon to my Wordpress admin panel from work (unless I add the IP address). The same applies if I&#8217;m at a friend&#8217;s house.   There are always trade-offs when it comes to security &#8211; always.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itsecpackets.com/blog/2008/04/06/htaccess-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
