Joel Richards

Website vulnerability scanning tips

If you view your server logs, you may occasionally notice hits to obscure pages on sites that don’t exist, for example URLs like:

/phpmyadmin/scripts/setup.php
/PSUser/ 
/login_outasp

Over a few months I have been gathering these requests for compilation of a list of common URLs that are typically used in vulnerability scanning.

These URLs are hit on an automated basis by bots looking for scripts to exploit (for example above, it’s looking for phpMyAdmin). If you run a server with any third party scripts, particularly those using PHP & ASP as these are the most common you should be aware that there are regular hits to most sites looking for exploitable scripts and should take measures to prevent this.

In most cases you won’t be aware of anything until a script is exploited, this can be prevented by blocking IPs that hit these common URLs.

I’ve made a simple PHP Class that detects if a requested page is likely originating from one of these bots. The code is available at GitHub: github.com/joelr/bottrap which also includes some sample code on how to implement this.

This includes a text file containing the list of common target URLs.

Using this data it is possible to check when a 404 error occurs if the requested page was a common target URL, if so an action can be taken.

Actions taken may include submitted the IP for inclusion in one of the many public DNSBLs or honey pot, emailing or logging for further investigation, alternatively simply blocking the IP.

If you’re using Apache this can be simply be achieved by adding lines to a .htaccess or vhost file using the deny directive.

deny from 123.45.6.7

Also to simply block bots based on the user-agent, wget seems to be used most, this can also be implemented using the mod rewrite directive. For example:

RewriteCond %{HTTP_USER_AGENT} wget [NC]
#if we just want to 403
RewriteRule .* - [F]
#Alternatively forward the requests to a file for logging if required
#RewriteRule .* log.php [NC,L]

Obviously this method isn’t foolproof as the user-agent can be spoofed easily, although in most logged cases it seems wget was shown.

Why do this?
If any domains on your server run 3rd part scripts, particularly those with known vulnerabilities such as Wordpress, phpMyAdmin & osCommerce for example it’s worth banning malicious IPs preemptively before a potential attack takes place. These IPs are also occasionally used for log poisoning and referrer spam. Although generally neither of these are an issue unless your access logs are publicly accessible, but referrer spam can fill up Google Analytics for example with irrelevant URLs which are worth removing before they get logged.

Tags: referrer, spam, apache, security, vulnerability, logs

Comments: 1

Amazing
commented on

Thanks for sharing.

Add a comment

Note: comments are moderated before publication.

Most Popular

"DO NOT EAT" THROW AWAY

Steven Wake

I have the driest draw here at Kyan towers. You see, I am the proud owner of a Silica Gel collection. There is just something about them which compels me to not throw away the little fellas.

Now residing at 171 High Street, Guildford

Peter Roome

NEW ADDRESS: Kyanmedia, Guildford, 171 High Street, Guildford, Surrey, GU1 3AJ Yes thats right, we have made the big move, a week earlier than the scheduled 24th July. The impromptu decision was made mid morning Friday (17th July, 2009) after discovering, Smithbrook was…

Cooliris and the 3D wall.

Paul Sturgess

Cooliris (formerly known as PicLens) is described by it’s developers as a “lightening fast ‘3D wall’ that lets you browse thousands of images, videos and more with ease.” Cooliris is installed as a browser add-on for Firefox, Safari or Internet Expl…