Anatomy of the HBGary Hack
PCM2 writes "Recently, Anonymous took down the Web sites of network security firm HBGary. Ars Technica has the scoop on how it happened. Turns out it wasn't any one vulnerability, but a perfect storm of SQL injection, weak passwords, weak encryption, password re-use, unpatched servers, and social engineering. The full story will make you wince — but how many of these mistakes is your company making?"
The story of their being hacked and how it was done has probably done more for systems security than they as a company ever have......
Pride comes before a fall
I've been following this since I heard of it happening- definitely interesting. I like the idea of a custom CMS to avoid an open one (more security). And the poor admin who gave out root, dropped firewalls, and gave up the correct username all via email- that's a bummer. I bet that will be among his "worse day ever" collection. As for shared passwords, I'm sure a lot of us work at guilty companies. Hell, active directory exists partially to address the need for multiple passwords. In all, I enjoyed reading how it was done- quick, efficient work.
But how many of these mistakes is your company making?
Most companies probably make these mistakes, all except the biggest mistake which was poking a sleeping bear.
Got Code?
Well, we're not going after 4chan/anonymous, so we're probably in the clear.
I think the biggest security mistake it's possible to make is antagonizing the largest collection of bored hackers/crackers/script kiddies/associated hangers on that exists.
As it turns out, Anonymous isn't a bunch of 16 year old Swedish kids in their moms' basements running the LOIC. No, my friends, Anonymous knows what they are doing, and God spare your soul if you provoke them.
Looks like they got taken out by Little Bobby Tables...
http://xkcd.com/327
http://www.object404.com
I'm just amazed at how completely oblivious "Chief Security Specialist" Jussi Jaakonaho was during the email correspondence, AND that he was perfectly fine with sharing root passwords via plaintext email.
How do these people even get security jobs and be negligent in even the simplest security practices?
Gotta say, the linked article was a great education for me, one who's interested but never had time to dig into some of the arcana of stuff like SQL injection.
In watching Wikileaks, OpenLeaks, Egypt, the Palestine papers,and now HB Gary, I'm thinking that we're at the edge of something monumental. I expect we'll see a lot more formerly secret data become public, and see governments and corporations either clean up their acts, or become increasing desperate and hostile in trying to keep their inside info secret.
Either way we're in for a wild ride!
Three Squirrels
Greedy fake security guy tries to troll a large group of random strangers for money.
Large group of strangers punk him hard.
Profit for the news media!
The exact URL used to break into hbgaryfederal.com was http://www.hbgaryfederal.com/pages.php?pageNav=2&page=27. The URL has two parameters named pageNav and page, set to the values 2 and 27, respectively. One or other or both of these was handled incorrectly by the CMS...
Why would Jussi Jaakonaho share sensitive info over e-mail? MEMO to Jussi the "Security" in Chief Security Specialist means just that. Not Chief Shithead Specialist.
They are the Tacoma Narrows bridge of the IT security world now. They will be the textbook case example of the generations of students, with the entire repertoire of what not to do every step of the way, especially the one about not pissing-off a malevolent, anonymous mass.
... and look at this as a layman.
OK, they chose a closed/custom CMS in hopes of security through obscurity, fair enough.
Ok, the guy thought he was talking to the boss and gave away the credentials, fair enough.
But how the HELL did they thought that such weak passwords, an out-of-date system and no SSH keys were fine?
Granted that all of their mistakes look unforgivable to me since I'm in the business but I simply can't wrap my head around the ones I mentioned.
Strong passwords aren't an inconvenience, damn let your browser remember them; why not keep an updated a system in the first place? And passwordless SSH logins are more secure and more convinient.
And an SQL injection? Even an automated scan would have found that! (No offence to scanner developers, I'm one myself)
This is amateurish to say the least....
Interesting title to select. Sounds a lot like the story I submitted at 9:30 AM ET -- 11 hours prior to PCM2's submission above. Or maybe PCM2 just ripped off my comment earlier today? Figures, this is Slashdot ...
My work here is dung.
I followed the article very well but I still don't quite understand what a SQL injection is...Can someone explain it a bit better?
Comment removed based on user account deletion
http://bobby-tables.com/
the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff
One of the two parameters was changed to something that allowed an SQL injection attack.
Likely something like: pageNav=';SHOW TABLES;
The start of the problem was Barr mouthing off to the Anonymous contact about what he was going to do. Clearly, his ego is to blame for the trouble it caused his company.
You're missing something.
http://www.hbgaryfederal.com/pages.php?pageNav=2&page=27
Obviously the 2 and the 27 are not being validated before being appended into part of a larger SQL query, so construct your own URL substituting 2 (or 27) with something like 2';show tables; --
Find the one that looks like it contains user login information and then substitute again with 2';select * from user_table; --
Hey presto, you can now read all the user accounts and hashed passwords.
On the one hand, the more I read the more it sounds like HBGary had it coming (and was sloppy and inept).
But on the other, will we have no discussion of whether a vigilante retaliation is appropriate? Logging in, maybe some embarassing modifications to the web site, sure. Publishing all the employee's e-mails and deleting backups, too? (If someone had come and broken Barr's legs in an alley, would we be so ready to gobble up the technical details of how it'd been done?)
Or, for a third argument, is it the right response because Anonymous –fighting the battle the government is failing to pick up –has no recourse but itself? I don't know: I'm asking; but I'm asking because I'm surprised not to see it as part of current discussion.
Really. +1.
If you mod me down, I shall become more powerful than you could possibly imagine.
They are giving you the original URL where the injection was used, not a link to the actual injection.
They probably replaced some of those parameters with the injection code.
page is probably how many results per page they want, and pageNav is what page they want, so probably page landed straight into a LIMIT in a sql query, without any kind of treatment. Most likely, just passing that crap through mysql_real_escape_string() would have been enough.
WTF am I doing replying to an AC at 5 A.M on a Friday night?
ok actually.
websites take input from users. like when i log in to slashdot, it asks me for input.
it will run the input through a program, which will talk to a database.
how does it talk to the database? it runs an SQL command, like 'SELECT * FROM TABLE USERS WHERE NAME=$username'
$username for me is 'decora' because thats what i type into my little login box.
but lets say i uhm, type into the 'username' box something like 'decora OR name=cmdrtaco'.
now, instead of just getting my info, it might spit back all of cmdrtacos info too! maybe even his hashed password.
to protect against this, most programs will take measures like:
0. validate input (does the username have spaces in it? reject if so)
1. check the SQL query to make sure its 'safe' and contains no parsable SQL commands.
2. dont write stuff like 'SELECT * FROM', only read stuff you need.
3. validate data returned from the SQL query before printing it to an html page.
ie. if yr supposed to get one 5 datums back per user and instead you get 10, somethings wrong.
then again all that takes time and money and effort to do.
why bother, if nobody will ever care? the company that made the CMS for HBGary probably
contracted out the programming to some other company that hired people off a website,
(i have no evidence of course).
My company isn't pissing off a buncha teenage hackers.
We are Anonymous.
We are legion.
(surprised no one has done this yet) :)
Yeah, it's not a SQL injection. My reading of this is that the above URL produced an error message leaking useful information about table names, the DB server being used, possibly even the full query being executed etc. This would suggest the vulnerability and form the basis for devising the actual injection against pages.php.
Watson: What is "http://www.hbgaryfederal.com/pages.php?pageNav=2&page=27" Alex
Simple, you append the SQL code to one of the parameters:
Simple:
http://www.hbgaryfederal.com/pages.php?pageNav=2&page=27;
and let the server process the request. If there is no parameter validation being done at any point between when the request is made and the SELECT is made on the database, you get SQL injection.
Presumably they do something along the lines of
"SELECT * from PAGE where ID = " + pageParam;
Where pageParam equals "27;SELECT ....." with another SQL statement.
Kill the head, ... the body follows.
Welcome to your grave Aaron Barr (Saigon Style on the street in front of a restaurant at the corner).
XXOO
-308
I think the big one is my CEO ain't talking shit about a bunch of hackers who are better at it than him.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
You can't mention SQL injection without reading this awesome thread on TDWTF.
It's on par with what Sterling wrote in The Hacker Crackdown.
.. a perfect storm of SQL injection, weak passwords, weak encryption, password re-use, unpatched servers, and social engineering.
Not the people I would go to for security advice
"but how many of these mistakes is your company making?"
Looks like I got lax in cracking the whip. I just went from 3 errors to 33 errors.
Time to crack the whip, again.
Still waiting on Serviscope_minor to wake up to fucking reality and realize that Jessica Price isn't going to fuck him.
It's midnight PST here, and 4chan is having MASSIVE issues in posting anything. I've tried multiple (unsecured) connections besides my own, and it's the same result, even from VPN halfway across the country.
Still waiting on Serviscope_minor to wake up to fucking reality and realize that Jessica Price isn't going to fuck him.
Forgive my lack of terminology; I know next to nothing of databases anymore. MSAccess was forced on me at college, and know nothing to speak of SQL.
One of those passed parameters was passed directly to an SQL query, with no validation or sanitation whatsoever. Turning "...&page=27" into '...&page="; DROP TABLE (FOO);' or somesuch would result in the whole query being executed.
Look for the XKCD on "Bobby Tables" for a better example. Again, I know next to nothing of the exact methods involved. It's just just how I understand SQL injection to work.
Finally had enough. Come see us over at https://soylentnews.org/
or if you're expecting a number run it through something like parseInt() first. How hard is that?!
If you don't risk failure you don't risk success.
No, it is from a different cartoon.
The name of the company is not HBGary. It is HBGary Federal.
Nuff said. No further comment necessary.
Baker's Law: Misery no longer loves company. Nowadays it insists on it
http://www.sigsegv.cx/
I remember when Kevin was being hunted and the world was fearful that he could whistle down the phone line and launch a nuclear attack ....
Now it appears that Anonymous ARE actually capable of mass effect out in the real world whereas the media fear of Mitnick was all legal propaganda.
I just found that interesting.
They are giving you the original URL where the injection was used, not a link to the actual injection.
They probably replaced some of those parameters with the injection code.
page is probably how many results per page they want, and pageNav is what page they want, so probably page landed straight into a LIMIT in a sql query, without any kind of treatment. Most likely, just passing that crap through mysql_real_escape_string() would have been enough.
In the case of this both of those parameters should be restricted to being numeric only. This should be done as soon as the page reads the values from the querystring. On top of this they could use PDO or some other kind of prepared statements to provide a further level of security.
Lets not restart the argument with Jamie about prepared statements being the only way of doing things :)
I dont read
Yeah, I mentioned proper escaping and input validation because a rewrite of that app to use PDO would take time and be expensive. Adding input validation and escaping all strings is trivial and can be done in an afternoon.
WTF am I doing replying to an AC at 5 A.M on a Friday night?
Exactly my argument. If you use some ancient code and it doesn't use PDO or $PREPARED_STATEMENT_SYSTEM, you don't have to rewrite it. Just use basic input validation and escape all strings, and you should be relatively safe.
WTF am I doing replying to an AC at 5 A.M on a Friday night?
From: rich@hbgary.com
To: all@hbgary.com
Date: Tue, 10 Feb 2009 19:51:04 +0000
Subject: Kaspersky labs website hacked
Simple Sql injection was the attack vector... Does our new website have a sql backend?
Sent from my Verizon Wireless BlackBerry
C'mon Anonymous...
Posting all their client's info, confidential product info, staff personal emails, and personal details of clients too? What did those people do, apart from buy HBGary's products. You've collectively punished them for nothing, when they were innocent by-standers. I didn't realise this was the Anonymous way...
2.3GB torrent of stuff no less. I admit it made good reading and gave an interesting insight into software development and the security industry.
However, in terms of revealing their client-base and info, this is like punishing Microsoft users for buying a Microsoft product. (Isn't that punishment enough?).
Aaron Barr's clumsy attempts to ingratiate himself to Anonymous, were certainly worthy of contempt, and his attempts to identify individuals like some kind of private eye, certainly singled himself out for attention as the idiotic poster boy Security Guy. By all means, flood his home connection off the 'net. But HBGary Federal produces fairly sophisticated products designed to try and stop malware/spyware and root-kits, and you chose to try and wreck their whole business that it took them 3 years or so to build? C'mon, where is the fairness?
I can't help thinking that Anonymous (due to their 3 of the DDoS), felt threatened by HBGary as they are the "competition", and might have had some success against Botnets in the past.
I think in this case Anonymous over-stepped the mark, and are operating with their own flawed morality. You've really got to think things through before you just do it. Think of the bigger picture. You just came off as a cruel bunch of f-tards with this stunt.
I think I'll post this one Anonymously.. :) Pardon the pun...
HBGary and HBGary Federal are 2 different companies, that are related. HBGary was the one hacked.
this is the accepted way for a lot of places to transfer credentials. I'm really surprised a place like HBGary did the same. It was a long time coming if this is SOP for them.
http://dazzlepod.com/site_media/txt/rootkit.com.txt
boycott slashdot February 10th - 17th check out: altSlashdot.org
Would you be willing to share some details? In particular, what would be the needed complexity of the Master Password to make it just as worthwhile to brute-force the Firefox password vault as to guess the Master Password? How many bits? (Or, alternatively, how long would a lower-case-letters-only password have to be to have the correct complexity?)
If you say 8 letters lower-case, I'm going to delete all my passwords from Firefox...
404555974007725459910684486621289147856453481154 in hex is "You sank my Battleship?"
[GPG key in journal]
The following Google query returns some fantastic results (thousands of them):
inurl:select inurl:where inurl:%20
the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff
People have been looking at the anonymous study of HBGaryFederal and the information that has been posted. That got our attention, and helped us gauge that company and its capabilities in the security field.
What if this is just the low lying fruit, damning evidence easily found?
If we are lucky, a copy of the email database and backups was sent to Wikileaks. Those people can take the time to do a more thorough analysis. And publish.
Here's hoping
--
If our politicians told us they lied, we still wouldn't believe them.
That would take _roughly_ 35 mins on an average workstation/multiple PC's working together. Include numerals and special characters to magnify the possible permutations, and you push it up to _about_ 2 years.
Give or take depending on processing power, implementation, and such other many things you can imagine and Google.
see here for interesting values, if that helps? http://www.lockdown.co.uk/?pg=combi