<?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>The Accidental Developer &#187; security</title>
	<atom:link href="http://osric.com/chris/accidental-developer/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://osric.com/chris/accidental-developer</link>
	<description>What if Gregor Samsa awoke a computer programmer?</description>
	<lastBuildDate>Sat, 28 Jan 2012 23:13:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Injection Goes Mainstream</title>
		<link>http://osric.com/chris/accidental-developer/2011/06/sql-injection-goes-mainstream/</link>
		<comments>http://osric.com/chris/accidental-developer/2011/06/sql-injection-goes-mainstream/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 03:00:46 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[lulzsec]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[time magazine]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=399</guid>
		<description><![CDATA[Note to the web development world: even a mainstream media source like Time Magazine knows about SQL injection. Don&#8217;t you think it&#8217;s time you protected your web applications against it? Last week&#8217;s issue of Time featured an article that focused on LulzSec&#8216;s activities. In Hack Attack, author Bill Saporito went a step beyond most journalists [...]]]></description>
			<content:encoded><![CDATA[<p>Note to the web development world: even a mainstream media source like Time Magazine knows about SQL injection. Don&#8217;t you think it&#8217;s time you protected your web applications against it?</p>
<p>Last week&#8217;s issue of Time featured an article that focused on <a href="http://lulzsecurity.com/">LulzSec</a>&#8216;s activities. In <a href="http://www.time.com/time/business/article/0,8599,2079423,00.html">Hack Attack</a>, author Bill Saporito went a step beyond most journalists covering web security by mentioning an actual technique: SQL injection. <img src="http://osric.com/chris/accidental-developer/wp-content/uploads/2011/06/sql-injection.png" alt="" title="SQL Injection" width="188" height="250" class="alignright size-full wp-image-401" /></p>
<p><a href="https://www.owasp.org/index.php/SQL_Injection">SQL injection</a> is a subclass of injection attacks, wherein a malicious user manipulates input so as to insert (or inject) a tag-along command into the application code. It&#8217;s #1 on OWASP&#8217;s <a href="https://www.owasp.org/index.php/Top_10_2010-Main">Top Ten Vulnerabilities for 2010</a>, in part because such vulnerabilities are:</p>
<ul>
<li>Common</li>
<li>Easy to exploit</li>
<li>Have a huge payoff (i.e. devastating impact)</li>
</ul>
<p>Because it is so common and easy-to-exploit, there are a lot of automated tools that malicious users (often by way of compromised machines) use to scan sites and test them for vulnerabilities. If a vulnerability is found, the application may be targeted for further attacks. Basically, attackers are on the lookout for low-hanging fruit in the same way that thieves look for valuables sitting in plain sight in a parked car. Don&#8217;t take the car analogy too far, though: if someone breaks into your car, there will be broken glass and your iPod will be gone. If someone exploits a SQL injection vulnerability on your site, they may have all your user data (and more), with hardly a trace: entries in your access logs and error logs, which are too-often completely ignored.</p>
<p>As the joke goes, you don&#8217;t have to outrun the bear to avoid being mauled and eaten&#8211;<em>you just have to outrun the other guy</em>. One of the best ways to make sure your web application is not targeted for further attacks is to make sure the relatively simple SQL injection scanners don&#8217;t find any vulnerabilities.</p>
<p>SQL injection is fairly simple to defend against using parameterized input, and your development language of choice should have documentation on how to do this. OWASP also offers a <a href="https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet">SQL Injection Prevention Cheat Sheet</a>. There are also automated tools to you can use to check your code for SQL injection flaws (such as <a href="http://qpscanner.riaforge.org/">QueryParam Scanner</a> for ColdFusion), or test your site for vulnerabilities&#8211;also known as penetration testing or pen testing&#8211;such as the (currently out-of-date) <a href="https://addons.mozilla.org/en-us/firefox/addon/sql-inject-me/">SQL Inject Me</a> add-on for Firefox.</p>
<p>Checking your web applications for SQL injection vulnerabilities is the first thing you should do, but it is hardly the last. Although fending off automated SQL injection attempts is definitely a good thing, there are many other categories of vulnerabilities, and a determined attacker will find them. Stay informed, and make sure you know what attackers are up to <em>before</em> you read about it in Time.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2011/06/sql-injection-goes-mainstream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I&#8217;m Not Friends with My Bank on Facebook</title>
		<link>http://osric.com/chris/accidental-developer/2011/01/do-not-friend-your-bank-on-facebook/</link>
		<comments>http://osric.com/chris/accidental-developer/2011/01/do-not-friend-your-bank-on-facebook/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 03:46:06 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[banking]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[socialmedia]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=321</guid>
		<description><![CDATA[I received a request today from my financial institution asking me to follow them on Facebook, Twitter, Flickr, and YouTube. Aside from the fact that I doubt that their updates on these various services will enrich my life, there is another very good reason not to follow them: Security. It&#8217;s easy to trace your connections [...]]]></description>
			<content:encoded><![CDATA[<p>I received a request today from my financial institution asking me to follow them on Facebook, Twitter, Flickr, and YouTube.</p>
<p>Aside from the fact that I doubt that their updates on these various services will enrich my life, there is another very good reason not to follow them:</p>
<p>Security.</p>
<p>It&#8217;s easy to trace your connections online. Most of this information, for most users, is public. If you follow Bank A, it stands to reason that you have an account at Bank A&#8211;something a malicious person would not have known before. Even if your online persona isn&#8217;t directly connected to your name, you might be surprised at how easy it is to connect the two with a Google search.</p>
<ul>
<li>Want to know 9000 people with Citibank accounts? Check <a href="http://www.facebook.com/citibank">http://www.facebook.com/citibank</a></li>
<li>Want to know 6000 people with Wells Fargo accounts? Check <a href="http://twitter.com/#!/Ask_WellsFargo/followers">http://twitter.com/#!/Ask_WellsFargo/followers</a></li>
<li>Want to know 5 people with Bank of American accounts? Check <a href="http://www.youtube.com/user/bankofamerica/">http://www.youtube.com/user/bankofamerica/</a></li>
</ul>
<p>(That last item says a lot, I think.)</p>
<p>Any bank that suggests you follow them on social media must be pretty confident of their security! Or, more likely, their marketing teams and their security teams don&#8217;t talk to each other.</p>
<p>You wouldn&#8217;t stand on a street-corner handing out cards that say, &#8220;My name is Bob Billiards and I have an account at Bank A&#8221; would you? Then don&#8217;t follow your bank on a social media site.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2011/01/do-not-friend-your-bank-on-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Security Tips</title>
		<link>http://osric.com/chris/accidental-developer/2009/09/wordpress-security-tips/</link>
		<comments>http://osric.com/chris/accidental-developer/2009/09/wordpress-security-tips/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 22:18:32 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[birmingham]]></category>
		<category><![CDATA[file permissions]]></category>
		<category><![CDATA[mod_suexec]]></category>
		<category><![CDATA[security plugins]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[wcbham09]]></category>
		<category><![CDATA[wordcamp]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=235</guid>
		<description><![CDATA[I attended the WordCamp Birmingham conference this past weekend to find out more about all things WordPress. WordPress is an open source blog engine/lightweight Content Management System (CMS) that has a huge community of users and developers, and an enormous repository of plugins to extend its functionality. One of the presentations I attended, Mitch Canter&#8216;s [...]]]></description>
			<content:encoded><![CDATA[<p>I attended the <a href="http://wordcampbirmingham.org/">WordCamp Birmingham</a> conference this past weekend to find out more about all things <a href="http://wordpress.org/">WordPress</a>. WordPress is an open source blog engine/lightweight Content Management System (CMS) that has a huge community of users and developers, and an enormous repository of plugins to extend its functionality.</p>
<p>One of the presentations I attended, <a href="http://www.studionashvegas.com/">Mitch Canter</a>&#8216;s session on WordPress Security, had 6 good tips for making your WordPress-based site more secure:<br />
<span id="more-235"></span>
<ol>
<li><strong>Updgrade WordPress</strong><br />
WordPress recently released an important security update. Making sure that you are using the most current version will ensure that you have the latest security patches. (WordPress will complain if you aren&#8217;t running the latest, greatest version, so no need to fear: you&#8217;ll know.)</li>
<li><strong>Update your plugins</strong><br />
Plugins are 3rd-party code that can have their own security flaws [a good reason, in my opinion, to do a little research before you install any old WordPress plugin you find lying around the internet]. Find out if updates are available for yours.</li>
<li><strong>Set your file permissions</strong><br />
A lot of WordPress users may not be familiar with Unix/Linux file permissions, and once they find out, they may become even more confused, as files permissions use an octal-based numeric scheme to determine who (the owner, the group, or other users) can do what (read, write, execute) with a file.</p>
<p>Depending on which user your web server runs as, your files should be set to 0775, which means you (the owner of the files) and the associated group can read, write, and execute the files, but other users can only read and execute the files. With Apache 2, you can use <a href="http://httpd.apache.org/docs/2.0/mod/mod_suexec.html">mod_suexec</a> and a SuexecUserGroup command to make the webserver run commands as a specific user and group, which means you should <em>never</em> have to make any of your files or directories world-writable.</p>
<p>["World-writable" is a misnomer here--it really means "writable by anyone who has access to the server." That means other legitimate users who may have an account on the same machine, or malicious users who have compromised someone else's account on the system.]</li>
<li><strong>Make backups</strong><br />
I was really glad this came up, because security is about much more than preventing malicious attacks. It&#8217;s about maintaining your data over time. Mitch suggested the <a href="http://wordpress.org/extend/plugins/wp-db-backup/">wp-db backup</a><br />
WordPress plugin. [Although one of the options is to have WordPress send an e-mail with the compressed data, e-mail is not a secure way to transfer data, and I would recommend against it.]</li>
<li><strong>Delete the <em>admin</em> account</strong><br />
Every WordPress install comes with a privileged account, &#8216;admin&#8217;. Automated attacks can be launched against your system attempting to login as this user with a guessed password.</p>
<p>Anyone that really wants to hack into your system can do a bit of sleuthing and probably guess your actual login name&#8211;but creating a new account with administrative privileges and changing the admin account should at least provide some protection against the most automated attacks.</li>
<li><strong>Change your WordPress database table prefix.</strong><br />
This setting is contained within the wp-config.php file, and it&#8217;s easiest to change it when you are first setting up a new WordPress install. Otherwise, you will need to change not only the config setting, but additionally all the table names in your database. This change will help protect you from automated SQL injection attacks.</li>
</ol>
<p>Some additional ideas were floated during the questions and comments portion of the session, most of which included plugins, such as:</p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wp-security-scan/">WP Security Scan</a></li>
<li><a href="http://www.seoegghead.com/software/wordpress-firewall.seo">WP Firewall</a></li>
<li><a href="http://wordpress.org/extend/plugins/stealth-login/">Stealth Login</a></li>
</ul>
<p>Other ideas included:</p>
<ul>
<li>Restricting access to the files within wp-admin to specific IP addresses (this may not work for most people, who want to update their sites from wherever they happen to be)</li>
<li>Installing a <a href="http://www.tc.umn.edu/~brams006/selfsign.html">self-signed SSL certificate</a> and requiring SSL (https instead of http) to log in. This wouldn&#8217;t be good solution if you are setting up a site for someone else, as they would get browser warnings unless they permanently accept the self-signed certificate.</li>
</ul>
<p>I will probably be posting further updates this week with my notes from the WordCamp.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2009/09/wordpress-security-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating the Referer: Not as Useless as I Thought?</title>
		<link>http://osric.com/chris/accidental-developer/2009/05/validating-the-referer/</link>
		<comments>http://osric.com/chris/accidental-developer/2009/05/validating-the-referer/#comments</comments>
		<pubDate>Thu, 07 May 2009 21:46:37 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[referer]]></category>
		<category><![CDATA[xsrf]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=167</guid>
		<description><![CDATA[I used to validate the HTTP referer header to verify that users were accessing certain pages from certain other pages. For example, users accessing sampleapp/edit.cfm should be getting there from sampleapp/index.cfm. Anyone accessing sampleapp/edit.cfm without coming from sampleapp/index.cfm was probably monkeying around and should be send back to the index page, or possibly even logged [...]]]></description>
			<content:encoded><![CDATA[<p>I used to validate the HTTP referer header to verify that users were accessing certain pages from certain other pages. For example, users accessing <code>sampleapp/edit.cfm</code> should be getting there from <code>sampleapp/index.cfm</code>. Anyone accessing <code>sampleapp/edit.cfm</code> without coming from <code>sampleapp/index.cfm</code> was probably monkeying around and should be send back to the index page, or possibly even logged out.</p>
<p>However, it is fairly trivial to modify your referer header, so anyone who wants to monkey around with <code>sampleapp/edit.cfm</code> can make it look like they are coming from <code>sampleapp/index.cfm</code>. (If you&#8217;re interested in modifying your HTTP headers, I suggest checking out the <a href="https://addons.mozilla.org/en-US/firefox/addon/966">Tamper Data</a> Firefox plugin.) The check provides absolutely no assurance that the user is really coming from the page. Therefore, I decided the check was useless.</p>
<p>I&#8217;ve been attending a weekly web application security study group with some of my colleagues for the past several weeks, where we&#8217;ve been reading and discussing <a href="http://portswigger.net/wahh/">The Web Application Hacker&#8217;s Handbook</a>. The past couple sessions have been about cross-site scripting (XSS). <a href="http://www.madirish.net/">Justin Klein Keane</a> brought up a good point at today&#8217;s session: checking the referer may not keep a malicious user from altering his or her referer string, but could help identify victims of XSS attacks who were possibly directed to submit malicious data from a third-party site.</p>
<p>Checking the referer isn&#8217;t a sufficient protection against malicious users, by any means, but it could still be helpful. What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2009/05/validating-the-referer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Encrypted versus hashed passwords</title>
		<link>http://osric.com/chris/accidental-developer/2009/01/encrypted-versus-hashed-passwords/</link>
		<comments>http://osric.com/chris/accidental-developer/2009/01/encrypted-versus-hashed-passwords/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 15:57:23 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[rainbow tables]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=140</guid>
		<description><![CDATA[I&#8217;m trying to decide whether it is better to store passwords in a database as key-encrypted strings, or as the result of a hash function (with salt). An encrypted string is secure as long as the key is secure, which it seems to me is both its strength and its Achilles&#8217; heel. Since the application [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to decide whether it is better to store passwords in a database as key-encrypted strings, or as the result of a hash function (with salt).</p>
<p><img src="http://osric.com/chris/accidental-developer/wp-content/uploads/2009/01/padlock.png" alt="Padlock" title="padlock" width="150" height="165" class="size-full wp-image-141" align="left" /></p>
<p>An encrypted string is secure as long as the key is secure, which it seems to me is both its strength and its Achilles&#8217; heel. Since the application that accesses the database needs to use the key, that means that if both the database and the application server are compromised, the data is compromised.</p>
<p>It also means that if the application developers have access to the database, or if the DBAs have access to the application code, the data is available to those individuals. Even though those users are most likely trustworthy, it is perhaps an unnecessary risk&#8211;not to mention their workstations may be compromised. On top of that, you need to worry about key escrow&#8211;if you lose the key, you no longer have access to your own data.</p>
<p>A hashed value is secure even if the database and the application are compromised, as it is the result of a one-way function. The value is also inaccessible to either the application developers or the DBAs, which provides an additional layer of security. On the other hand, since it uses a well-known hash function, such as MD5, creating a <a href="http://gdataonline.com/">dictionary file of hashed values</a> is trivial, and apparently an even more effective method to reveal hashed data is to use a <a href="http://en.wikipedia.org/wiki/Rainbow_table">rainbow table</a> (the description of which goes a bit over my head right now).</p>
<p>That&#8217;s where the salt comes in: concatenate the original value along with extra data before creating the hash. I can see how this would foil a simple dictionary of hashed values. From what I&#8217;ve read, the salt value can be unique for each hashed value, and can be stored alongside the hashed value in the database. I&#8217;m not sure I entirely understand how that defends against rainbow tables, but it sounds good to me.</p>
<p>Using a hashed value, you can&#8217;t retrieve the original data&#8211;you can only match against it. This would not work well for data that you need to access again in its original form, e.g. phone numbers. This is a drawback in some cases, but probably not for passwords.</p>
<p>Right now I&#8217;m leaning towards salted hash over encryption, but maybe that&#8217;s because I&#8217;m hungry and it sounds more like breakfast. I&#8217;d love to know what other people think.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2009/01/encrypted-versus-hashed-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

