News for hackers. Stuff that matters.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by danesparza on Wednesday July 27, 2016 @09:24AM (#12172492)
This has been covered elsewhere (like on serverfault: http://serverfault.com/a/107346/2557 )

But it comes down to:

- Take existing server down immediately. I'm assuming it is not on an isolated network -- so this should really be a priority.

- Prep a new patched server (with a smaller attack surface and updated security credentials)

- Postmortem the old box on an isolated network. Try to understand how the attacker got in. If necessary, get security professionals involved.

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by emcrazyone on Wednesday July 27, 2016 @02:38PM (#12175435)
100% agree. Disclaimer I own a data center and have dealt with customer collocated equipment breaches. In addition to the above steps:

-> disable root being able to login inside your sshd_config file. Make sure PermitRootLogin no

-> rename the root account too so if they are using an exploit based on user authentication then perhaps they won't be able to elevate to root.

-> disable password based logins and go to cert based auth. This will shutdown brute force attacks.

-> lower MaxAuthTries in sshd_config to something like 1 or 2 to help slow down attackers.

-> change the port you listen on. A little security through obscurity while not very effective might slow future casual port scanners that are testing a single port. In practice I've seen this really eliminate a lot of reconnaissance or farming type activities.

-> Make sure you're openssl and openssh are at the latest stable releases.

-> If the perp is coming from the same IP, you can use an iptables rule to block the netblock. Again, not perfect but may help slow things down.

-> grab shell history of all the user accounts on the box. Example ~/.bash_history. This is more reconnaissance but may be helpful if they are sloppy - you might see what they were doing on the box.

-> look for any modified files or new ones. Obviously logs will show up in the list but you're looking for things that should not be there. Example: find / * -mtime -60 -print where 60 is how many days ago you want to go back.

-> look at chron file to see if any timed delay bombs exist.

-> look at ps -aux output for any running processes that don't make sense

-> look at iptraf for any suspicious traffic to IPs you can't reconcile.

Good luck!

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by eonw on Wednesday July 27, 2016 @04:42PM (#12176363)
just a note: intelligent exploiters hide their files inside of yours, so the -mtime is useless in many cases, they will set the mtime of their upload to match the rest of the folder they hide in.

command history is also easy to alter if you know what you are doing.

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by porker on Wednesday July 27, 2016 @05:34PM (#12176682)
So the only way to detect exploits is to scan the server regularly and log the mtime and the file size, and look for changed files that shouldn't have changed?

Re the command history, is there any way around them wiping it - e.g. piping all .bash_history entries to an append-only store?

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by spdustin on Wednesday July 27, 2016 @05:45PM (#12176743)
RootKit Hunter [0] works pretty well on most distros to check hashes on files and other potential problems.

You can also use a global bash configuration that would log all commands [1] entered into any bash shell to a central log, which could be shipped off-server simultaneously.

[0]: http://rkhunter.sourceforge.net

[1]: http://askubuntu.com/questions/93566/how-to-log-all-bash-com...

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by uxp on Wednesday July 27, 2016 @05:56PM (#12176804)
Does RKHunter scan userspace for mtimes? I haven't used it in years, so I'm honestly curious. Back when I did, it was customary to install it side-by-side with Tripwire, which essentially does only that; scan userspace and categorically log changed files based on a configurable severity depending on location (eg, /root/ is high, /var/log/messages is low)
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by spdustin on Wednesday July 27, 2016 @07:17PM (#12177221)
They really serve two different functions. Tripwire and similar tools like aide (I use aide now rather than tripwire, but that's my personal preference, I'm not an infosec domain expert) are file integrity checkers that check files for property changes (including mtime). Tuning out false alarms can result in an admin just turning off the reporting functions of the tools, that's the downside as I understand it.

However, rkhunter has additional logic to specifically seek out rootkits and malware-like behavior, and is more specifically targeted to system file modifications. Combining it with unhide (to compare actual processes running with those visible from userspace) provides a reasonable assurance that nothing nefarious is going on.

They're all part of a spectrum, however. I use scanners like aide alongside rkhunter as well, but I'm the sort of guy that will spend a day tuning the config of aide to avoid constant false alarms.

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by emcrazyone on Thursday July 28, 2016 @01:10AM (#12178427)
yes, excellent point, agree. I run the scan regardless in case I'm dealing with the non-intelligent exploiter type ;)
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by eonw on Thursday July 28, 2016 @05:06PM (#12183166)
good point as well. might as well run every bit of security you can, helps stop the "script kiddies" and lower quality automated stuff.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by scoot on Wednesday July 27, 2016 @06:37PM (#12177004)
> Disclaimer I own a data center

I'm curious why you think owning a DC makes you less qualified to respond? Presumably because someone that senior is less in touch with day-to-day security operations?

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by morninj on Wednesday July 27, 2016 @08:47PM (#12177641)
The "disclaimer" prologue is often humble bragging. It's often less about flagging a conflict of interest and more about claiming to have authority or status.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by scoot on Thursday July 28, 2016 @09:52AM (#12180165)
That would be a "disclosure".
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by rahimnathwani on Wednesday July 27, 2016 @06:42PM (#12177031)
I think they meant 'disclosure'
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by scoot on Wednesday July 27, 2016 @06:51PM (#12177071)
Possibly, but that would suggest a conflict of interest which is apparent here. More of an appeal to authority perhaps?
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by VikingCoder on Wednesday July 27, 2016 @04:20PM (#12176195)
...it's a Windows box.

(Just kidding.)

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by sredfern2 on Wednesday July 27, 2016 @06:59PM (#12177112)
:-)
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by talideon on Wednesday July 27, 2016 @10:32AM (#12173067)
Also, you thank the reporter profusely for doing the right thing.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by dleslie on Wednesday July 27, 2016 @11:15AM (#12173475)
Ask for a BTC address and send a tip.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by NTripleOne on Wednesday July 27, 2016 @11:17AM (#12173498)
Alternatively, ask them for their preferred payment method and don't force your FOTMcoin on them.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by Mahn on Wednesday July 27, 2016 @11:26AM (#12173571)
I assume he suggested Bitcoin because it's still a good way to handle money anonymously. If the person that breached the server wants to remain anonymous but get paid, that's pretty much the only way to go.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by bduerst on Wednesday July 27, 2016 @05:56PM (#12176802)
Except for the fact that the transaction becomes a permanently public record.

You could also get looped into tax evasion if the person you paid doesn't report the bug bounty income. You can still maintain anonymity by not announcing the person who found it, but it's not a good idea to give money to anonymous people for work.

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by ChristianBundy on Wednesday July 27, 2016 @11:34AM (#12173638)
I assume he suggested asking them because Bitcoin isn't the only cryptocurrency.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by um_ya on Wednesday July 27, 2016 @12:39PM (#12174291)
I'm pretty sure the hacker won't want dogecoin or forked coin.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by raverbashing on Wednesday July 27, 2016 @12:55PM (#12174447)
Oh I don't know, depending on the person they might want some fringe criptocurrency that they swear is the best (for non-economic reasons)
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by tokenizerrr on Wednesday July 27, 2016 @11:59AM (#12173901)
Bitcoin is flavor of the month now? Do we live on the same planet?
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by 0xdeadbeefbabe on Wednesday July 27, 2016 @01:45PM (#12174948)
If only the planet weren't so big.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by dbloom on Wednesday July 27, 2016 @03:45PM (#12175927)
If you're sending an even slightly significant amount of money, there are potential tax implications too. You might need to do a 1099.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by fapjacks on Wednesday July 27, 2016 @11:39PM (#12178183)
Haha! I don't know how you intended your comment, but I just had a funny thought of filling out a 1099 for blackmail.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by ascendantlogic on Wednesday July 27, 2016 @11:10AM (#12173420)
If the box is on AWS, make sure to make an AMI snapshot of it for later postmortem. Also create a security group just for boxes built using that AMI that specifically only allows the minimum amount of access required to do the postmortem.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by LoSboccacc on Wednesday July 27, 2016 @09:31AM (#12172547)
also remember to do the same on every server that could be reached by sharing the same credentials or having the same vulnerability once discovered, and at the end of the process trigger password change for every user if applicable
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by dpina on Wednesday July 27, 2016 @09:52AM (#12172722)
Also, wipe clean the existing server after the Postmortem. Even if fairly sure that the server can be cleaned it's never safe to re-use a box which was compromised.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by joobus on Wednesday July 27, 2016 @10:02AM (#12172816)
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by zaroth on Wednesday July 27, 2016 @10:15AM (#12172917)
"You mean like, with a cloth or something?"
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by BraveNewCurency on Wednesday July 27, 2016 @03:37PM (#12175873)
No, using a towel could lead to contamination. Use a disposable paper towel. Also, Security Experts (TM) have not proven that Windex helps, but I'd use it just in case.
Re:Ask HN: Anonymous person sent proof of SSH access to our ... by drzaiusapelord on Wednesday July 27, 2016 @03:13PM (#12175700)
Great advice, I'd also add a couple more things about checking the desktop environment because its much more likely a windows or osx box was compromised and keys stolen or keystrokes captured than someone brute-forcing sshd or finding some sshd zero-day.

The few times we've been in this position, its always been someone's desktop that's been compromised. If you don't have a strong desktop security policy, a UTM, traffic inspection, key encryption policy, etc and you store keys or passwords locally, then this becomes a risk.

Re:Ask HN: Anonymous person sent proof of SSH access to our ... by zpallin on Wednesday July 27, 2016 @05:28PM (#12176641)
You still don't know how they got in, and since they're not doing anything nefarious (that OP knows of) it's probably easier to pay them off to inform OP how they got in.