Oklahoma Leaks 10,000 Social Security Numbers 245
DrJokepu writes "Apparently the folks at the Department of Corrections of Oklahoma just forgot to use common sense when they created the state's Sexual and Violent Offender Registry. By putting SQL queries in the URLs, they not only leaked the personal data of tens of thousands of people, but enabled literally anyone with basic SQL knowledge to put his neighbor/boss/enemies on the sexual offender list. Fortunately, after the author of the blog The Daily WTF notified the department about the issue, the site went down for 'routine maintenance' on April 13 2008."
Re:*facepalm* (Score:5, Interesting)
Re:*facepalm* (Score:3, Interesting)
Re:wow (Score:5, Interesting)
However, if Oklahoma has problems similar to California, then they're faced with a Hobson's choice. They can fire the guy/gal but given the low pay scales, they could well end up with someone just as bad.
Re:*facepalm* (Score:4, Interesting)
Not only did they put SQL in the query string, they granted more permissions to the DB user for the web app than it needed. If you're just looking up data, not changing it, why does the app need anything other than SELECT ( or EXECUTE if you're using stored procedures )?
A great example of why "just give the app admin rights so it can work" is one of the dumbest statements a developer can make.
Re:Pleeeese! (Score:5, Interesting)
Re:*facepalm* (Score:3, Interesting)
what you're talking about seems to be an Oracle-specific thing
no, not really. in the case of sane databases, it is the norm. heck, even mysql [mysql.com] supports them.
But like I said, since these web development frameworks generate the SQL queries for you based on your usage of their models
except that generating SQL on the fly is extremely inefficient . the database must then parse the query, measure costs and determine the best execution plan before executing the query even begins. using prepared statements and bind variables obviate the need for this, thus allowing the database to optimize the queries and choose the best execution plan.
not doing this is either ignorance or negligence. i would hope it was the former in the case of oklahoma, and seems to be the case all over.
Re:Oblig. (Score:4, Interesting)
Rather, this is a boon to those already on the list. Now they can simply claim that their status as a listee was simply a vengeful prank courtesy of an unnamed drinking buddy.
I do hope they have validated archives somewhere.
Re:Umm... (Score:4, Interesting)
Re:*facepalm* (Score:2, Interesting)
Require the database be erased, all backups etc.
If they can't keep it secure they can't keep it.
As a side effect (if this was their only database
they are out of a job...).
If this supported tax collections, sorry, no
collections...
Re:Oblig. (Score:3, Interesting)
Re:Pleeeese! (Score:2, Interesting)
http://www.ticic.state.tn.us/sorsql?sql=sp_SOR_IMAGE+'SO001290'&contenttype=image/jpeg
You would be suprised... (Score:3, Interesting)
There is one county in Florida that will return more results by walking thru their ID numbers than by searching for everyone in thier site. That means people who for whatever reason aren't supposed to show up on the website get harvested by companies like the one I worked at.
A county in Texas tried to stop the harvesting by making people sign in and limiting searches but managed to introduce a sql injection hole that lets you do whatever you'd like to the Users tables. I didn't try messing w/ the offenders tables but wouldn't be suprised if it was possible.
These are just two examples that I recalls. There were quite a few more.
Re:*facepalm* (Score:5, Interesting)
This particular site was coded in java, so PHP was not at fault here. I don't know what got you onto the topic of PHP.
The problem is that when these projects come up, rather than contracting out to someone who knows what they're doing, or at least hiring or training somebody who can code, they go to Bob the IT guy
Software development has always been rife with contracts that go to the lowest bidder based on a spec that mentions only features and deadlines (not security, quality, or other metrics). This is because most IT projects are managed by people who don't understand IT, and who do the IT equivalent of asking their neighborhood carpenter to build the golden gate bridge. You get what you pay for.
I know I sound elitist here, but goddamn it, PHP and all those lovely little scripting languages have unleashed a disaster on the web.
If PHP didn't exist, someone would invent it. PHP fills the niche of an environment that lets you get up and running quickly with web applications, just like visual basic did it for windows apps, and access did it for databases. Yes, it's a bit elitist to say that all programming environments should be so difficult to program in that they weed out all but the most dedicated (and knowledgeable), but it's also unrealistic, because people would invent easier environments if there weren't any. PHP is actually quite good at blending the capability for quality coding with a low barrier to access.
And besides, the problems with web app security have nothing to do with PHP or any other scripting language, they have to do with visibility. Think about how many two-tier desktop apps there are that let anyone with a bit of knowledge bypass the app and do whatever they want in the database. Nobody makes a fuss about this, because the visibility of those apps is lower.
I would say the primary problem with web app development is not any of the tools, but the perception among IT managers that web app development is simpler, and requires less skill, than desktop development, while the inverse is true. I do both desktop and web development, and it is much more difficult to build good web apps, because you have to pay more attention to architecture, security, performance envelopes, and gui design. That management (even my management) still doesn't understand that is disappointing, but understandable given how the web started out as a toy and still hasn't quite shaken that perception.
Re:*facepalm* (Score:3, Interesting)
You would be surprised what you can find grepping for cmd_str, command_string, cmdStr, etc. Please developers, parametrize your variables. This won't prevent all attacks, but there is NEVER an excuse to use command strings, especially when you are doing any sort of string manipulation on it.
http://en.wikipedia.org/wiki/SQL_injection#Preventing_SQL_Injection [wikipedia.org]
I work in product security, so I am often the first security pass for code as it comes from the developers. It still shocks me that senior level database engineers express scepticism that an attacker would go to all the trouble to manipulate POST data, and tell me that they have never heard of SQL injection.
As a fun side note, it has given me multiple chances to email out links to xkcd 327
Re:Pleeeese! (Score:1, Interesting)
They removed the link to the page and blocked off a page.
Google cache reveals the truth, and a link from there even allows searches. I can't be bothered to go SQL-injection hunting today, but I'm betting they're there from one look at the old problems at TheDailyWTF.
http://docapp8.doc.state.ok.us/servlet/page?_dad=portal30&_schema=PORTAL30&_pageid=426 [state.ok.us]