News for hackers. Stuff that matters.
Re:HackedThat: Breaking in to a hardened server via the back... by snomad on Thursday August 25, 2016 @05:58PM (#12362821)
Money line:

> It’s an example of a utility box that runs various random services - maybe acts as a bastion host or testing ground - and nobody quite manages it or knows what it is used for. This server is as weak as its weakest service; and because it is not purpose-managed, it can be difficult to keep track of what is running on it and ensure all services are patched and secured. If you have one of these servers floating around somewhere, you might want to think twice about keeping it - it may very well be the chink in your armor.

True for applications AND servers.

Re:HackedThat: Breaking in to a hardened server via the back... by spc476 on Thursday August 25, 2016 @08:24PM (#12363488)
But the weakest point is always human: http://boston.conman.org/2004/09/19.1 (true story---happened to me)
Re:HackedThat: Breaking in to a hardened server via the back... by djhworld on Thursday August 25, 2016 @04:48PM (#12362379)
That was a delightful read.

Wasn't entirely sure how they knew where to look for the Passport credentials though, unless they'd gleaned that information earlier. From the article the author makes it sound like they had a limited window to mount the disk, pull off what they wanted and shut everything down, did they already know where to look?

Re:HackedThat: Breaking in to a hardened server via the back... by bradleybuda on Friday August 26, 2016 @01:30AM (#12364402)
Thanks, and great question. During our exploration of the first box we popped, we noticed that most of the services on the host had their code and configuration in /usr/inversoft (or /usr/local/inversoft, I can't remember which exactly). So when we got our shell on the app server, that was the first place we looked, and luckily it didn't take long to find a config file containing Passport credentials.
Re:HackedThat: Breaking in to a hardened server via the back... by jessaustin on Thursday August 25, 2016 @05:07PM (#12362514)
How does Passport find its credentials? IDK, but I'd guess there is a series something like: exec flag, envvar, config file in user's home directory, config file in default /etc location. Attackers would just use the same logic. That wouldn't get them the first thing in the list, but that's probably not how it was set up anyway. If one were worried about time, one could patch Passport to print the results after it had done the work itself.
Re:HackedThat: Breaking in to a hardened server via the back... by danielcid on Thursday August 25, 2016 @06:45PM (#12363079)
Very fun read. I love following the train of thought and seeing where they "failed".

Also, this Elasticsearch RCE has been patched a while ago and we still see a lot of servers hacked because of it. In fact, there is a DDoS botnet made of only ES servers that we have been tracking.

<unrelated>If you are using Elasticsearch, please patch it!</unrelated>

Re:HackedThat: Breaking in to a hardened server via the back... by blincoln on Friday August 26, 2016 @08:43AM (#12365761)
For aspiring pen testers who read this article, there's an important catch: if the rules of the challenge (or other Inversoft policies, like any bug bounty programmes they may have) didn't specifically allow targeting their other systems, then the author of the blog post could have been prosecuted under e.g. the CFAA.

Always read the list of in-scope systems and rules of engagement before starting. If that information hasn't been provided, then don't start until it has.

Re:HackedThat: Breaking in to a hardened server via the back... by shawkinaw on Thursday August 25, 2016 @06:16PM (#12362921)
Two main lessons for me:

1. Always run services (e.g. ElasticSearch) with a unique user dedicated to that service and nothing else.

2. You're never as secure as you think.

Re:HackedThat: Breaking in to a hardened server via the back... by voidlogic on Thursday August 25, 2016 @10:47PM (#12363990)
>Always run services (e.g. ElasticSearch) with a unique user dedicated to that service and nothing else.

Quick tip; If you do this, you can also make your iptables rules be per user. For example, "webserverUser" can only accept inbound connections on 80/443 and only have outbound connections that are related to established inbound ones. If an attacker gains execution as this user, they cannot download new code, etc or even do DNS lookups for that matter.

Re:HackedThat: Breaking in to a hardened server via the back... by startling on Friday August 26, 2016 @08:27PM (#12370242)
This is totally wrong. Once you have RCE, you can upload code the same way you're executing code.
Re:HackedThat: Breaking in to a hardened server via the back... by breakingcups on Friday August 26, 2016 @05:50AM (#12365225)
Wow, that's great, I never considered doing that. Thanks!
Re:HackedThat: Breaking in to a hardened server via the back... by startling on Friday August 26, 2016 @11:23PM (#12370786)
It's only marginally helpful: it doesn't actually prevent attackers from uploading code to your server.

Instead of having 'nc -l 8080 | bash' or whatever as your payload, an attacker can just run code instead. "pwd > /var/www/html/exfiltration.html". If they absolutely need a shell, they could e.g. alter nginx or its config files to run `bash` on POSTs to a hidden route.

This does make it a little trickier, and potentially a little easier to detect. But it certainly doesn't make it so that "they cannot download new code".

Re:HackedThat: Breaking in to a hardened server via the back... by voidlogic on Monday August 29, 2016 @10:29AM (#12382041)
>This does make it a little trickier, and potentially a little easier to detect.

Correct, I should have said, it eliminates many easy ways to download code. Defense is depth is all about making the attackers job harder and increasing their likelihood of being detected.

Re:HackedThat: Breaking in to a hardened server via the back... by BinaryIdiot on Thursday August 25, 2016 @09:14PM (#12363695)
Ah the fabled one user per service. I try then something weird happens with permissions then I run it as root "temporarily" for development and then 3 years later...oops.

Good thing I don't do dev ops except for my personal projects.

Re:HackedThat: Breaking in to a hardened server via the back... by akx on Friday August 26, 2016 @01:07AM (#12364333)
At that point it's well worth figuring out what has gone awry with permissions rather than executing as root. If nothing else, you'll have added valuable information to your internal knowledge base about that particular permission problem and know how to fix it when it inevitably crops up again.
Re:HackedThat: Breaking in to a hardened server via the back... by BinaryIdiot on Friday August 26, 2016 @03:07AM (#12364732)
Sure but that's much easier to say than to actually do. Sometimes it's not necessarily a permission issue but something missing in a user account. When you're under a tight deadline, especially at a start-up, it's not always easy to say "well I'm just going to keep working on the problem until I fix it" when you can also say "I can fix this in 3 seconds for now and hopefully revisit later".

It's simply reality. I don't enjoy it. Fortunately I've never done that in any type of production environment (just development). But I don't entirely blame people. Many of the infrastructure pieces that need to be deployed can get very complex very quickly.

Re:HackedThat: Breaking in to a hardened server via the back... by mootothemax on Friday August 26, 2016 @06:42AM (#12365362)
>Sure but that's much easier to say than to actually do. Sometimes it's not necessarily a permission issue but something missing in a user account. When you're under a tight deadline, especially at a start-up, it's not always easy to say "well I'm just going to keep working on the problem until I fix it" when you can also say "I can fix this in 3 seconds for now and hopefully revisit later".

I used to be in the same boat as you until I had my lightbulb moment: if you're constantly coming across permission errors like this, it's a sign that you're just doing things wrong.

I don't mean this as an insult; it's more that often when you download, install and provision a new piece of kit, it's easy to do so without taking a few minutes to read the docs and find out the best way of doing things. Especially if you're glancing over e.g. Ubuntu instructions when installing on CentOS.

(in fact, this rule applies to a lot of IT. Spending hours trying to get a CI tool to do X, Y and Z? Chances are it's just not meant to do it that way. God knows how much time I've lost to this.)

Re:HackedThat: Breaking in to a hardened server via the back... by throwaway7767 on Friday August 26, 2016 @07:57AM (#12365567)
Agreed. After a few years of doing these sysadmin tasks "the right way", it doesn't take any longer than the insecure way, as you gain a solid mental model of the various permission structures and you've learned all of the diagnostic tools available to you.

> I don't mean this as an insult; it's more that often when you download, install and provision a new piece of kit, it's easy to do so without taking a few minutes to read the docs and find out the best way of doing things. Especially if you're glancing over e.g. Ubuntu instructions when installing on CentOS.

As a sysadmin, I find software documentation to often be the worst place for deployment advice. It's often written by developers with the same mindset as the GP - just get it working, best-practices can come later (which they never do).

One app per user (and the corollary, proper segmentation between system users) is something you just have to train yourself to do, screw what the developer had in mind with his deployment instructions.

Re:HackedThat: Breaking in to a hardened server via the back... by BinaryIdiot on Friday August 26, 2016 @02:17PM (#12368171)
Oh I certainly agree and fortunately this hasn't happened much to me. But it has happened to myself and many developers I know hence my original comment :)

Though to be fair I've also run into weird bugs with OpenShift, Mongo and a few others over the years so it's not necessarily something wrong that the developer is doing.

Re:HackedThat: Breaking in to a hardened server via the back... by droopyEyelids on Thursday August 25, 2016 @11:18PM (#12364067)
Ahh! this is such fun and accessible problem to troubleshoot
Re:HackedThat: Breaking in to a hardened server via the back... by jwcrux on Friday August 26, 2016 @12:02AM (#12364164)
Always run Elasticsearch behind an auth proxy like nginx or their Shield offering.
Re:HackedThat: Breaking in to a hardened server via the back... by nexxer on Thursday August 25, 2016 @03:24PM (#12361724)
Interesting, but I had to disable images to read through it. Too many distracting and unecessary gifs.
Re:HackedThat: Breaking in to a hardened server via the back... by stephengillie on Thursday August 25, 2016 @08:45PM (#12363562)
The gifs are how the author expressed emotion. I felt they added to the experience of reading the article.
Re:HackedThat: Breaking in to a hardened server via the back... by reitoei on Friday August 26, 2016 @05:19AM (#12365137)
I don't understand why people bother posting personal comments like this.
Re:HackedThat: Breaking in to a hardened server via the back... by ryanlol on Thursday August 25, 2016 @03:25PM (#12361730)
Would've been much easier to just actually hack Linode.

:)

Re:HackedThat: Breaking in to a hardened server via the back... by mjmasn on Thursday August 25, 2016 @03:34PM (#12361810)
This has always been my concern with Linode and other cloud VPS providers. You can secure the server all you want, but you can always get in via a vulnerability in their API or out of band console access. 2FA helps a lot to prevent access to Lish/Glish/Rescue mode console but as shown the API is powerful enough to still be a potential problem if your key gets leaked somehow.
Re:HackedThat: Breaking in to a hardened server via the back... by ryanlol on Thursday August 25, 2016 @04:37PM (#12362286)
Oh, but last I checked lish was an INCREDIBLY (can't emphasise this enough) insecure hack around screen(1)[1] 2FA doesn't help you a bit.

Moral of the story is not to trust your provider. Don't use cloud if you don't need it, don't let your host have your ipmi crdentials, run FDE (this has saved several bitcoin exchanges from losing millions).

[1]. Here's one particularly funny thread from their support forum that perfectly captures exactly how much of a mess this setup was (is? I haven't hacked linode lately): https://forum.linode.com/viewtopic.php?t=3231%3E

Re:HackedThat: Breaking in to a hardened server via the back... by nickpsecurity on Thursday August 25, 2016 @06:26PM (#12362978)
"I put in a support ticket about this back in December 2007." (source: comment in mid-2008)

Usually a bad sign by itself lol...

Re:HackedThat: Breaking in to a hardened server via the back... by nickpsecurity on Thursday August 25, 2016 @06:23PM (#12362965)
My strategy was always going for whatever they trusted the most. Often security or admin-level systems. They usually sucked more than some of the battle-hardened apps they were looking out for. Hilarious that the same principle might have led me to go for Linode, too, instead of the app. Well, also the ROI factor of getting more for my time.
Re:HackedThat: Breaking in to a hardened server via the back... by toyg on Friday August 26, 2016 @06:36AM (#12365340)
So Inversoft got a full pentest for the price of a MacBook. Not bad ;)

Nice read anyway, some important lessons there.

Re:HackedThat: Breaking in to a hardened server via the back... by kstra on Tuesday August 30, 2016 @11:23AM (#12390961)
Awesome read - Congrats to Polynome for a hack well done.

Here is Inversoft's account of the events leading up to the hack and the lessons learned.

HackedThat: Mind the backdoor https://news.ycombinator.com/item?id=12390936

Re:HackedThat: Breaking in to a hardened server via the back... by fapjacks on Thursday August 25, 2016 @05:28PM (#12362658)
I enjoyed the article. It inspired me to participate. However, the Iversoft challenge site has a stupid password policy. Password policies are basically the same thing as just storing them locally in plaintext. Requiring people to perform password gymnastics is the most surefire way to get them to write it down.
Re:HackedThat: Breaking in to a hardened server via the back... by robotdan on Thursday August 25, 2016 @06:31PM (#12363006)
There is probably some truth to this, but I don't know the answer is to allow weak passwords. Every company I've ever worked for enforced some sort of minimum password requirements.

What I do find to be a PITA is when you attempt to create a password that does not meet the minimum rules and the error message gives you no indication of what you need to change to meet the requirement.

Re:HackedThat: Breaking in to a hardened server via the back... by rocqua on Thursday August 25, 2016 @06:40PM (#12363052)
Sure, block the stupidly weak passwords.

But don't block a 6 word diceware phrase because it has not numbers (or because it is to long.... looking at you PAYPAL).

Meanwhile, I'd venture that P@ssword1 meets their requirements...

Re:HackedThat: Breaking in to a hardened server via the back... by robotdan on Thursday August 25, 2016 @09:16PM (#12363702)
fair point.
Re:HackedThat: Breaking in to a hardened server via the back... by newman314 on Thursday August 25, 2016 @06:37PM (#12363037)
Well, the first 3 are ok other than increasing the password length.

Next, they really should be using ed25519 keys if possible. Better, faster and all that good stuff.

Re:HackedThat: Breaking in to a hardened server via the back... by mavhc on Friday August 26, 2016 @04:20PM (#12369033)
Is writing down your password a bad thing? Reduces the attack surface from 510.1 million km² to 5 m²
Re:HackedThat: Breaking in to a hardened server via the back... by jwcrux on Thursday August 25, 2016 @06:50PM (#12363099)
Wow - fantastic work! I'm glad the ES article came in handy for you ;)

I can almost promise you that if you could reach the external ES instance and exploit it - it was already exploited. They need to wipe that box and rebuild.

Overall, great writeup - thanks for sharing!

Re:HackedThat: Breaking in to a hardened server via the back... by dizrupt on Friday August 26, 2016 @05:19AM (#12365134)
I have not read any hacked that blogs more intently than this one... wow. Slow Claps
Re:HackedThat: Breaking in to a hardened server via the back... by maristotle on Friday August 26, 2016 @05:00AM (#12365057)
I would love to see a screen share video of this. Can you make that happen possibly?
Re:HackedThat: Breaking in to a hardened server via the back... by YPCrumble on Friday August 26, 2016 @02:45PM (#12368369)
Could two factor authentication have stopped the hacker from exploiting the Elasticsearch vulnerability or from implementing the final "Smash and Grab" strategy?
Re:HackedThat: Breaking in to a hardened server via the back... by haser_au on Thursday August 25, 2016 @07:34PM (#12363298)
Really interesting read, well written. Congrats to you and your team.
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Thursday August 25, 2016 @03:21PM (#12361696)
This is a great article. Unfortunately, it's littered with a bunch of animated garbage that's super distracting and adds absolutely nothing of value. Please fix.
Re:HackedThat: Breaking in to a hardened server via the back... by titanomachy on Thursday August 25, 2016 @04:41PM (#12362317)
Yeah, the constant motion made it hard to focus on the text. The only way I could finish the article was by running this command in Chrome web dev tools:

$$('img').forEach((i) => i.hidden = true)

Re:HackedThat: Breaking in to a hardened server via the back... by ythl on Thursday August 25, 2016 @05:57PM (#12362816)
Wow, neat. Is `$$` some kind of jQuery-esque service that Chrome provides?
Re:HackedThat: Breaking in to a hardened server via the back... by sslalready on Thursday August 25, 2016 @06:12PM (#12362895)
It's part of the Command Line API which most browsers implement in their dev consoles. http://getfirebug.com/wiki/index.php/Command_Line_API
Re:HackedThat: Breaking in to a hardened server via the back... by titanomachy on Friday August 26, 2016 @11:12PM (#12370763)
It's actually just an alias for document.querySelectAll, so kind of like a very minimalist, modern-web jQuery.
Re:HackedThat: Breaking in to a hardened server via the back... by beisner on Thursday August 25, 2016 @04:21PM (#12362163)
I think you'll start to see more and more of this style of including poignant (if somewhat exaggerated) gifs in informal posts. In most colleges in the US, this is the de-facto format for email communication from student to student. I've started to see the inclusion of reaction gifs and other memes creep into the corporate world (I've worked at 2 of the Big Four tech companies, and I can't remember a design review or informal presentation that didn't include funny gifs). I personally think it helps keep the reader engaged, although that might be because I'm so used to it now.
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Friday August 26, 2016 @02:39PM (#12368317)
Worth considering whether "poignant" is the word you want there. It denotes something evocative of sadness or regret, and derives from a root which means "to prick". So, that pricking sensation around your eyes when you feel yourself on the point of tears? Something which evokes that feeling, and that sensation, is accurately described as "poignant".

(Also possibly of interest is that "pungent" derives from the same root, for much the same reason. In this case, the pricking sensation is that caused by the irritating sulfoxides released when you cut up an onion.)

Re:HackedThat: Breaking in to a hardened server via the back... by beisner on Saturday August 27, 2016 @01:09AM (#12371110)
Huh. What a feeling, finding out that you've been using a word totally incorrectly for your entire life! I guess I was going for something more along the lines of "punctuating" or "relevant".
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Saturday August 27, 2016 @08:10AM (#12372009)
I know that feeling! I read a lot as a kid, and I'd pick up words from context but not get their meanings right, and that got embarrassing. So I talked my folks into getting me the biggest, meanest dictionary they could lay hands on, in order to avoid embarrassing myself further. Little did I know this would lead me down a path of linguistic pedantry from which I'd never be able to return.

Was the word you were after perhaps 'pertinent'?

Re:HackedThat: Breaking in to a hardened server via the back... by barbs on Thursday August 25, 2016 @06:29PM (#12362995)
Browser extension idea - gif freeze. Pauses all gifs by default.
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Thursday August 25, 2016 @07:08PM (#12363184)
Used to be in Firefox you could hit Escape after load to do that. Not any more. There's an extension to add it back, but it's too flaky to work well. So it goes.
Re:HackedThat: Breaking in to a hardened server via the back... by dmckeon on Friday August 26, 2016 @01:36AM (#12364423)
For Firefox:

user_pref("image.animation_mode", "once");

Re:HackedThat: Breaking in to a hardened server via the back... by whorleater on Thursday August 25, 2016 @08:39PM (#12363545)
Re:HackedThat: Breaking in to a hardened server via the back... by JonnieCache on Friday August 26, 2016 @06:16AM (#12365291)
For me the gifs only play during mouseover, with a ~300ms delay. I didn't notice them at all.
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Friday August 26, 2016 @02:41PM (#12368328)
That's new since I read the article, and an enormous qualitative improvement. Kudos to the author for a quick, thoughtful bugfix!
Re:HackedThat: Breaking in to a hardened server via the back... by robotdan on Thursday August 25, 2016 @03:29PM (#12361759)
Even Blue Steel?! :-)
Re:HackedThat: Breaking in to a hardened server via the back... by frahs on Thursday August 25, 2016 @04:11PM (#12362095)
For what it's worth, I though the gifs were funny and liked them. But there's the whole tradeoff of adding extra clutter.

I a few GIFs can definitely split up the article a bit and make it easier to read, but too many can also be distracting.

Re:HackedThat: Breaking in to a hardened server via the back... by mkorsak on Thursday August 25, 2016 @04:12PM (#12362104)
The Blue Steel has to stay
Re:HackedThat: Breaking in to a hardened server via the back... by throwanem on Thursday August 25, 2016 @03:35PM (#12361819)
Even Blue Steel. (What's a Blue Steel?)
Re:HackedThat: Breaking in to a hardened server via the back... by robotdan on Thursday August 25, 2016 @03:40PM (#12361853)
The first gif on that page, Derek Zoolander's famous look. http://www.urbandictionary.com/define.php?term=blue%20steel
Re:HackedThat: Breaking in to a hardened server via the back... by coredog64 on Thursday August 25, 2016 @07:54PM (#12363372)
Maybe I'm taking crazy pills, but that looked more like a Ferrari or LeTigre to me.
Re:HackedThat: Breaking in to a hardened server via the back... by Intermernet on Friday August 26, 2016 @08:03AM (#12365588)
You may be loco, but probably LeTigre. Definitely not Magnum though.
Re:HackedThat: Breaking in to a hardened server via the back... by robotdan on Thursday August 25, 2016 @09:17PM (#12363711)
Ha - you could be right. I may have jumped to a conclusion.
Re:HackedThat: Breaking in to a hardened server via the back... by ShinyCyril on Friday August 26, 2016 @03:57AM (#12364882)
It worries me how it's suddenly become acceptable to have 1MB+ pages (6.2MB in this case).