News for hackers. Stuff that matters.
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Tuesday September 19, 2017 @06:03PM (#15289218)
I've been using something similar for a while now. I use pam_jail on freebsd to drop the ankle biters using common ssh login attempts like test, ubuntu, oracle etc into a FreeBSD jail where I watch what the do and get a copy of all their tools. I rate limit the outgoing traffic from that jail to something painfully slow to prevent them from causing any major issues. But being able to fire up 'watch' on freebsd and snoop the tty they are on in the jail is awesome for forensics.

It's secure, they can't break out of the jail.

It's rate limited to prevent them causing much damage to anyone.

It's easy to observe every thing they type and do in the jail from the host.

Re:Learn from your attackers – SSH HoneyPot by snuxoll on Tuesday September 19, 2017 @06:36PM (#15289401)
That's...pretty awesome. Have any guides/blog posts/whatever on your setup?
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Tuesday September 19, 2017 @09:07PM (#15290013)
I don't. When I was setting this up I didn't find any guides or blogs about doing this so I thought it was not of interest to anyone. So I just went about implementing it a piece at a time. Installing pam_jail, then getting /etc/pam.d/sshd configured to use it (which is a one-line addition, very easy). Now by default pam_jail simply puts the user into a jail of their home directory. This is where you can go a few routes with this. If simply jailing the user on the host OS to their home directory is all you are interested in doing you can stop there. Configure FreeBSD to not allow users to see other processes, user processes and group processes not owned by them, and they won't know anyone else is on the system.

security.bsd.see_other_gids

security.bsd.see_other_uids

The above are the two sysctl's you want to enable.

A simple ps will show you all the shells that are in a jail.

Tue 19 7:19PM priyanka.setecastronomy ~> ps -x

PID TT STAT TIME COMMAND

30308 - S 0:00.05 sshd: oracle@pts/0 (sshd)

Now you have the tty he/she is on (pts/0). There are many ways to get that including ps so use whatever method you prefer to get the tty.

Fire up watch to snoop on the tty.

Tue 19 7:48PM priyanka.setecastronomy ~> doas watch pts/0

And boom, you can watch the ankle biter do his/her thing.

You can do this on the host as described, because that is how pam_jail works. But if you prefer for some reason to make an actual jail with VNET etc and do this simply forward ssh on the host to the jail's IP. If you do rate limiting you will already be configuring pf or ipfw anyway so an extra line to forward 22 to the jail host is not big deal.

Yeah this is a crappy write-up but it's spur of the moment and in a HN reply post so it's worth the price paid.

I'm happy to answer questions or help you if you get stuck anyway I can just message me. It's pretty simple to do.

If this is in a corporate setting I would consult with legal before doing this. The world is a whacky place these days, and if the ankle biter does something evil from your honeypot jail you may be liable.

Re:Learn from your attackers – SSH HoneyPot by artursapek on Tuesday September 19, 2017 @09:52PM (#15290151)
You know what would be cool? Piping these sessions to a web frontend and letting people watch these attempts in real time (or recorded) using a JS terminal emulator to display it all.

I would sit there and watch that.

Re:Learn from your attackers – SSH HoneyPot by dotancohen on Wednesday September 20, 2017 @07:25AM (#15292519)
I would pipe it to an LCD in an old fish tank.

Oh, look honey, this one's trying to use GNU options! Here's one who thinks he's on Ubuntu! Wow, I didn't know VIM could do _that_!

Re:Learn from your attackers – SSH HoneyPot by nl5874 on Thursday September 21, 2017 @11:51AM (#15304670)
Take a look at http://honeycast.io/#!/0f9465db-3c01-49ba-9d81-16b1fd68627c. We are working on a new version of our honeypot software. The feature you mention will be supported.
Re:Learn from your attackers – SSH HoneyPot by artursapek on Thursday September 21, 2017 @06:20PM (#15307838)
Wow, everything I think of already exists. Nice.
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Tuesday September 19, 2017 @10:06PM (#15290222)
That would be pretty cool!
Re:Learn from your attackers – SSH HoneyPot by askz on Wednesday September 20, 2017 @04:21AM (#15291684)
Neat! I'd love to help!
Re:Learn from your attackers – SSH HoneyPot by clan on Wednesday September 20, 2017 @09:16AM (#15293365)
Miss World 2000 has "Too many secrets"...

Love those references. If you have not seen it yet go watch Sneakers (1992). I am getting old - I remember when it was fresh :-)

Re:Learn from your attackers – SSH HoneyPot by samstave on Tuesday September 19, 2017 @10:11PM (#15290241)
This is great and should be something everyone should know how to do. Please write a more formal write-up
Re:Learn from your attackers – SSH HoneyPot by corybrown on Tuesday September 19, 2017 @06:28PM (#15289358)
What have you seen them do?
Re:Learn from your attackers – SSH HoneyPot by ConfucianNardin on Wednesday September 20, 2017 @08:36AM (#15293007)
Might have changed by now, but what they used to do was usually:

* Download a large file (e.g. XP SP3) from Microsofts servers to test bandwidth * Download IP scanners and trying to run them (in order to find new hosts to attack) * Download botnet code that connects to some C2 server

Tools they download were often downloaded as source, which they then tried to compile in order to run it.

Searching for e.g. 'youtube kippo' will get you videos of honeypot sessions.

Re:Learn from your attackers – SSH HoneyPot by samstave on Tuesday September 19, 2017 @10:12PM (#15290244)
Attempt to log in it would seem...
Re:Learn from your attackers – SSH HoneyPot by rrttt on Wednesday September 20, 2017 @09:43AM (#15293599)
You should still be rather careful with this, as they have access to the same kernel as the host, and could potentially jailbreak through kernel vulnerabilities.
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Wednesday September 20, 2017 @10:30AM (#15294114)
I have enough confidence in FreeBSD jails to not worry about that. If I found someone who could actually break out of a jail I would at the least buy them dinner anywhere, their choice. You can't modify a running kernel by direct access. And you can't load modules. So it would be a very interesting hack to see.
Re:Learn from your attackers – SSH HoneyPot by rrttt on Wednesday September 20, 2017 @01:41PM (#15296349)
It's been done before, for example the "BadIRET" vulnerability (CVE-2015-5675) was used to jailbreak FreeBSD on the PS4 a couple of years ago.
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Wednesday September 20, 2017 @10:08PM (#15300051)
Actually it hasn't been done before. That CVE required elevated privelages on the host already. They didn't break out of a jail.
Re:Learn from your attackers – SSH HoneyPot by rrttt on Thursday September 21, 2017 @08:25AM (#15302608)
They did break out of a jail, the vulnerability was used to gain arbitrary code execution in kernel mode, which was used to modify the cr_prison structure, thus performing a jailbreak.
Re:Learn from your attackers – SSH HoneyPot by X86BSD on Friday September 22, 2017 @12:27PM (#15313571)
Again, they already had elevated or root privs. If you've already got root privs nothing will save you.
Re:Learn from your attackers – SSH HoneyPot by rrttt on Monday September 25, 2017 @02:03PM (#15332581)
They had root inside a jail, which isn't the same as being root outside the jail. To be able to gain arbitrary code execution in kernel mode from a jail is a security vulnerability.
Re:Learn from your attackers – SSH HoneyPot by aeontech on Tuesday September 19, 2017 @07:10PM (#15289535)
Would love to read more about this setup, if you have it documented anywhere
Re:Learn from your attackers – SSH HoneyPot by thomasvendetta on Tuesday September 19, 2017 @09:06PM (#15290008)
I too would love to hear more about this, unfortunately this article on FreeBSD Jail Management Tools [1] seemed to be the most relevant thing I could come up with.

[1] https://blather.michaelwlucas.com/archives/2291

Re:Learn from your attackers – SSH HoneyPot by bochoh on Tuesday September 19, 2017 @08:32PM (#15289878)
Would also love to see a write-up on this.