Badger Blog Alliance

Sic Semper Tyrannis

Monday, April 10, 2006

The Perils of Hotlinking.

Hehehehe,

Early Sunday morning I poured through the web access logs of one of the websites I run. I noticed a peculiar pattern of accesses. Typically a given IP address will request many different files (each image on a page is a new connection, so a web access log will have one entry per image in a page. I am talking Apache here, I wouldn't be surprised if MS's IIS does it completely differently), but whenever a certain referring host came up there would be only one access.

The referring page was a MySpace page and I eventually tracked down that page. Some fellow commenting on user X's page hotlinked an image off of my website Aleph (hehehe, I plumb run out of Greek letters and have to resort to the Hebrew alphabet). I copied the image to a new file and replaced all occurrences of that image in the various files I have to that new name, then I created a very timely advertisement for the concerned website to replace the old image file.

Hehehehe, so what was once the flag of another nation is now an advertisement. Of course, it could have been pr0n or something else quite inappropriate.

A quick lesson on hotlinking, not so you can do it, but so you know how to avoid it and deal with it. In my case an image was hotlinked the code in the offending page looked like <a href="http://www.aleph.com/"><img src="http://www.aleph.com/images/jollyrogers.jpg"></a> (at least he anchored to my website). What this does is to use my resource in a manner that is not apparent to the client, that is to say the person viewing the webpage does not know the resource they are looking at comes from my site. This costs me bandwidth and potentially website visitors. It is also dangerous to the hotlinker as they have no control over what that resource ultimately is and a mischievous webmaster will do something like I just did (a malicious one will obviously do worse).

What I did was to copy jollyrogers.jpg to jollyrogers2.jpg (of course I had to grep & sed through all of my files to replace all references to jollyrogers.jpg with jollyrogers2.jpg) and create a new jollyrogers.jpg with an advertisement built into it.

Get an account with one of the many image servers or host images off of your ISP webspace instead of hotlinking.

OH WHAT FUN! Hehehe, I have other exploits of daring do on the web, but I must keep those quiet!