19.04.2013 Views

2KKUU7ita

2KKUU7ita

2KKUU7ita

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Countermeasures against<br />

directory traversals<br />

Chapter 14: Websites and Applications<br />

You can employ three main countermeasures against having files compromised<br />

via malicious directory traversals:<br />

✓ Don’t store old, sensitive, or otherwise nonpublic files on your web<br />

server. The only files that should be in your /htdocs or DocumentRoot<br />

folder are those that are needed for the site to function properly. These<br />

files should not contain confidential information that you don’t want the<br />

world to see.<br />

✓ Configure your robots.txt file to prevent search engines, such as<br />

Google, from crawling the more sensitive areas of your site.<br />

✓ Ensure that your web server is properly configured to allow public<br />

access to only those directories that are needed for the site to function.<br />

Minimum privileges are key here, so provide access to only the<br />

files and directories needed for the web application to perform properly.<br />

Check your web server’s documentation for instructions on controlling<br />

public access. Depending on your web server version, these access<br />

controls are set in<br />

• The httpd.conf file and the .htaccess files for Apache (See<br />

http://httpd.apache.org/docs/configuring.html for<br />

more information.)<br />

• Internet Information Services Manager for IIS<br />

The latest versions of these web servers have good directory security by<br />

default so, if possible, make sure you’re running the latest versions.<br />

Finally, consider using a search engine honeypot, such as the Google Hack<br />

Honeypot (http://ghh.sourceforge.net). A honeypot draws in malicious<br />

users so you can see how the bad guys are working against your site.<br />

Then, you can use the knowledge you gain to keep them at bay.<br />

Input-filtering attacks<br />

Websites and applications are notorious for taking practically any type of<br />

input, mistakenly assuming that it’s valid, and processing it further. Not validating<br />

input is one of the greatest mistakes that web developers can make.<br />

283

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!