1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Make a jpeg or gif run php or javascript

Discussion in 'Black Hat SEO' started by frenchsquared, Apr 30, 2013.

  1. frenchsquared

    frenchsquared Registered Member

    Joined:
    Jun 21, 2010
    Messages:
    51
    Likes Received:
    4
    Has anyone heard of a way to get a jpeg to run a line of php or javascript.
    I don't want to hack a server. I need a way to have an image set a cookie.
    I just want a way to verify if a user loaded my image.

    Clearly the image isnt hosted on my server or this would be easy.

    I need the image to actually run some other code from a different domain
    to set the cookie.

    Think re-targeting advertising... not hacking...

    I have googled this, for weeks. I don't want to exploit getimagesize();
     
  2. divok

    divok Senior Member

    Joined:
    Jul 21, 2010
    Messages:
    1,015
    Likes Received:
    634
    Location:
    http://twitter.com/divok
    i think you could use JavaScript to kick in when a image finally loads and then set cookie using javascript .
    Edit :
    my bad i didnt rad the JS part .
    I think that's not possible , jpeg is just a format
     
  3. frenchsquared

    frenchsquared Registered Member

    Joined:
    Jun 21, 2010
    Messages:
    51
    Likes Received:
    4
    it is super easy if you have access to the server the image will be on, or if you could us a php image
    neither of these are an option. I have to upload the image to one of the larger advertising networks.
    they distribute the image to there networks. So I have no idea where the images would end up.

    But... If I could set a cookie... I could do lots of re-targeting advertising.

    Basically, I need a hack that can add a virus to an image. Only this isn't a real virus
    since it does not replicate or do any damage.
     
  4. Ricky Roma

    Ricky Roma Regular Member

    Joined:
    Sep 23, 2011
    Messages:
    289
    Likes Received:
    392
    You want to upload pic to fb and cs all visitors of your fan page. Am I right?
    It cant be done.
     
  5. hellnation

    hellnation Regular Member

    Joined:
    Feb 15, 2013
    Messages:
    278
    Likes Received:
    62
    Occupation:
    Senior Network and System Engineer
    Location:
    Quebec, Canada
    you would need to find a massive exploit in a browser / or a major flaw in an image standard.

    this stuff is so widely used and scrutinized, its a very hard thing to do.

    you won't find a wordpress plugin for that =)
     
  6. kvhnuke

    kvhnuke Junior Member

    Joined:
    Jan 31, 2010
    Messages:
    117
    Likes Received:
    36
    <?php
    $imgPng = imageCreateFromPng($strImagePath);
    imageAlphaBlending($imgPng, true);
    imageSaveAlpha($imgPng, true);


    /* Output image to browser */
    header("Content-type: image/png");
    setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
    imagePng($imgPng);
    ?>


    This will output a png while setting the cookie just call the php script on your html like following
    <img src="link/to/your/phpfile.php"/>
     
  7. hellnation

    hellnation Regular Member

    Joined:
    Feb 15, 2013
    Messages:
    278
    Likes Received:
    62
    Occupation:
    Senior Network and System Engineer
    Location:
    Quebec, Canada
    if you are serious about this type of stuff, follow security mailing lists, everyday there are 0 days exploits/bugs reported that can be used toward your purpose.

    but you need to know your stuff, and this stuff tend to get patched pretty quickly, the window of opportunity is small.