Slashdot Mirror


How to Crack a Website - XSS, Cookies, Sessions

twistedmoney45 writes "Informit.com provides an insiders look at a real life XSS attack and how it was used to bypass the authentication scheme of an online web application, leading to "shell" access, an admin account, and more. XSS attacks are often discussed in theory — this walk through illustrates just how dangerous these types of attacks can be in reality."

167 comments

  1. So... by cp.tar · · Score: 4, Funny

    ... can I crack pr0n sites with it?

    (This would have even been a frosty piss if it weren't for a Slow Down Cowboy!)

    --
    Ignore this signature. By order.
    1. Re:So... by mgblst · · Score: 5, Interesting

      Sure, depending on the site. If they let you post information to the site, like having a guest book, then you may be able to exploit a xss.

      Also depending on what you want to do to their site, if they let you upload files, but don't handle it well. ie, they may let you upload pictures of your girlfriend/sister, but they don't check to see if it is a jpeg file, or a php/cfm/asp file. Also, they may let you execute that file from that directory or not.

      Any site designed badly can be used.

      I remember some free pron sites, trying different number at the end of pictures to get extra freebies, or trying different directories based on names. Even a google image search of that particular site would reveal a lot of extra images or movies.

  2. I knew, but... by Fred+Porry · · Score: 1

    shown like this, step by step, its even more scary. I mean, why shouldnt someone do that...its really easy.

    1. Re:I knew, but... by flumps · · Score: 3, Funny

      .. Nobody can pwn me, I use IIS!!

      --
      "So there he is, risen from the dead. Like that fella, E. T." - Father Ted Crilly
    2. Re:I knew, but... by reduct101 · · Score: 2, Insightful

      It's easy to do a lot of things you shouldn't do, so it boils down to a question of ethics really, doesn't it?

    3. Re:I knew, but... by kalirion · · Score: 1

      Ethics? We're talking about technology here!!!!!

    4. Re:I knew, but... by Jchord · · Score: 0, Flamebait

      poor you...

  3. One of my old favourites... by baadger · · Score: 5, Interesting

    One of my old favourite's oopsies are upload scripts that don't prevent you from uploading PHP or other web script files.

    It's amazing how many webmasters leave little scripts in their public directories not stopping to think search engines may find them.

    1. Re:One of my old favourites... by Ana10g · · Score: 1

      Yikes. Doing the same search (here ) on the US google produces about the same result. In any case, with myself not being familiar with PHP development, what is the effect of this script? Is it a common thing that comes with a server installation? I assume it just uploads the target file to the directory, how serious is this flaw?

      --
      just an analog boy living in a digital age.
    2. Re:One of my old favourites... by Anonymous Coward · · Score: 0

      It allows you to "install" things like this..

    3. Re:One of my old favourites... by baadger · · Score: 1

      It depends how well written the upload script is.

      If you find an upload.php script and it's not password protected, or use some other method of authentication, then you can upload files and utilise that websites bandwidth. If it doesn't block uploads of *.php, *.cgi, *.pl and maybe other files, you could well end up with the ability to run whatever code you want on the webserver (at low privilege, but you can still explore the website files and work you way up, e.g. dump out script source code and look for vulnerabilities, or dump out configuration files looking for passwords).

    4. Re:One of my old favourites... by Ana10g · · Score: 1

      Okay, that's kinda what I thought, so it's a pretty common practice to name these scripts with the same name (upload.php), not a server installed piece of software. That's a little more reassuring, but not much :)

      --
      just an analog boy living in a digital age.
  4. Interesting read, but... by mdobossy · · Score: 5, Insightful

    Sure, it is an interesting read.. that being said, nothing here is exactly shocking.

    I may be reading this wrong, but, he gains access to the server by requiring a legitimate user to log on to the site, through a third party server of his (Might be done via phishing, etc..), then he nabs a valid php session id, via some injected javascript code. Why not just grab the users login and password when they submit the form through your server? If you already have them logging in via a proxy, this would be much easier, and more reliable- sessions expire, etc..

    As with most of these articles on security- simply make sure you sterilize any incoming data. Again, its not exactly rocket science.

    1. Re:Interesting read, but... by Anonymous Coward · · Score: 3, Informative

      if you already have them logging in via a proxy, this would be much easier, and more reliable- sessions expire, etc..

      RTFA. The whole A. 5 times or until you realise how dumb u are, whichever comes later

    2. Re:Interesting read, but... by mdobossy · · Score: 4, Informative

      Yes, I am a dumbass, I mis-read the first page.. (as I prefaced- I may be reading this wrong, in my original message)

      This still doesn't change the fact that what he is doing relies heavily on phishing/getting a user to go to his server first to gain initial access to the server, which, IMHO, makes this more than just a hack- it relies on social engineering/hacking/whatever you want to call it. It is just another form of playing off a user's lack of knowledge/ignorance, and letting unsterilized (sanitized, whatever you want to call it) data pass to the server. That being said, if you can get a user to fall for a "click here, come to my server to log in to your server", you can probably get a lot more out of them than just a session ID.

      As I said- it is an interesting article, but what it really boils down to is what should have been pounded into every web developers head from the start- make sure there is no way to inject melicious code into your POSTS.

    3. Re:Interesting read, but... by Anonymous Coward · · Score: 1, Interesting

      needed the xss to get the proxy going.

      but I don't think the issues with allowing update based on url, admin page accessable to all and file uploads are particulary xss and could be done by any user with a valid sessionid.

    4. Re:Interesting read, but... by Skrynesaver · · Score: 2, Interesting

      With a site offering e-mail, you could craft a message that looked like the timeout page (document.write(target=_TOP)). please login again .... Then if read via the webmail interface, the user thinks they timed out, the sender gets the login etc.. Just another thing to worry about, I'm off to check how our webmail server behaves...

      --
      "Linux is for noobs"-The new MS fud strategy
    5. Re:Interesting read, but... by skoaldipper · · Score: 1
      Yes, I am a dumbass, I mis-read the first page..
      Welcome to the club brother! We are a select few. Soon, you will find the lazy dumbass club even more invigorating and exciting than this one. Join now! We do not even read the first page, or the article!
      --
      I hope, when they die, cartoon characters have to answer for their sins.
    6. Re:Interesting read, but... by Anonymous Coward · · Score: 0

      make sure there is no way to inject melicious code into your POSTS.

      Mmm, melicious code, yum.

    7. Re:Interesting read, but... by Anonymous Coward · · Score: 0

      XSS can be used in other ways than social engineering.

      My company always had this position, XSS isn't that big of a deal, etc.

      So I went out to prove it to them that it IS a big deal. See, if you have an XSS hole that is stored in the database, then you have a bigger problem. I attached code to my account avatar which sent all cookies to me and forged the login form to transparently send the data to me before logging them in, then spread into anyone's account that was logged in and viewing the page.

      The "virus" spread pretty quickly, and in a matter of 5 hours I had over 2000 cookies, and 300 plain text passwords.

      I sent code out that cleaned everything up, and nobody was the wiser until I told them.

      Freaked the hell out of them, that's for sure :)

    8. Re:Interesting read, but... by Anonymous Coward · · Score: 0

      And you attached code to an image how?

  5. Boring... by Anonymous Coward · · Score: 1

    I suspect many slashdotters may have written CGI's that were vulnerable to XSS back in the day. Once XSS type vulns were known about, that was the end of it. If I wasn't capable of sanitizing user supplied data, I'd be shamed into finding a career other than web development. Users can disable moderate developer incompetance by disabling javascript, unfortunately higher levels of incompetance (sites that do not function without javascript) are also common.

    1. Re:Boring... by Anonymous Coward · · Score: 1, Funny

      Yup, Somebody Cracked Slashdot

      My favorite quote from said article:
      our db stores passwords in plaintext. Yes it's stupid, but I wrote this code 3 years ago and had no clue

    2. Re:Boring... by Anonymous Coward · · Score: 0

      I want to live in your world... it sounds like fun!

  6. Ok? by Jah-Wren+Ryel · · Score: 4, Informative

    So, after a quick read, it looks like the attacker has to convince a user to get to the attacked website via his own website - how else would he be able to forcefeed his own code into the $error variable to begin with?

    What are the chances that:

    1) A user will go to the bad guy's website
    2) That the user will have an account on the attacked website
    3) That said user will want to log into the attacked website right after going to the badguy website?

    Sure, it is possible and a potential risk, but it sure seems to be highly-specific, probably only good if you are targetting known users to begin with.

    --
    When information is power, privacy is freedom.
    1. Re:Ok? by PowerKe · · Score: 5, Informative

      1) A user will go to the bad guy's website
      Well, that's the hard part, but you could even try using an HTML formatted mail.

      2) That the user will have an account on the attacked website
      The place to put the code injection was on the login screen, so it's open for anyone. You could hide the login page in an invisable iframe.

      3) That said user will want to log into the attacked website right after going to the badguy website?
      The important thing is that the target logs on during the timeframe where the cookie is valid. If you're lucky and the site uses a permanent cookie, you could even take over a login session from days ago. If it's a session cookie you could take over a previous session if the user didn't close his browser after previously using the admin application.

    2. Re:Ok? by Ford+Prefect · · Score: 4, Informative
      So, after a quick read, it looks like the attacker has to convince a user to get to the attacked website via his own website - how else would he be able to forcefeed his own code into the $error variable to begin with?

      Cross-site scripting attacks are possible through many different vectors - sometimes you can include it in a GET address (e.g. 'image.php?name=foo.jpg&caption=<script goes here>'), sometimes in text submitted to the website (one I saw wasn't escaping private, inter-user messages - so I promptly sent Javascript to the administrator), or whatever.

      Essentially, if you can get the website to output your own text in an unescaped form (i.e. '>' and friends aren't converted into '&gt;' etc.), you can print raw Javascript, which the user's browser promptly executes. Javascript is quite a helpful language, so has functions for getting the values of cookies, etc. - which you can then send off to a third-party server under your control.

      I had to do a rough security audit about a year ago on a website. From knowing absolutely nothing about the specifics of cross-site-scripting and SQL injection attacks, in a couple of hours I was hijacking administrator sessions or getting the website to dump passwords, private data, you name it. It was embarrassingly easy. So, some tips for web programmers on the receiving end of all this:

      •    
      • ALWAYS escape your output, whether it's user-provided or not. Be it a simple htmlspecialchars() in PHP, or a fancy {$your_variable|escape:'html':'UTF-8'} in Smarty, or whatever your templating or programming language provides, never forget.
           
      • Be suspicious of all user-provided content. If it's a URL, make sure it's not a javascript: one - and if it's an email address or subject, make sure it's not got mail()-mangling newlines in it. You can send spam by adding extra headers that way, you know.
           
      • Make sure all your database queries are clean. If it's supposed to be an integer, enforce that it's an integer. If it's a string, make sure it's properly escaped. Regardless of where it came from. Bound queries, or whatever they're called, are very useful for this - in my own stuff, I've been doing (integer )$id, ... '".mysql_real_escape_string( $text )."' ... when creating the queries.
           
      • Read up on anything potentially hazardous, or on anything you don't quite understand. When something goes in a header, make sure it's got appropriate content - both email and HTTP headers can easily be abused through the judicious addition of newlines...


      --
      Tedious Bloggy Stuff - hooray?
    3. Re:Ok? by suffe · · Score: 1

      Typosquatting?

      --

      Karma: 2.71828182846 (Mostly due to small, fun pills)
    4. Re:Ok? by Anonymous Coward · · Score: 2, Interesting

      >
      > What are the chances that [...] a user will go to the bad guy's website?
      >

      Example:

      The attacked website features a news commenting system. You write a good comment, or a joke, and you link to a website you control (but you should say it is not your website -indirectly, don't insist...), maybe asking people their view on the link... You might make the link looks like "http://www.example.org/2006/08/Foo_article_title" . A lot of people will just click the link. The page redirects back to the attacked website, with the POST informations, but most people will just write a new comment, like "huh, it doesn't work for me"... To avoid any suspicion, you might post new comments with different nicknames, like "it works for me...", and continue with a comment on the linked "article". People will just think it is their connection, or their browser... even if multiple people have the problem, they will just think it is some kind of incompatibility... (you are being redirected from an unknown website, to the website where you just were... most people will think it is a problem on their part, because the unknown website "can't know you came from the website where you just were"...).

      Now, if the user was not logged in, you got his session ID (note you have to redirect the user to the original news you were commenting, so he does not see any error message, and so he stays on the topic of the link you provided earlier -he might want to post a comment to tell you the link does not work, and voila, if the website does not allow anonymous comments, he will just login!). If he logs on during the time the session is valid, you bypassed the authentication system (now that I think about it, another countermeasure would be for the developer to simply change the session ID during the login procedure...).

      If the user was logged in, and the website does not show a big fat "You have been logged out" message, when the user is being logged out (some websites just redirect to the home page, or to the page you just were -but then, you might use frames to hide the message), or if the website first check the email address and send the error message, before checking if the user was already logged on, you might, when the user is first visiting your link (do this for every user, most visitors will probably be logged in users... and if not, and you can hide the error message with frames, there's no problem), send POST informations to log him out, instead of trying to log him in... As the user will not understand why he was redirected back to the original page, he will most probably try it a second time... then you just detect it is his second time, and this time, send the POST informations to try to log him in (with the erroneous email address), and here you go, you have his session ID... and if the user was logged in, if most probably will try to use his account soon, so he will have to login again... (like to post comments about the link not working, at the very least...).

      Now, we were just using a commenting system... Some people don't read comments, some others are more suspicious of links in comments (but if your comment is otherwise funny/interesting, who will be suspicious?).

      What about websites which permit to post news? even checked by editors, this is no problem for your attack... you might just create a fake website, so the editor finds the link interesting/funny, and then, when the news is published, you just switch your website back to an attack machine... (people might even think the linked website was just "slashdotted", if the website has many visitors...).

      Even if the website has few visitors, I'm pretty sure it would work quite well, even with "educated" users...

    5. Re:Ok? by louisadkins · · Score: 1

      It's been years since I had an account with any pr0n type websites, but I bet they still do free trials. Would some enterprising person not be able to sign up for a "free trial" account, log themselves in to the site via their site, initiate the required process to gain access, and then cancel their legitimate account before the "free" trial ends? (Sorry if this doesn't make sense; been a long night)

    6. Re:Ok? by Anonymous Coward · · Score: 1, Interesting

      Other "tips":

      - Log the editor IP, and always send him the fake webpage, instead of the attack script... (so he won't get suspicious, and won't think about removing the link...).

      - Allow some users to view the fake webpage, so they can comment back, saying "it works for them"... (even if you do the comments yourself, people will be less suspicious if the comment is from some user they know...).

      - The third time someone visit your link (he was logged out if logged in, the first time he was visiting your link, and then you tried to log him in again, the second time), just send him your fake webpage... (no more suspicion...).

      If well planned, you will succeed...

    7. Re:Ok? by Anonymous Coward · · Score: 0

      Exactly. How pathetic this article is.

      I was walking through the park today when a homeless guy opened his coat. Instead of watches, it was an ATM machine! I figured I needed to hit that bank anyway, so this portable ATM would be so convenient.

      I swiped my card, enetered my pin, and the homeless dude passed me $100. What an amazing system.

      I have no idea why my bank account was empty. I guess some really l337 h4x0r got my info. /sigh.

    8. Re:Ok? by seek31337 · · Score: 1

      Don't forget about the fect that none of this would be possible, as an unprivelaged user, without [warning: PDF!] Session Fixation which is easily avoided by using session_regenrate_id in PHP when the user logs in. Those 'stored session IDs' would all bcome expired upon login, and contain no important information.

      Any serious PHP developer does this. Also, I wouldn't peronally choose to run or develop my software on PHP4. 5 is so much better. After having spent the past year developing PHP5, PHP4 is just... ew.

      And Smarty makes HTML escaping user input easy and fun!

      --
      No SIG for you!
    9. Re:Ok? by Anonymous Coward · · Score: 0

      Or, you know, stick to static html. Much, much harder to shoot yourself in the foot.

    10. Re:Ok? by SatanicPuppy · · Score: 1

      Yea, as far as I know, there isn't much that can be done if a valid session cookie is stolen. I have some methods that I use when I do web code that do some double checky stuff...If you're not using GET-type pages, you can do some double checking to make sure nothings changed about the session, make sure they're coming from a page that they should be coming from, based off a stored value that checks the last page that session entered. That kind of thing adds a lot of overhead though, and doesn't work well with idempotence.

      You could also try assigning client side cookies to double check against your server side cookies, but that will only work if the client isn't sending all their traffic through a compromised proxy. Forcing encryption might help (and frankly, should always be done for a login screen), but never underestimate the users ability to click-through a pop-up.

      I don't know. Good web development revolves around distrust of all incoming data; if someone uploads code and runs it on your site, you did something stupid. But there comes a point where the user has some responsibility. Man-in-the-middle is much more detectable on the user end than on the server end, and if a user does two or three dumb things to allow a session hijack, there isn't much you can do about it, serverside.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    11. Re:Ok? by Sepodati · · Score: 1

      This attack vector had nothing to do with session fixation, though. This attack simply grabs the session ID from the user right before they log in. It lets PHP set the session ID.

      Although session fixation is another attack that programmers should account for and fix within their programs.

      ---John Holmes...

    12. Re:Ok? by Sepodati · · Score: 1

      You're embarrassing. This article was about one way to exploit an XSS hole. It's not the only way. If slashdot were vulnerable within their comment system, I would not have to use another site as a part of the exploit. Many sites will take the exploit code, happily store it in the database for you and then run it for every person that views the product page, profile page, etc.

      Other similar attacks like this can use unvalidated user input to inject mail headers and data into seemingly unimportant contact forms and use that server to send out spam.

      ---John Holmes...

    13. Re:Ok? by System.exit(true) · · Score: 0

      This is not a "how to crack a website", this is a "how to create a phishing website". It is a dumb article to read. The only way it would work would be to either have root access to the server to modifiy the origional site or to create a clone of the site and get people to login to it, which if thats the case, there are far better ways to do it.

    14. Re:Ok? by sgt+scrub · · Score: 1

      A public network and ettercap are all you need. With ettercap you should have no problem watching what other people browse, getting session ID's, plain text passwords etc... When ever I travel and get bored I'll watch the hotels network. The number of people that check their mail without encryption is disgusting. And, some of the sites they visit afterwards are worse.

      --
      Having to work for a living is the root of all evil.
    15. Re:Ok? by PowerKe · · Score: 1

      With a man in the middle attack you never stand a chance unless you use SSL with verified keys. However, this cookie stealing also works by simply making your victim visit a page. A way to defend against this is verifying the source IP address. In some cases this might not work due to proxies (in case the victim and attacker pass the same proxy somewhere which doesn't relay forwarded_for information), but in most cases this will be enough though.

      For this attack, using SSL doesn't even make a difference. Whether the hidden iframe uses SSL with an injected string or plain http won't make a difference.

      As for the user visiting 'dangerous' pages: If you allow any user to insert javascript code on pages on your website there'll be lots of ways to make the attack seem innocent. I've played a few online php games that allowed players to create their own profile page with limited html code. Well, since they missed a few places to strip javascript code it was easy to put up some cookie stealing code and just send a message to the admins/moderators: "Look what a nice profile page I have". Then you just wait for the session cookie.

    16. Re:Ok? by seek31337 · · Score: 1

      It's only a slight modification, but the problem is still solved by regenerating the session ID on login. So obtaining the session ID without being able to generate an ID is occuring through a weaker mechanism (leading someone to login to his website first), but the basic solution is the same.

      --
      No SIG for you!
    17. Re:Ok? by ArtStone · · Score: 1

      Let's say the "bad guy" had a "Runscape Cheats" web site and wanted to grab cookies of the visitor's current Runescape session - which the visitor is actively playing Runescape in aother browswer window. (browsing is not necessarily a serialized sequence of events, which developers sometimes forget)

      I'm pretty sure compromising an account isn't that simple - and that Runescape probably took care of any of that type of hole a long time ago. Setting a PIN on the account that is not breakable using a keylogger surely is related to that... but I think you get the idea of how such things are possible, especially with a 13 year old boy trying to "cheat". Just remember back to the AOL days of the scipt kiddies passing around "Password Stealers" - thinking the real purpose of the program was for them to steal someone else's password - rather than the other way around.

      Crooks generally do not call up the police when they have been robbed.

      --
      Final 2006 "Proof of Global Warming" US Hurricane Count -> 0
  7. Question,,, by Anonymous Coward · · Score: 1, Interesting

    How do you know if a hacking method has become unreliable and worthless?

    When they use Buzzwords for it.

    1. Re:Question,,, by Anonymous Coward · · Score: 0
      Worthless? Yeah you're right, because XSS and uploading PHP scripts on image hosts surely is something that was solved a long time ago.

      Kneejerk dumbass...

    2. Re:Question,,, by Anonymous Coward · · Score: 0

      Stop "singing" you asswhore!!!

    3. Re:Question,,, by Anonymous Coward · · Score: 0

      But I like singing it brings me closer to ascension

    4. Re:Question,,, by Anonymous Coward · · Score: 0

      So you're a christian? I thought you're a Slashdot-attention-whore-who-forgot-to-login...

      I love being a christian... We will convert this world to our great religion!!!

    5. Re:Question,,, by Opportunist · · Score: 2, Informative

      It becomes obsolete as soon as the mainstream media pick it up. Until then, it's usually fairly useful.

      Few of the self proclaimed "admins" have a clue. Fewer know what they're doing and a selected, carefully handpicked number can actually understand what that article is about. Essentially, as long as there is no out-of-the-box fix for this issue that can be used by even the most braindead zombie out there, a hacking method retains its worth.

      If you're just looking for a bounce-off server, it's usually fairly reliable to assume that you can find a clueless victim easily. If you're targeting something specific which has presumably an admin with a Clue (capital C not a typo), anything that's been out for over a month is worthless. No matter whether it's been buzzworded or not.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    6. Re:Question,,, by Anonymous Coward · · Score: 0

      ...-forgot-to-login...

      You mean "forgot-to-log-in". You log in to a system with a login, but you don't login to a system anymore than you key into your house.

      And Christians don't believe we'll convert anyone. All we can do is point you in the right direction, but ultimately whether a transformation occurs in your heart is between you and God.

  8. Requires social engineering by cras · · Score: 4, Funny
    The most problematic part from the article:
    The end result was that I had to make a user click on a link that first took the victim to my server

    I think this is the reason why people aren't that concerned about XSS. This requires that the attacker knows someone who has access to the web site and a way to get him to click on the link. I would certainly never click on a suspicious looking link. But sure, not everyone does that and if there are other post-login holes to get yourself into an admin, that's a problem for you too.

    One thing that annoys me when discussing XSS problems and such is that people always just suggest to validate input. I've built perfectly secure PHP applications that don't validate input at all, they just don't print the output using "print" but another function that properly escapes the output. So much more easier that way than having to think about input validation for every single new field you add.

    1. Re:Requires social engineering by Corbets · · Score: 4, Informative

      I'm not sure that validating output (escaping it) will be any easier than validating the input. Really, you just need to write a function that does generic parsing of the input in the same way you have a special function that escapes it. get_safe_input($string) could be a function that reads in from the user, fixes it up, and returns the safe string. Bam, done, use that every time instead of your read_string or whatever the php function is.

    2. Re:Requires social engineering by cras · · Score: 1

      Sure that works if all you do with the string is print it out. Now what if you also want to store it into a SQL database, as is usually done? You'll have to unescape it before inserting it, or alternatively both waste more space in the database and remember to have to NOT escape data that comes from the SQL database so it won't get escaped twice (< shown as &lt;). And if you're not escaping data that comes from SQL database you better make sure that ALL the data that is stored in there is escaped. And never mind the other problems that you might have when manipulating the escaped input before printing or storing it..

      Or perhaps it's easier not to worry about the escaping problems at all that might come, and just always print data like: html_printf("Hello, %s", $_REQUEST["user"]); You can even verify that all prints are safe using a grep command that checks that no "print" commands exist and no variables are used as html_printf()'s first parameter.

    3. Re:Requires social engineering by MrHali · · Score: 1
      There's a simple and painless way to validate all form input in php with one line of code. Since they are stored as an array, just run it through a foreach loop with the htmlspecialchars function sanatizing the variables like this.. (you can also flag the ENT_NOQUOTES or the ENT_QUOTES switch to prevent against sql injection too)

      foreach ($_REQUEST as $field_key => $field_value) { $_REQUEST[$field_key] = htmlspecialchars($field_value); }

      Also, I agree that this article is a bit alarmist, but it's always a good exerise to think about application security.
    4. Re:Requires social engineering by Anonymous Coward · · Score: 0

      requires...a way to get him to click on the link</snip>

      What may people forget is that it doesn't need someone to click on a link. With an 'onMouseOver' event handler, for example, simply rolling your mouse over the page could automatically redirect you to another website. Clicking on a link is not required.

    5. Re:Requires social engineering by Sepodati · · Score: 1

      That's not validating anything. That's taking the shotgun approach by running everything through a specific function. You're now screwed when you need the plain text version of what the user supplied because it's gone. If you use a user variable in a query without quotes (since you're expecting an integer), the query is still open to SQL injection.

      ---John Holmes...

    6. Re:Requires social engineering by ccarr.com · · Score: 1
      I've built perfectly secure PHP applications that don't validate input at all, they just don't print the output using "print" but another function that properly escapes the output.

      OK, so what do you do with the input? Insert it into a database? Pass it as a parameter to a shell application? Unless you're going to just drop it on the floor, almost anything you do can be exploited.

      --
      I don't know half of you half as well as I should like, and I like less than half of you half as well as you deserve. BB
    7. Re:Requires social engineering by wralias · · Score: 1

      get_safe_input($string) could be a function that reads in from the user, fixes it up, and returns the safe string.

      Because I am forgetful and can't always remember to do something like this, I've gone as far as writing a function in a common include file that loops through $_REQUEST and sanitizes everything in it. As you probably know, $_REQUEST contains $_POST, $_GET, and $_SESSION. Then I would just use $_REQUEST for any input.

      A function like this can take care of properly sanitizing / escaping string input automatically. Even if you do something like this, though, you still need to validate input that is of a specific type (email address, file upload, zip code, etc).

      In the "serious" coding community, it seems like JavaScript and PHP suffer from the same image problem. Both languages are great once you get to know them (and both have their problems). It seems like the image problem comes mostly from the fact that both are easy to tinker with, and as such, lots of amateurs (who don't yet have experience with stuff like security) are able to hit the ground running with their first php/mysql or javascript web app.

    8. Re:Requires social engineering by Anonymous Coward · · Score: 0

      If you're not validating input, you're leaving the site wide open to SQL injection.

    9. Re:Requires social engineering by MrHali · · Score: 1

      I was just demonstrating, with one line, that it's quite simple to traverse through the array and make the user input safe, as there was a comment about having to remember all the user variables you are assigning. Whether you want to use htmlspecialchars or str_replace to do some regex, it's up to you and the options are endless. And to answer, if you want the plain text of what was suppied, you can run the variables through the html_entities_decode function. These are specifically what these functions were built for. And your second comment, right, the option ENT_QUOTES should only be used.

    10. Re:Requires social engineering by kwark · · Score: 1

      You just made clear that every "output" needs its own escaping, that is why one ALWAYS should escape "output". Validating input is a nice bonus, if possible at all.

    11. Re:Requires social engineering by Sepodati · · Score: 1
      make the user input safe

      But you only made it "safe" to display on an HTML page or within a form on an HTML page. You're right, the options are endless and it's all depends on where the data is going. If all of your data goes to an HTML page or form, sure, you just protected it. If you have DELETE FROM table WHERE id = {$id} and $id can in any way come from user input, running it through htmlentities() doesn't protect you from crap. If you're taking the form data and placing it into email headers at all, you haven't protected anything... although the spam messages would probably come out pretty worthless with everything converted to entities. Still doesn't stop the a malicious user from spamming... Sanitize/validate the data for where it's going and don't rely on a single function to do it all for you.

      ---John Holmes...

    12. Re:Requires social engineering by larry+bagina · · Score: 1

      hehe ... too true. Slashdot used to allow onmouseover in the links...

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

  9. More Like a Phishing Attack by hagrin · · Score: 4, Insightful

    As if fate wanted to make it challenging, the maximum size of the HTML input field for the email address was 25 characters, and it only accepted POST data, which is somewhat limiting. As a result, I had to "outsource" my cross-site scripting attack to a third server. The end result was that I had to make a user click on a link that first took the victim to my server.

    Sounds more like a phishing victim than anything else to me. I understand that the rest of the article brings you through the process of session hijacking, etc., but to me the real problem here is the phishing "attack" and the misuse by the user. Is a system really insecure if the user is diligent in what links he clicks on in this instance? I mean, if I leave the keys to my car in the ignition it's not going to take a skilled theif or laser cut keys to steal my car and the security implementations taken by the manufacturer won't matter.

    1. Re:More Like a Phishing Attack by Fallus+Shempus · · Score: 5, Insightful

      So you're going to rely on user's intelligence?

      You're not a coder are you.

    2. Re:More Like a Phishing Attack by hagrin · · Score: 1

      You may not want to admit it, but the answer is yes "us" coders (read, I am a full-time programmer) do rely on the users for security.

      Have you not heard the addage "a system is only secure as the person administering it"? Until systems are designed by and administered by infallible, AI capable machines, then we will always be strapped to the lowest common denominator - the user using the system.

      I can write the most secure web application known to man, purchase a digital certificate, require users to set passwords to optimal lengths and character combinations, but if they write down their username and password on a sticky attached to their monitor (I walk around the office here in the morning and see it all the time), then does that mean we have failed as programmers?

      Personally, I think not.

    3. Re:More Like a Phishing Attack by Fallus+Shempus · · Score: 1
      require users to set passwords to optimal lengths and character combinations


      Enforcing password restrictions is the best way to encourage people to write down their passwords;
      just disable profiles after a set number of attempts.

      Also 2 part authntication helps, especially when the users can be asked one of a set of 'personal' questions,
      stuff they should know and not have to right down. Then a phishing attack has a lower chance of success.
    4. Re:More Like a Phishing Attack by ultranova · · Score: 1

      I can write the most secure web application known to man, purchase a digital certificate, require users to set passwords to optimal lengths and character combinations, but if they write down their username and password on a sticky attached to their monitor (I walk around the office here in the morning and see it all the time), then does that mean we have failed as programmers?

      Yes. You created an user authentication scheme which requires the user to memorize a long, meaningless list of characters, and in the worst case change that reqularly. Humans are very bad memorizing such lists, so the users have little choice but to write them down. In other words, the security problem of sticky notes comes from your failure to implement an authentication shceme that functions properly within the user's limitations.

      Your failure is essentially similar to requiring such horribly complex and processor-intensive crypto algorithm to secure the channel that the user's machine is incapable of doing it fast enough so he has to use telnet instead. The overcomplex crypto might make the system secure in theory, but in practice it's an impediment to security.

      Learn your craft, and don't expect your users to suddenly get photographic memory, any more than you would expect an 8088 to magically get a gigabyte of memory. A bolt that's screwed too tight breaks, and security is no different: when it becomes too inconvenient, it gets broken, since getting work done takes priority. The trick is finding the maximum security you can have in practice, and not turn the screw any tighter than that.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    5. Re:More Like a Phishing Attack by DahGhostfacedFiddlah · · Score: 1

      This bothers me:

      As if fate wanted to make it challenging, the maximum size of the HTML input field...

      Someone who considers it challenging to send more than the maximum characters of an input field? And he's the one writing the article? I hope that was just flavour-text, not his true feelings about the "challenge"

  10. crack by PipoDeClown · · Score: 1

    need crack for slashdot

    1. Re:crack by zxsqkty · · Score: 1

      Yeah, but not all of it though. I often need valium for YRO, and Games is far better on acid (purple tracers, yeah!).

      --
      Caution: May contain nuts.
  11. Hijack... by webhead74 · · Score: 0

    As an administrator, if I were the BOFH, I could just create a dummy DNS zone for yahoo & force all the users on my network to sign in via my own personal sign-in page capturing all their user info in the process... or as an outside attacker, do some DNS poisioning to achieve the same result.

  12. Slow news day? by Fusen · · Score: 0, Troll

    While first of all, none of this is actually new in any way or form. I thought most of the normal /. readers would know most of this, including at least anyone who actually codes in PHP the real crux is that half of what was done, was only accomplished from a VERY poorly written site, such as not checking the user's id against the user who created the "update list". Stuff like being able to change a id variable and being able to see other users data is just basic poor php coding. Then you have the create admin page, which didn't seem to check the user's id or auth level. It's the sort of article you would expect on "hackinpr0z.com"

  13. With all due respect by rehashed · · Score: 5, Informative

    This is a perfect example of a shoddily developed website.
    Additionally, it is, in certain respects, a retarded piece of journalism.

    The XSS mentioned requires the use of phishing techniques - why not simply capture username and password and this point of the exercise, it will allow you to regain entry once the session expires, and will allow you to overcome and further validation that the session handler may require.
    The XSS technique itself, printing the value of the cookie data via javascript to perform a get request to the evil server should not occur in the first place. That is simply shoddy website development. Sanitize input, escape output. Its not more difficult than that. Any developer who fails to grasp this most basic concept should not be in that line of work.

    Secondly is the ability to transfer a session. In the example, the attacker utilizes a third party utility to modify the request data. Why he has done this is beyond me - much easier to simply edit the cookie itself, or even pass the session id back as a 'get' request, a tehnique accepted by default on many PHP installs. It is rather basic to overcome this kind of attack by utilizing a more sophisticated session handler, although this is rarely done as it is taken as a given that the attacker is not going to easily obtain a session ID.

    Thirdly, is simple abuse of a poorly designed web application. There is no validation in place to ensure that the user has permission to perform a task on a designated object. In this case, there is no validation to ensure that user 42 has permission to modify data related to user 36. This is simply poorly designed, and again would not happen where a developer has half a clue about what he is doing.

    Finally, is the mother of all attacks - the ability to upload and run abitrary code. This is a combination of two blatantly obvious (to those who are not clueless) issues that should not arise in a professional web application. Firstly, is the ability to upload files of a certain type. Apache, for example, doesnt require PHP files to be marked as executable, it will simply run anything with a .php extension (or others depending on configuration) through the PHP parser. If there is no reason for a user to be able to upload files of this type, basic sanitization should be in place to prevent the upload of these file types, or, more easily only allow files with permissable extensions to be uploaded. The second issue is related to basic site administration, unless there is need for direct access to the files, uploads should be located in a directory outside of the webroot, preventing direct access to (and possible execution of) these documents. If direct access is require, all external handlers should be disabled for that directory by the simple usage of a .htaccess file. This would mean that any uploaded scripts/executables would be treated in the same manner as a regular file, and be downloaded as opposed to 'run'.

    In short, this was a very poorly designed web application. It didnt take into consideration any secure web development practices, such as Sanitization, Validation, Authorization and Limitation.
    Unfortunately, in todays climate, every man and his dog is a web developer, and 99% of them are complete and utter idiots.

    1. Re:With all due respect by Anonymous Coward · · Score: 0
      Unfortunately, in todays climate, every man and his dog is a web developer, and 99% of them are complete and utter idiots.

      +1, even if the real figure is probably around 85% and this doesn't just apply to web development. There are a minority of talented programmers in the world, however because developement is by nature incremental even complete morons manage to produce passable code on occassion. Substandard code is not always the programmers fault, bad managers and clueless clients can hex any project, no matter how talented the development team.

    2. Re:With all due respect by Sepodati · · Score: 1
      Additionally, it is, in certain respects, a retarded piece of journalism.

      No, it's an example to those "complete and utter idiots" out there that write off XSS attacks as meaningless.

      The XSS mentioned requires the use of phishing techniques

      Sure, this one does, but many don't even require that. Many take input directly from the URL so you don't have to use a third site. The passed info in the URL can be obfuscated, too, so it's not obvious that some JavaScript is being passed. Don't say this is a retarded article just because of the method this specific attack requires.

      Secondly is the ability to transfer a session.

      Wait, you're saying this is a worthless article because of how the author decided to propogate the hijacked session? The article would have been better if the guy used GET, or what?

      Thirdly, is simple abuse of a poorly designed web application

      Duh, no shit. That's what all XSS attacks are. Who's writing the article here? In fact, the rest of your reply falls into the "no shit" category, too. You're just repeating what everyone says when vulnerabilities like this are announced. At least the article writer went through the effort of going into all of the details of a specific attack so that those who are clueless (99% by your calculations) can see exactly why this is an issue.

      ---John Holmes...

    3. Re:With all due respect by rehashed · · Score: 1

      Did you manage to misread half of the article or something?

    4. Re:With all due respect by Sepodati · · Score: 1

      Uhm... no. Do you want me to read it again? Is there something I should look for in particular?

    5. Re:With all due respect by Jerf · · Score: 1
      The XSS mentioned requires the use of phishing techniques...
      To you and everybody else who keeps thinking this somehow discredits the article:
      • The only reason he needed to "phish" was that this site had a maxlength on the relevant textbox. Other sites won't. Many sites can be directly exploited. The phishing in this case shows that maxlength is not an adequate security mechanism (duh), not that phishing is required in general to exploit sites.

        Moreover, I'm pretty sure that if he was a bit more clever, or a bit lucky, he could have skipped that too. We don't know what site he was working on, but I wouldn't be surprised that he could have written an exploit that sent out code that used Javascript to strip off the maxlength parameter, loaded in his exploit code, and then proceeded onward, all without user intervention.
      • Have you not been reading the news? Phishing works all the time! If you have a large enough site, the odds of at least one of your users falling for it approaches 100%. If you're basing your security on "not being phished", it's not even worth calling "security".
      Thirdly, is simple abuse of a poorly designed web application.
      Your average web application is poorly designed. I've found XSS in commercial apps, but they do tend to converge on security. Eventually. But even names as prestigious as Oracle have had XSS flaws.

      The problem is that all of these flaws are of a kind; if you don't escape your user's input correctly when sending it back into the user's HTML page, it's a good guess that you also send the user's values into the database unescaped, or that you'll happily run uploaded PHP content unescaped. It's really all the same error, so they tend to all show up at once. And they do, often.

      Pointing out that XSS can only be done on poorly designed sites is really a tautology. The fact is, there's a lot of them, and I hope this article will open some eyes about how serious that poor design can be.
    6. Re:With all due respect by rehashed · · Score: 1

      The only reason he needed to "phish" was that this site had a maxlength on the relevant textbox

      What on EARTH are you talking about?
      So now we are expecting users to type in the relevant Javascript to perform the XSS themselves?
      Or are we now performing XSS via XSS, which would depend entirely on guessing whether or not your target had an account, and intended to log in at said web-application before session timeout...
      Geez, get a clue!
  14. Human engineering & login code by YeeHaW_Jelte · · Score: 4, Insightful

    While the crack is technically interesting the article doesn't answer two things: first how did he get the code for the login screen and how did he get a user to login via his evilsite.com mockup of the login screen.

    Maybe he could guess that the email variable was printed unfiltered, and thus vunerable to XSS-attack, I dunno how he would get a user to login via a unrelated URL.

    --

    ---
    "The chances of a demonic possession spreading are remote -- relax."
    1. Re:Human engineering & login code by ilovegeorgebush · · Score: 1
      While the crack is technically interesting the article doesn't answer two things: first how did he get the code for the login screen and how did he get a user to login via his evilsite.com mockup of the login screen.

      Yes he does. If you had read TFA, you would have noticed the following sentance in the first paragraph!
      In this article I am going to look at a real-life XSS attack and how it was used to bypass the authentication scheme of an online web application I was asked to test.
    2. Re:Human engineering & login code by makomk · · Score: 1

      I dunno how he would get a user to login via a unrelated URL.

      Didn't have to; he used an XSS hole in the site to steal the user's session cookie. As long as the user was already logged into the victim site, all he had to do was to get them to go to his page, and voila.

    3. Re:Human engineering & login code by Sepodati · · Score: 1

      Umm...no. Go back and read the article again.

    4. Re:Human engineering & login code by Magi77 · · Score: 1

      Well, In real life hacking scenario, Hacker wouldn't have that easy privilege of getting to know the source of the login page script... It's easy to engineer hacks when u have access to the source!!!

    5. Re:Human engineering & login code by makomk · · Score: 1

      Ah yes, sorry. To be precise, he used XSS (on the login form) to steal the session cookie, then redirect the user to the real login screen. If I understand PHP sessions correctly, then if the user then goes ahead and logs in (to the *real* login screen, not a fake version of it) said cookie might then be usable to impersonate the user. If the user is already logged in to the site, this may also work without the user having to log in again, depending on the implementation of the login form.

  15. Re:JavaScript Must Be Eradicated From The Web by Anonymous Coward · · Score: 2, Insightful

    The root cause of all of these exploits is one thing: JavaScript.

    Wrong, the root cause of all these exploits is developper's stupidity, JS is merely an attack vector, as is flash, and the only way to use them as attack vectors is if there are holes in the application (ability to upload executable files or scripts, reliance on unsafe authentification/securisation schemes, ...).

  16. Re:JavaScript Must Be Eradicated From The Web by Anonymous Coward · · Score: 0

    Hear! Hear!

    Especially, I would like to emphasise this:

    > Petition web site developers not to use JavaScript, or, at minimum, to produce sites that are fully functional when JavaScript is turned off in the user's web browser.

  17. Mod Parent Out Of Sight! by rehashed · · Score: 1

    Thats one of the most retarded and uneducated posts I have read.
    The issues are not with Javascript, but with the web application itself.
    Your argument about there being some potentially unknown underlying issues could apply to HTML itself - as i said, retarded and uneducated - just scaremongering.
    Someone just mod this troll out of my sight!

  18. Looks OK to me by MichaelSmith · · Score: 1
    The issues are not with Javascript, but with the web application itself.

    Javascript is an easy way for somebody else to start software running on your computer. Unlike java it doesn't really have a security model. If you browse from within your intranet the javascript code you pick up from elsewhere can do things on your LAN. That can't be good.

    Your argument about there being some potentially unknown underlying issues could apply to HTML itself - as i said, retarded and uneducated - just scaremongering.

    HTML is a markup language. It can't do anything other than display a document.

    1. Re:Looks OK to me by starwed · · Score: 1

      HTML is a markup language. It can't do anything other than display a document. No language does anything... but the browser which renders the HTML certainly does.

    2. Re:Looks OK to me by rehashed · · Score: 1

      And PNG's are images, doesnt mean there wasnt an underlying security issue with the way IE handled them....

    3. Re:Looks OK to me by brainnolo · · Score: 1
      HTML is a markup language. It can't do anything other than display a document.

      Well, the grandparent poster was also talking about possible bugs in JavaScript interpreter which could lead to arbitrary code execution. Is well known that some any parser may contain buffer overflow bugs and the likes which could mean you can embed arbitrary code in every format, including HTML, and the most recent example being the PNG (and JPEG if i don't recall wrong) parsers. So while HTML itself cannot do anything, the parser reading it CAN.
      I believe Javascript does not allow wide access to system resources in normal operation, so there is really not much difference on this aspect.
    4. Re:Looks OK to me by mikiN · · Score: 1

      Don't forget the brain of the user reading the language. It can make him/her do the strangest of things...

      "Language is a virus..." - William S. Burroughs

      --
      The Hacker's Guide To The Kernel: Don't panic()!
  19. Re:JavaScript Must Be Eradicated From The Web by Anonymous Coward · · Score: 0
  20. Input validation by Savage-Rabbit · · Score: 1
    One thing that annoys me when discussing XSS problems and such is that people always just suggest to validate input. I've built perfectly secure PHP applications that don't validate input at all, they just don't print the output using "print" but another function that properly escapes the output. So much more easier that way than having to think about input validation for every single new field you add.


    If I hadn't seen more examples than I care to count of code written by people who felt it unnecessary to authenticate user input I would think you trolling. Input validation is not optional any more than checking people's security clearance is optional before letting them into the Pentagon archives. Input validation is something you should always do regardless of what type of software you are writing, since it helps to prevent more than just code injections like this one. You should be especially careful to verify any and all user input if you are writing applications that are exposed to the general public. A Hacker will punish you for every mistake and failing to verify that input to the login field has the structure of a valid user-name/email-addess is a pretty basic error to make, especially since there are recipe books outlining how to do this and it would surprise me if you couldn't find a utility library containing commonly use validation routines on source-forge.
    --
    Only to idiots, are orders laws.
    -- Henning von Tresckow
    1. Re:Input validation by cras · · Score: 1

      Sorry, but I don't agree. I think if you rely on user input validation you're going to have more security holes in your program than if you built it from the assumption that every single string in your code may contain whatever data. It's much easier to figure out where the few problematic areas are (typically only printing and SQL queries, maybe also writing to logs) and just make sure that those are done securely no matter what their input is. If your security comes only from validating the user input, the input may be modified in insecure ways within your application that's not so easily detectable.

      Of course once you know your program is already safe against any kind of user input, you may add input validation. But that's not to prevent security holes, only to give user (and admin) meaningful error messages and possibly guard against DoS attacks with eg. too large user inputs. I suppose input validation in your program may also help if the same input is transferred into other people's buggy programs, but that's not really your program's fault anymore..

    2. Re:Input validation by Anonymous Coward · · Score: 0

      Sorry, but I don't agree. I think if you rely on user input validation you're going to have more security holes in your program than if you built it from the assumption that every single string in your code may contain whatever data. It's much easier to figure out where the few problematic areas are (typically only printing and SQL queries, maybe also writing to logs) and just make sure that those are done securely no matter what their input is. If your security comes only from validating the user input, the input may be modified in insecure ways within your application that's not so easily detectable.

      I never said that input validation all on it's own would be an adequate defense, but not authenticating input as a matter of policy is silly. Typically one would rely upon a multi layered defense. As part of that defense, however, you would be wise to authenticate the input. I suppose one can argue about when the best time to do that is. If you have, for example, a login field you will want to: restrict length, treat the input before printing it out again, validate the input contains only legal characters and if you are really paranoid you can run some sort of a fuzzy logic validation/parsing routine on it that detects the difference between even a password written in l33t speak and JavaScript,SQL,PHP,etc... code. In the case of a login field I would say it is best to authenticate right after the use submits the form. If we are talking about uploading a file you will want to: restrict file-name length, validate name+extension and analyze the file's content to verify it is not a script or executable renamed with a harmless extension before writing anything to disk.

  21. Re:JavaScript Must Be Eradicated From The Web by mikek3332002 · · Score: 1

    Nice Satire/Troll piece. pity there isn't +1 troll

  22. Some simple fixes would be sufficient by vdboor · · Score: 5, Informative
    As short summary, what every (PHP) developer should do is:
    • limit the session to the IP-address of the visiting user.
    • use htmlentities() on all outputted HTML
    • secure file uploads to avoid uploading PHP code
    And most important (but not relevant for TFA):
    • use mysql_real_escape_string() on all database input, or better: the variable binding feature of PEAR::DB
    • disable register_globals, use $_GET, $_POST and $_COOKIE instead.
    • Use preg_replace( '/[^a-zA-Z0-9\-_]', '', $input ) on all input used in file names.
      Things like require_once("files/" + $input + ".html") actually read php files when it's called as ?input=file.php%00
    --
    The best way to accelerate a windows server is by 9.81 m/s2 ;-)
    1. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 2, Insightful
      • secure file uploads to avoid uploading PHP code

      How about "forbid the upload of anything executable, be them script files, scriptable files (flash), CGI files (Python, Perl, ...) or executable pages (PHP/ASP)"? Of even better, "only ever allow uploads of explicitely specified file types, and validate every single file against these types explicitely at upload"? No amount of blacklisting will ever beat whitelisting.

      • use mysql_real_escape_string() on all database input, or better: the variable binding feature of PEAR::DB

      Or use PHP5's mysqli_ or pdo_.

      • Things like require_once("files/" + $input + ".html") actually read php files when it's called as ?input=file.php%00

      And if you absolutely have to include third-party files, use readfile as it passes the data right from the file to the output buffer without ever executing it.

      Also use readfile when you include parts of templates that don't and shouldn't have executable (php) code.

      Of course, the best advice one could give to a PHP developer would be "first and foremost, don't use PHP".

    2. Re:Some simple fixes would be sufficient by Sepodati · · Score: 2, Insightful
      disable register_globals, use $_GET, $_POST and $_COOKIE instead.

      Why? There's no security gained by making this change. Shitty programmers can write shitty, unsecure code with register_globals enabled or disabled. I guess if you make a habit of running just anyone's code on your server, then turning this off may disable a specific vector, but certainly not all of them. The whole "register_globals enabled is bad for security" myth is just that. Bad programmers are bad for security and always will be.


      ---John Holmes...

    3. Re:Some simple fixes would be sufficient by FooBarWidget · · Score: 5, Insightful
      limit the session to the IP-address of the visiting user.

      Is this really a good idea? I've heard stories from people on mailing lists who claim that many people are behind routers/proxies that cause IP changes very often, and that's restricting a session to an IP causes more problems than it's worth.
    4. Re:Some simple fixes would be sufficient by Goaway · · Score: 0, Troll

      Your "most important" section could better be stated as "don't use PHP, it's broken by design".

    5. Re:Some simple fixes would be sufficient by moro_666 · · Score: 1

      Yeah, the ip/session_id chaindown doesn't work.

        There are a dozen of isp's out there that have load balancing on their proxies based on the idea that the dns record of the proxy has multiple hits as ip addresses, now if the user computer hops from one to another, it seems to the server that the "client has changed his address", if you cut the wire here, the users will just be angry and disapointed. It would be very annoying to login everywhere again if your dog knocks over your dsl modem and you lose the connection for a fraction of a second.

        Considering the amount of keyloggers on the move and the amount of dummy windows users blindly running them really undercuts any meanings for the session id hunt anyway. There are workarounds, but none of them are really comfortable.

        For the article. You have an web application that allows execution of uploaded code files, aside from everything else, this is just intolerable. And without that fault the system on the whole still be unaffected in the large scale, only a single victim and his/her resources would be harmed.

        As noted by many people in other posts, ffs learn to escape your variables and don't let people run uploaded files. If this should prove to be too hard for you, practice "do you want fries with that" for the future.

      --

      I'd tell you the chances of this story being a dupe, but you wouldn't like it.
    6. Re:Some simple fixes would be sufficient by CastrTroy · · Score: 2, Insightful

      How about, when people upload files, don't store them in a folder accessible to the outside world, which means they can't be run. It makes more sense to store them somewhere else, so that even if they upload a .php file, they can't call it. Also, when sending the files back downstream, ensure that it isn't in a way that will execute anything on the client side.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    7. Re:Some simple fixes would be sufficient by bmalia · · Score: 1

      Is this really a good idea? I've heard stories from people on mailing lists who claim that many people are behind routers/proxies that cause IP changes very often, and that's restricting a session to an IP causes more problems than it's worth

      You are correct. I read somewhere once that AOL users are on such proxies. Pissing off legitimate users are not worth the security gained.

      --
      There's no place like ~/
    8. Re:Some simple fixes would be sufficient by Mr.+Slippery · · Score: 1
      limit the session to the IP-address of the visiting user.

      Unfortunately, that's not reliable. It has been known to happen that some networks use a load-balancing proxy scheme, such that subsequent requests from the same user can come from different IP addresses.

      --
      Tom Swiss | the infamous tms | my blog
      You cannot wash away blood with blood
    9. Re:Some simple fixes would be sufficient by kalirion · · Score: 1

      Use preg_replace( '/[^a-zA-Z0-9\-_]', '', $input ) on all input used in file names.

      I'm not a regular expressions expert (IANAREE?), but wouldn't this remove all periods from the filename? Someone uploading BigBoobs.jpg may not want it to be stored as BigBoobsjpg. '~' is also a legal character in filenames, and I'm sure there are others caught by the expression that I'm missing.

    10. Re:Some simple fixes would be sufficient by unity · · Score: 1

      Its not just ISPs, dual-wan routers are getting cheaper and some of us have our own load-balancing routers at our home/office. IP restrictions are more annoying than anything else. The amount of security gained pales in comparison to the annoyances.

    11. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0
      Unfortunately, that's not reliable. It has been known to happen that some networks use a load-balancing proxy scheme, such that subsequent requests from the same user can come from different IP addresses.

      So what? The user can log in again and if the IP changes continuously they can take the cluebat to their ISP. If I script ifconfig to bind to a different public IP every minute, slashdot's formkey is invalidated before I submit a post. Explain to me how this could be considered a problem for slashdot admins.

    12. Re:Some simple fixes would be sufficient by MattHawk · · Score: 1

      > limit the session to the IP-address of the visiting user

      Bad idea - using some sort of identification is good, but the IP address isn't the one to use - certain web providers (such as AOL) use a proxy scheme that can result in subsequent requests from the same user, even moments away from each other, appearing from a different IP.

      Whether or not it's a bad thing to block AOL users from your site is a debatable point, but it doesn't change that it's a bad practice :)

    13. Re:Some simple fixes would be sufficient by WoodstockJeff · · Score: 1

      limit the session to the IP-address of the visiting user.

      Yes, this is a good one - it also keeps AOL users from your site, as an added bonus!

      use mysql_real_escape_string() on all database input, or better: the variable binding feature of PEAR::DB

      It would be nice, but not always possible. If a site uses MS SQL or PostgreSQL, there is a good chance that the server wasn't configured with MySQL support, meaning mysql_real_escape_string() isn't available. Not everyone puts the PEAR library in. And a recently-discovered problem with that function and multibyte characters has caused some interesting issues, depending upon how the server gets "fixed".

    14. Re:Some simple fixes would be sufficient by jandrese · · Score: 1
      AOL users are on such proxies
      Now it sounds like a good idea again.
      --

      I read the internet for the articles.
    15. Re:Some simple fixes would be sufficient by bmalia · · Score: 1

      are not -> is not Proof read.. whats that?

      --
      There's no place like ~/
    16. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0

      You could use the first 1-3 quads of their IP address, along with the MD5sum of their user-agent string, or in cases where the X_FORWARDED_FOR header is sent, you could use that too. If an ISP's load balancing proxy is bouncing between IPs addresses on completely different subnets, they seriously need their heads checked.

      You could also use the "Check this box for less security" that would prompt the login script to use this althernative ip/session_id checks, so not all your users have to use the "degraded" security checks.

    17. Re:Some simple fixes would be sufficient by JTek · · Score: 1

      > limit the session to the IP-address of the visiting user.

      This would be an excellent idea, except in most cases you can't do this, because many large ISPs (AOL, for one) send their web requests through a number of load-balanced proxies, so a user's IP can and does change between requests.

      I've noticed that some sites try to mitigate possible XSS attacks by not accepting even a current, valid session cookie for certain sensitive requests, like viewing credit card information or changing a password. For those sites, you will be logged in, and then the moment you click a link to view account information or something, you're prompted to enter your password again.

    18. Re:Some simple fixes would be sufficient by kestasjk · · Score: 1

      Programmers make mistakes, and it also helps to clarify where a variable comes from and that extra caution should be taken with it.

      If you don't think it's bad for security just check to see how many PHP vulnerabilities are limited to people who keep register_globals enabled.

      --
      // MD_Update(&m,buf,j);
    19. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0

      Exactly. This kind of attack is nothing new.

      Always filter input. Always practice defensive programming. Always restrict login sessions as much as possible.

      These sorts of things should be well worn common sense by now.

      I like to use the user-agent string as well as the ip address to restrict logins. One down side of tying a session to an ip / ip range is that people who connect through ISPs like AOL which use proxies extensively will be totally hosed.

    20. Re:Some simple fixes would be sufficient by Christianfreak · · Score: 2, Informative

      global $login;
      check_login( $user, $pass );

      if( $login == true )
      { // do something
      }
      else
      { // fail
      }

      Ooops! With register_globals on, if I do ?login=true in the URL, suddenly I have access!

      Granted, the function should return the variable and it wouldn't be a problem. But with register_globals off, while the code would still be bad, it would be harmless, and there are more complex examples as well.

      I don't get register_globals anyway, unless you're doing something really short (and even then questionable). With a large application one needs to be able to determine where variables are coming from. register_globals hides this, and makes it easier for the newbs to blow their whole leg off instead of just shooting themselves in the foot.

      PHP really needs something equivalent to Perl's taint mode (-T switch). The program dies unless you check the variable against something. You can still get around it but at least it makes you think twice before pulling the trigger.

    21. Re:Some simple fixes would be sufficient by andrewman327 · · Score: 1

      I don't know about PHP, but Java's JFileChooser makes it easy to select which filetypes are permitted for upload. Users do not even see non-supported files in the chooser. I think that most security threats are caused at least in part by laziness on someone's part.

      --
      Information wants a fueled airplane waiting at the hangar and no one gets hurt.
    22. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0

      So how will a clientside check prevent "bad people" uploading anything to a serverside script?

    23. Re:Some simple fixes would be sufficient by spankfish · · Score: 1

      Of course, one could avoid all this kind of nonsense by not using PHP :-)

      --

      NO TOUCH MONKEY!
    24. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0

      if ( negative accusation made && no support provided )
              if ( about MS )
                      moderation = +1;
              else
                      moderation = -1;

      Learn it. Love it. It is the archtypical Slashdot frustrated little weenie wanker way.

    25. Re:Some simple fixes would be sufficient by Sepodati · · Score: 1

      Sure, all true. But a programmer that lazy is just going to switch everything to $_POST['login'] and drive on with the crappy code. Don't blame register_globals, blame the programmer.

      ---John Holmes...

    26. Re:Some simple fixes would be sufficient by riceboy50 · · Score: 1

      If the programmer is writing and testing his code with error_reporting(E_ALL), then he would quickly realize that he is testing an uninitialized value.

      --
      ~ I am logged on, therefore I am.
    27. Re:Some simple fixes would be sufficient by Anonymous Coward · · Score: 0

      slashdot has had 4-5 xss hacks. Scoop (also written in perl) has had at least 4 this year. PHP does some really retarded things (register_globals, gpc_quotes) but insecure programming is insecure programming.

    28. Re:Some simple fixes would be sufficient by larry+bagina · · Score: 1

      slashdot sucks. They used to have very severe formkey problems. BTW -- if you're logged in, the ip doesn't matter.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    29. Re:Some simple fixes would be sufficient by Christianfreak · · Score: 1

      But that's the point of my code. $login should never be passed in from the outside ... it should check a user/pass but register_globals allows you to overwrite from outside the program.

    30. Re:Some simple fixes would be sufficient by Christianfreak · · Score: 1

      But how many newbies know about E_ALL. For that matter, how many of them can actually see the output? On the default CentOS install (so probably RedHat as well) it only outputs to the logs and not the screen. Some person new to PHP, has just an FTP hosting account would never see the errors, or at the very least not know where to look for them.

      Yes I know there are ways around that but there tend to be lots of people new to programming who start with PHP and they might not. In general I wish PHP did a better job of teaching good programming practices.

    31. Re:Some simple fixes would be sufficient by riceboy50 · · Score: 1

      If they're really as green as you're describing, are they going to know anything about Perl taint mode either?

      --
      ~ I am logged on, therefore I am.
  23. I'll go you one better... by Anonymous Coward · · Score: 0

    Dear web 'developers',

    Please learn how to write production quality code before putting your code into production.

    Kind regards,

    Common Sense

  24. Additionally, checks for MSIE by vdboor · · Score: 4, Informative
    Most forums are vulnerable to simple JavaScript insertion attacks. One reason is MSIE is able to execute code like this:

    <a href="java
    script:alert('test')">

    MSIE also allows developers to execute JavaScript in CSS code. A forum which translates

    [color=blue]
    to
    <span style="color: blue">;
    is vulnerable when you can enter
    [color=expression(alert('test'))]
    .
    --
    The best way to accelerate a windows server is by 9.81 m/s2 ;-)
    1. Re:Additionally, checks for MSIE by quacking+duck · · Score: 1

      Note that <a href="javascript:alert('test')">something</a> executes just as well under Firefox as it does in MSIE.

  25. The Cross Site Scripting FAQ by mrkitty · · Score: 2, Informative
    --
    Believe me, if I started murdering people, there would be none of you left.
  26. Meh. by goldenratiophi · · Score: 2, Funny

    I was just hoping for a text box and a button saying "Crack Website!"

  27. Ego problem by Anonymous Coward · · Score: 0
    FTFA:
    Lets hope that all developers know someone who has at least as much as, if not more, knowledge of security as me!

    I say: "Lets hope the web developers of http://client.webdesigngt.com/ don't wring your neck for failing to sanitize your screenshots, boasting at their expense, planting backdoors (you were asked to *test* it), and for forgetting to take your medicine."

  28. Umm... by sheldon · · Score: 1

    As far as "how did he get the code for the login screen"?

    I would have thought the answer was obvious... It's probably an Open Source CMS framework of some sort, and the code is available at sourceforge.

    The second question is answered by phishing. I get these all the time for paypal.com.

  29. XSS is not the biggest problem by MobyDisk · · Score: 2, Insightful

    The biggest problem here was not the XSS attack. Even w/o the XSS, this attack could have been carried out. The real problem here was the ability to upload executables. Even basic unixy permissions should stop write access to the web directory. Unescaped strings happen. (Especially when programming in these type of languages, which is another entire discussion.) The fix isn't to modify the thousands of print commands. It is to fix the one permission setting.

    Suppose you want to keep mice from getting in to your flour. Do you seal every crack, windows, vent, hole, and drain in your house? Or do you put the flour in a sealed container?

  30. A reminder from Gramma Notsi by Anonymous Coward · · Score: 0

    It's "piqued my interest", not "peaked my interest" (page 3).

  31. Regular Expressions by Rainefan · · Score: 1

    It woul be interesting anyone posting any java regular expression for detecting XSS attacks XD Tnx!

  32. Use Chroot jail and block outgoing http/ftp reques by vivekg · · Score: 3, Interesting

    I found that if you block outgoing http/ftp requests from your webserver attacker can not install his/her code.
    Run Apache web server in chrooted jail where bash or any other shell/commands are not available to attacker
    Run almost all critical services in chrooted jail
    Use dedicated DB server

    Other extreme solution - is to put root file system on read only media such as CDROM (not useful for everyday)

    And yes I know that no computer system can ever be completely secure, you can make crackers job hard only with above techniques

    Just my 0.2

    --
    The important thing is not to stop questioning --Albert Einstein.
  33. XSS by Vexorian · · Score: 1

    When I first learned about php I read about XSS and SQL injection, I thought that sanitizing output/content to be used in queries was security 099 . I eventually got surprised that not even the big ones care enough about this. Google had an XSS exploit (although it was fixed the same day it was announced), Other sites that youtube, nsa , and msn got XSS flaws recently as well.

    --

    Copyright infringement is "piracy" in the same way DRM is "consumer rape"
  34. MitM by Marc2k · · Score: 1

    I was going to say the same thing after reading the article, actually. While XSS may very well be a critical threat, the example relies heavily on man-in-the-middle-type attacks, which a naive web application is going to be prone to, anyway. Nothing to see here, move along.
    Also, I haven't seen an unjustified anonymous RTFA comment get modded up that high since 99, what gives?

    --
    --- What
  35. It's 2006.. by Marc2k · · Score: 1

    ..you're making the mistake of conflating AOL users with legitimate users.

    --
    --- What
  36. Arbitrary Javascript by JasonTik · · Score: 1

    I understand how he managed to get arbitrary javascript into the page. But how does he manage to display it to other users, since it is returned as an error to the enterer of the javascript?

  37. Ok but by Chris+whatever · · Score: 1

    I read the article, it isnt that EASY, the guy had to dipose of 2 available servers or machine, then if it's in house software, you need to have physical access to the interface and the user machine to get the cookies,,,,i mean the Slashdot post makes it seem very easy but it's not.

  38. Hope they've fixed it by now... by Kamidari · · Score: 1

    ...since one of his screenshots has the actual client URL in it.

  39. Use whitelists. by Kristoffer+Lunden · · Score: 1

    That's why you always use whitelists to validate data instead of blacklists. If users can enter URLs, make sure it starts with ^(http(?:s)?|ftp) or whatever you think is reasonable. If users can enter colors, maintain a list of allowed colors, or at the very, very least only allow [a-z]+ or #[\da-f]{6}. And so on. It's much easier starting out real strict and whitelisting more cases as they become needed, than it is to start plugging every possible hole one by one.

  40. Ugh by CTachyon · · Score: 2, Interesting

    The article uses an awful example of an XSS exploit. The vast majority of XSS exploits don't have to jump through the hoop of an HTTP POST, so they're mindlessly simple to pull off, and there's no phishing involved. Plus, the fact that he used a proxy to modify his own web browsing is a complete red herring and detracts from the article.

    In contrast to phishing (and in contrast to what's been said in most of the posts so far), an XSS exploit is a legitimate link to the target website. No amount of looking at the host part of the URL will tell you that it's a phish, because it truly, honestly isn't. If you take the time to manually browse the GET parameters individually before you click the link, you might catch that it's an XSS exploit (or an attempt at one) if you know some HTML and Javascript.

    What's worse, though, is that instead of a clickable link, the exploit could even be the URL of an <iframe> tag. Completely automatic, no clicking required, and AFAIK no modern browser allows the user to disable or manually confirm <iframe> tags. Even worse, XSS attacks on some sites are persistent and shared. For instance, if someone home-rolls their own comment system and forgets some checks, it might be possible to post an XSS exploit in the subject line of the comment, which not only affects everyone who reads the post, but also everyone who even reads a list of new messages.

    The important characteristic of an XSS attack is that, unlike most web-based attacks, XSS attacks are exploiting the website itself -- not you, and not your browser. You click the link, the website ships some HTML to your browser, and whaddya know, there's one of them newfangled <script> tags to run.... The injected Javascript code, which the webmaster didn't intend but nonetheless his website actually delivered to your browser, runs with the same permissions as any of his own code, which includes access to the document.cookie property. Since most websites these days stick session IDs or even *groan* username/passwords in cookies, all it takes is for the Javascript to e.g. generate an <img> or <iframe> tag that points to the attacker's website, with '?'+document.cookie tacked onto the end of the GET request. Now the attacker can log in as you, and can explore other, non-XSS exploits that require him to be logged in.

    Your only recourse as a user is to disable Javascript. Full stop. You can't even enable it on "trusted" sites, because if you mark them as "trusted", you're saying "I trust that this website will never, ever be hacked so long as I live". One or more of your "trusted" sites might have undiscovered XSS flaws in their backends, and you can't "untrust" them faster than the blackhats can exploit them.

    There is nothing, I repeat nothing that you can do as a user or as a browser designer that will simultaneously (a) prevent XSS and other server-side exploits, and (b) allow the features that modern web sites depend on by design. If you think you want a browser that's completely safe from server-side exploits, spend a week browsing the web using strictly Lynx, then see if you're still of the same opinion. (While XSS requires Javascript to pull off, there are other server-side data validation problems on many websites, and those can be exploited by something as innocuous as a CSS stylesheet reference.)

    --
    Range Voting: preference intensity matters
    1. Re:Ugh by kayditty · · Score: 0
      In contrast to phishing (and in contrast to what's been said in most of the posts so far), an XSS exploit is a legitimate link to the target website.
      XSS is NOT necessarily a legitimate link to the target website. For instance, there was an XSS (and phishing) bug in IE a few years back, wherein a link formatted like so:
      http://www.realsite.com%20www.evilsite.com/badcgi. pl
      would appear as a legitimate link to realsite, but would actually go to evilsite, loading the bad cgi. Further, IE would actually send the cookie for realsite to evilsite. I used this to exploit a forum that I frequent back then. You don't feel this to be true XSS? Cross site scripting does not necessarily involve JavaScript, server side, client side, or any combination thereof. It is a common misconception. The flaw can be in the browser, the web application, or the server. Just so you know.
    2. Re:Ugh by CTachyon · · Score: 1

      What do you think the "Scripting" in "Cross Site Scripting" refers to? It refers to client-side javascript. Please read some Bugtraq, or at least this FAQ or the Wikipedia article. (The Wikipedia article is the easiest read. In particular, the section on types of XSS problems is edifying.) Your example is a straightforward input validation bug in the browser, and it doesn't involve any scripting at all, cross-site or not, and therefore is not an XSS anything. It's just a malicious input that exploits a browser bug.

      In stark contrast with an XSS flaw, your example is not the site's fault, and there's very little that realsite.com can do about it. A smart site that uses a whitelist approach to user-posted URLs might refuse to let a user post such a link, but it's squarely the browser's fault for mishandling a faulty input, not the site's fault for having the link. The smart site refusing to post funky links is merely doing a service to all the stupid programmers out there. Faulty inputs happen all the time in the real world -- typos, human errors, the occasional corrupt file -- and any browser that doesn't say "Whoa! What the heck am I supposed to do with that?" is a buggy browser.

      (Sadly, when it comes to malformed HTML, the "buggy" adjective applies to AFAIK all browsers today, including the lowly Lynx. Google for "HTML fuzz" if you're curious. Some hold up better than others, though, and IE is by far the worst of the lot. What's worse, when it comes to malformed URLs, IE itself has historically been a disaster, with about 2-3 times the URL bugs as the Mozilla codebase, and scarily almost all non-browser software that registers third-party URL handlers either (a) can be exploited today, or else (b) has been exploited in the past and survived a brutal trial by fire. I'm thinking of AIM in particular for the latter.)

      --
      Range Voting: preference intensity matters
    3. Re:Ugh by kayditty · · Score: 0
      What do you think the "Scripting" in "Cross Site Scripting" refers to? It refers to client-side javascript.

      No, it refers to the name being a MISNOMER. Please read dictionary.com.

      Please read some Bugtraq, or at least this FAQ or the Wikipedia article. (The Wikipedia article is the easiest read. In particular, the section on types of XSS problems is edifying.) Your example is a straightforward input validation bug in the browser, and it doesn't involve any scripting at all, cross-site or not, and therefore is not an XSS anything. It's just a malicious input that exploits a browser bug.

      I've been reading (and contributing) to Bugtraq since 1999 (including the use of many XSS vulnerabilities).

      No, it doesn't require any scripting at all, but I consider it an XSS bug, because it's cross-origin. I'm sorry that XSS originated as something as simple as unsanitized output which could be exploited by inserting arbitrary HTML entities, but that doesn't mean that it can't evolve to include other things. And if Wikipedia disagrees with me, then Wikipedia is wrong. You don't know who I am, so you don't have to take my opinion with anything more than a grain of salt, but I definitely know what I'm talking about. It'd be like one of those things where top scientists disagreed about the definition of string theories, or something (except you probably aren't a top anything. well, see, I can make assumptions too).

      In stark contrast with an XSS flaw, your example is not the site's fault, and there's very little that realsite.com can do about it.

      Yes, exactly. Because XSS does not necessarily have anything to do with the web application. Okay, maybe it would be more appropriate to refer to it as XS? to appease the interests of stupid internet zealots. But the idea originated under the nomenclature that is XSS, and I happen to group cross-origin bugs in the category. I mean .. maybe you've never heard of Cross Site Tracing?

      A smart site that uses a whitelist approach to user-posted URLs might refuse to let a user post such a link, but it's squarely the browser's fault for mishandling a faulty input, not the site's fault for having the link. The smart site refusing to post funky links is merely doing a service to all the stupid programmers out there. Faulty inputs happen all the time in the real world -- typos, human errors, the occasional corrupt file -- and any browser that doesn't say "Whoa! What the heck am I supposed to do with that?" is a buggy browser. (Sadly, when it comes to malformed HTML, the "buggy" adjective applies to AFAIK all browsers today, including the lowly Lynx. Google for "HTML fuzz" if you're curious. Some hold up better than others, though, and IE is by far the worst of the lot. What's worse, when it comes to malformed URLs, IE itself has historically been a disaster, with about 2-3 times the URL bugs as the Mozilla codebase, and scarily almost all non-browser software that registers third-party URL handlers either (a) can be exploited today, or else (b) has been exploited in the past and survived a brutal trial by fire. I'm thinking of AIM in particular for the latter.)
      Tacking on myriad anecdotal rants to the end of your post might give you some form of credibility in the eyes of the typical Slashdot reader or moderator, but it doesn't me. It seems you're under the assumption that you're some sort of guru who's above me. Well, it'd be the opposite, if anything. And, no, I am not getting defensive. It is just rather amusing how many mis-informed posts I see here in tech related categories on Slashdot, which proceed with belittling descriptions of basic ideas, like yours has. What do you want? A congratulations? You know what Lynx and fuzzing (a relatively new security buzzword) is. So do I.
    4. Re:Ugh by kayditty · · Score: 0

      And before I get a-fucking-head of myself and just come off as an ASSHAT, please read the damn Wikipedia link for yourself .
      Here is a cute little excerpt:

      Terminology The term cross-site scripting is not a very accurate description of this class of vulnerability. In the words of XSS pioneer Marc Slemko: This issue isn't just about scripting, and there isn't necessarily anything cross-site about it. So why the name? It was coined earlier on when the problem was less understood, and it stuck. Believe me, we have had more important things to do than think of a better name. The acronym CSS was often used in the early days to refer to cross-site scripting vulnerabilities, but this quickly became confusing in technical circles because both Cascading Style Sheets and the Content-scrambling system shared the same acronym. Perhaps the first use of the abbreviation XSS was by Steve Champeon in his Webmonkey article "XSS, Trust, and Barney".
      I wonder if you were even around in the early Webmonkey days. It wasn't THAT long ago, now. Okay, I still look like an asshat. But, god damn, I can't have half-informed people attempting to slight me.
  41. Re:Ugh //~ to complicated.... by deviceb · · Score: 1

    heres how you do a TH attack..
    Just run up, hit the wanker in the knee like so, and demand log/pass or wallet.

    --
    Kill your TV
  42. Re:Use Chroot jail and block outgoing http/ftp req by Anonymous Coward · · Score: 0

    Just my 0.2

    Is that your 20 cents or your 1/5th of a cent?

  43. NOT insightful, totally wrong. by Anonymous Coward · · Score: 1, Insightful

    Having register_globals on does exactly what it says. Anything passed via get, post, cookies, etc becomes a global variable. If you do if ($username) assuming username is a session variable, people can just submit it via get and bypass your authorization code. So you turn off register_globals and use if ($_SESSION['username']) instead.

    Of course disabling this setting (not enabling it like a moron actually, its been disabled by default for years and even the PHP developers tell you its a potential security risk) won't magically make your code perfectly secure. Just because you could still make security holes, doesn't mean you should just leave every possible security hole wide open.

  44. Why not making your own form instead of phishing? by Anonymous Coward · · Score: 0

    Ok, risking being called a dumbass; why didn't the attacker overcome the 25 character HTML limit by creating his own HTML form that pointed to the actual web application for him (not an unsuspecting user) to inject the code? The attacker's form doesn't have to have any size limits on the fields. What am I missing here?

  45. This isn't about XSS by dcam · · Score: 1

    While he does use XSS to manipulate the site, most of the damagins stuff he does is not done through XSS. The application is poorly designed because:

    1. It does not stop someone from URL hacking to edit the data of another client. This is just flat out poor coding.

    2. It allows people to upload executable code and execute it, in this case PHP.

    What XSS gives him is the potential to gain access to the site under another account. This was because the site maintains state by storing a session cookie. He can inject some XSS that will send the session cookie to another server, where he can pick it up later and use to log in as another user.

    So yes, real use of XSS. But to actually own the server he needed to be able to upload the PHP file.

    --
    meh
  46. Re:Use Chroot jail and block outgoing http/ftp req by Anonymous Coward · · Score: 0

    He obviously didn't read the floating point math article.

  47. Re:Why not making your own form instead of phishin by kayditty · · Score: 0

    Normally, that's what you'd do to get around limitations such as this (I do this all of the time). However, for a true XSS attack, you'd need to use GET vars. So, essentially, he wound up doing exactly that, but it was the victim that needed to submit the POST data (so that the user's browser would be in the valid domain when it executed the script (which grabbed the cookie)). The end result is that this is a phishing + XSS combo.