My mates site was being constantly hacked by some jamacian guys using session hijacking. At first i was stupped to how they got the passwords for the accounts they were not changing them but logging in then changing them.
So i viewed the server logs they would set an avatar that was on there server.... then as soon as a owner, admin, co-owner, moderater viewed there profile wham they were in there accounts.
The session id was in there access_logs of the cpanel or error_logs depending on if they had set the correct url for there avators. Well how did they get the password? you may ask.... Lavalair scripts uses a wml variable for the password when you login $(logpwd).
if the url of the avator enterd was like so:
http://server.com/image.gif?userpw=$(logpwd).
IF Someone viewed the profile using the wmlof lavalair the referer now contains that users password.
The souloution dont link to files from another site, but this would have not been fair on users that host there photos elsewhere and where legally hotlinking these....
So i used GD to resize the image and not directly calling the image from the page with the session id on it..... Still the session id was in the url.... Then the Eureka moment.
GD has support for redirection of images it does not require a direct image link it will follow rediects so i created a file.
thinkyourclever.php
<?php
$image = $_GET["image"];
header("Location: $imageurl");
?>
Than i used that as the image address in my image resizer.
It worked the server logs show no referer information except the ip address of the linking server.
I created another cleanref.php
<?php
$url = $_GET["url"];
header("Location: $fileurl");
?>
I added www.server.com/cleanref.php?url=url infront of all linkes that are on remote server this included bbcode images and url, vault, spam links, autolink generation.... I dont think i missed many of them.