News for hackers. Stuff that matters.
Re:Learn from your attackers – SSH HoneyPot by otakucode on Tuesday September 19, 2017 @05:53PM (#15289158)
If one were to run a honeypot like this and take every IP which connects and attempts a login and immediately ban it from your network, then if more than 1% of the IP range they are in has been banned, ban the entire range... what would the expected outcome be for a typical residential user?
Re:Learn from your attackers – SSH HoneyPot by thaumaturgy on Tuesday September 19, 2017 @07:02PM (#15289510)
I've been doing something similar to this for years on a mail server that hosts all of my mail as well as a number of customers. Contrary to the other replies, it's worked out really well, and you can rely on customers to complain pretty quickly if anything's not working right.

The bulk of the abuse comes from Russian and Chinese networks, with Brazil working hard to catch up. Those can be pretty well perma-banned without consequence. Under "folks that should be fined into oblivion", there's cogentco.com, quadranet.com, colocrossing.com, level3.com, vpls.com, softlayer.com, hostingsolutionsinternational.com, datashack.net, singlehop.com, actonsoftware.com, and a whole raft of others.

The secret sauce is a carefully tuned ban decay function that scales up with the number of abuses. Occasional hits get a network banned for an hour or less, subsequent hits get them banned a little longer, and then there's a fine line where the function goes exponential, all the way up to 6-month-plus ban periods for really big nuisances.

Otherwise it's just fail2ban on some logs and some home-brew code that does whois lookups on nuisance IPs and some data mining on the whois response.

Re:Learn from your attackers – SSH HoneyPot by forinti on Tuesday September 19, 2017 @07:55PM (#15289715)
I run a Brazilian site and the latest attack came from Europe (France and Bulgaria). I get a lot from the US and China as well.

As we are really only interesting in our state, I don't think twice about banning international IPs and they are mostly from large datacentres.

Re:Learn from your attackers – SSH HoneyPot by noir_lord on Tuesday September 19, 2017 @07:26PM (#15289616)
I can't ban China as our suppliers at work are partly -Chinese, it's a royal PITA, I can't even whitelist them as they have to bound around VPN's just to get around the Great Firewall of China on their end.
Re:Learn from your attackers – SSH HoneyPot by yorwba on Tuesday September 19, 2017 @08:22PM (#15289840)
If your suppliers use VPNs anyway, you can absolutely ban Chinese IPs without much consequence for them. However, if it's for a user-facing site, please don't just ban all of China. After relocating, I was quite annoyed by the number of websites that are unavailable not because they are blocked by the Great Firewall, but because they banned all of China and VPNs to stop the abuse they saw from some IPs in those ranges.
Re:Learn from your attackers – SSH HoneyPot by yeukhon on Tuesday September 19, 2017 @11:53PM (#15290688)
The problem is VPN is now banned unless it's recognized by the state (must be registered). You can still try to use the underground VPN, but not guaranteed. The GFC knows everything in and out. It is one of the most acclaimed and sophisticated closed source networking system in the world. They can toggle on and off in matters of minutes. They have a huge work force monitoring their internet and censoring speech in no time.

Of course the Chinese government are aware of existing circumvention, but they still allowed them because they want to capture data. They let these circumvention to exist even though they have the brightest engineers in China working for them. I vaguely remember a talk from RealCrypto a number of years ago, someone presented how one could try to escape GFC by sending data over different protocols and then resemble by the recipient. It's an ingenious circumvention that is quite hard to decipher, until someone recognizes a traffic pattern, then Chinese government knows.

Re:Learn from your attackers – SSH HoneyPot by meZee on Wednesday September 20, 2017 @06:30AM (#15292218)
Not sure if same protocol, but iirc Dust (https://github.com/blanu/Dust) was supposed to accomplish this. Created by Brandon Wiley co-founder of freenet.
Re:Learn from your attackers – SSH HoneyPot by noir_lord on Tuesday September 19, 2017 @10:05PM (#15290216)
If they consistently used VPN's I would but it seems to be intermittent since the GFWoC is a fickle thing.
Re:Learn from your attackers – SSH HoneyPot by askz on Wednesday September 20, 2017 @04:15AM (#15291668)
You can ask a friend to setup a vpn at home with his traditional ISP
Re:Learn from your attackers – SSH HoneyPot by Zetaphor on Tuesday September 19, 2017 @08:41PM (#15289904)
Would you be interested in open sourcing that?
Re:Learn from your attackers – SSH HoneyPot by askz on Wednesday September 20, 2017 @04:16AM (#15291671)
Yup, would be great!
Re:Learn from your attackers – SSH HoneyPot by hueving on Wednesday September 20, 2017 @01:50AM (#15291136)
> Under "folks that should be fined into oblivion", there's cogentco.com, quadranet.com, colocrossing.com, level3.com, vpls.com, softlayer.com, hostingsolutionsinternational.com, datashack.net, singlehop.com, actonsoftware.com, and a whole raft of others.

What do you mean these should be fined? Level3 is a transit provider for massive portions of traffic on the Internet and Softlayer has some hundred thousand servers.

Re:Learn from your attackers – SSH HoneyPot by unixhero on Wednesday September 20, 2017 @05:16AM (#15291895)
He means that is the host range he saw the most attacks from. Deduction then takes his argument to the understanding that many attackers use Level3 and Softlayer for attacking purposes.
Re:Learn from your attackers – SSH HoneyPot by user5994461 on Wednesday September 20, 2017 @06:20PM (#15298851)
IBM SoftLayer is a reputable cloud as far as I am concerned, just like AWS and Digital Ocean. I've seen and banned a few of the other names given, after concluding that they exclusively provide spam and malicious servers.
Re:Learn from your attackers – SSH HoneyPot by justinsaccount on Tuesday September 19, 2017 @06:21PM (#15289317)
I do this sort of thing, but I'm listening on a few /16s.

1% is a pretty low threshold. There are some v4 networks out there that are complete garbage.. If I was going to do something like that I'd start at closer to 90%.. 230 hosts on a /24.

  $ select subnet, count(distinct(cidr)) as unique_sources from (select set_masklen(cidr,16) as subnet, cidr from stuff where why like 'SSH%' and added > '2017-08-01') as foo group by subnet order by unique_sources desc limit 20;
       subnet     | unique_sources
  ----------------+----------------
   181.211.0.0/16 |          11688
   190.214.0.0/16 |           8486
   31.162.0.0/16  |           8454
   181.196.0.0/16 |           7994
   181.113.0.0/16 |           7892
   188.16.0.0/16  |           7294
   94.51.0.0/16   |           6384
   188.19.0.0/16  |           6077
   31.163.0.0/16  |           5905
   178.47.0.0/16  |           5788
   201.178.0.0/16 |           5620
   190.48.0.0/16  |           5179
   188.17.0.0/16  |           4893
   201.179.0.0/16 |           4812
   188.18.0.0/16  |           4266
   186.178.0.0/16 |           4208
   5.141.0.0/16   |           4203
   186.129.0.0/16 |           3858
   181.112.0.0/16 |           3836
   190.174.0.0/16 |           3836
I think some of those networks are using CGN and have a much smaller number of actually compromised hosts.. ISPs generally just don't give a shit about security.
Re:Learn from your attackers – SSH HoneyPot by otakucode on Tuesday September 19, 2017 @08:33PM (#15289883)
I don't see why a residential user should be worried about residential users from other ISPs being able to reach their machine usually. I suppose it would be problematic for torrenting and maybe gaming (depending on architecture of the game). But I imagine my grandmother couldn't care less if some other grandmother couldn't connect to her network directly.

90% seems really high... you'd really wait until 230 of 255 possible hosts have attempted a breakin before deciding they were on a network too dangerous to preserve your accessibility from? Are there a lot of networks where 90% of the boxes are launching attacks, but 10% have legitimate need to connect to your personal home machine?

Re:Learn from your attackers – SSH HoneyPot by jaytaylor on Tuesday September 19, 2017 @09:42PM (#15290114)
It's problematic because plenty of people host websites and other network services on their own infrastructure at home / work, all in the residential IP space.
Re:Learn from your attackers – SSH HoneyPot by hueving on Wednesday September 20, 2017 @01:53AM (#15291145)
If you don't care about ingress connections, then you don't need blocklists anyway. You just keep everything behind NAT or a stateful firewall.
Re:Learn from your attackers – SSH HoneyPot by bcoates on Tuesday September 19, 2017 @06:32PM (#15289385)
You may as well just block LACNIC IPs wholesale and save the trouble at this point
Re:Learn from your attackers – SSH HoneyPot by bcoates on Tuesday September 19, 2017 @06:10PM (#15289258)
You'd be unreachable from cloud providers, major public hotspots, residential ISPs, and countries that use carrier grade NAT to stick all their traffic on one IP or one range.
Re:Learn from your attackers – SSH HoneyPot by otakucode on Tuesday September 19, 2017 @08:39PM (#15289898)
Hmm, I hadn't thought about cloud providers. Public hotspots, residential ISPs, and countries behind firewalls aren't really something I expect most home users really need their home network to be accessed by. But blocking connections from cloud providers would be unworkable. I suppose lots of automated SSH attacks would be coming from cloud providers... maybe there are few enough they could be whitelisted?
Re:Learn from your attackers – SSH HoneyPot by artursapek on Tuesday September 19, 2017 @09:47PM (#15290132)
With cloud providers it's likely a "bad" IP will eventually get re-assigned to a "good" customer whom you don't want to block. That's why an exponentially increasing ban is generally a good idea, I think. The more abuse you get from a given IP address the longer you ban it each time. If it's use for a one-time attack and thrown away, you forgive it relatively quickly.
Re:Learn from your attackers – SSH HoneyPot by user5994461 on Wednesday September 20, 2017 @06:25PM (#15298890)
From experience, there are two kind of cloud providers. The normal ones like AWS, OVH and Digital Ocean. And the shady ones.

The first one don't attack much of anything, there is the occasional spider that tries to index your website (we had data worth scraping). The later can be banned by entire AS without issues.

Re:Learn from your attackers – SSH HoneyPot by ryanlol on Tuesday September 19, 2017 @08:52PM (#15289952)
>what would the expected outcome be for a typical residential user?

Wasted time for precisely zero benefit.

There are lots of hobbyists that'll tell you otherwise, but in reality you should be using key auth and worrying about better things.

Re:Learn from your attackers – SSH HoneyPot by bitbang on Tuesday September 19, 2017 @11:09PM (#15290480)
Fwknop is a much better solution than whack-a-mole blacklisting or even Fail2Ban.

https://github.com/mrash/fwknop

Re:Learn from your attackers – SSH HoneyPot by merb on Tuesday September 19, 2017 @06:07PM (#15289237)
in my first years I've setup a ssh server behind a nat'd network and installed fail2ban. the outcome was that nobody could access the ssh server... probably the same thing would happen, on ssh I've seen so many login attemts even on the smallest VPS I've ever gotten, it's just ridicoulus and important to use non password authentication with ssh (i.e. rsa keys probably 4096b).
Re:Learn from your attackers – SSH HoneyPot by noir_lord on Tuesday September 19, 2017 @07:31PM (#15289646)
Literally the first thing I do on any new machine is disable password logins, disable root logins and then punt the SSH port to the top of the range (usually 47999).

Every remote machine gets it's own keypair as well and links between machines also get their own key-pairs (key handling is PITA, I've yet to find a method I really like), Keys for work stuff are back up on multiple LUKS memory sticks (two in separate safes, two offsite).

I'm fortunate in that work machines are in the pet category not cattle category so we don't need to change keys that frequently (though I will rotate them out yearly anyway).

Re:Learn from your attackers – SSH HoneyPot by jaytaylor on Tuesday September 19, 2017 @09:44PM (#15290124)
Friendly advice..

It might be better not to disclose this level of detail about your professional security practices, especially when there is a trail of breadcrumbs in the HN profile on your account..

Re:Learn from your attackers – SSH HoneyPot by noir_lord on Tuesday September 19, 2017 @10:04PM (#15290211)
Shrug, given how hostile the internet is I fail to see how this increases the risk at all.
Re:Learn from your attackers – SSH HoneyPot by rimliu on Wednesday September 20, 2017 @05:31AM (#15291959)
Yeah, I am not so sure how knowing that keys are rotated helps the wannabe attacker. The only "useful" bit would be to look for SSH port up in the range, not much help though.
Re:Learn from your attackers – SSH HoneyPot by noir_lord on Wednesday September 20, 2017 @03:33PM (#15297418)
My attitude is short of you having the SSH keys if I can't tell my entire setup and still be secure then I'm relying on obscurity not security.
Re:Learn from your attackers – SSH HoneyPot by z29LiTp5qUC30n on Wednesday September 20, 2017 @10:40AM (#15294241)
If you do it right it doesn't matter.

The default ip(6)tables rule: drop all packets

For example to access my least secured public facing server you need to do the following: 17 port port-knocking to enable crypto port knocking Which enables ssh Which requires a 16K RSA key and TOTP The only accounts that can be logged in have 18 character randomly generated usernames and 255 character passwords. The login accounts have no access to administrative functions. So you'll need to su to an administrative account and guess the 255 character password or have a zero day exploit that can bypass SELinux and cryptographically signed white-listing of binaries.

Re:Learn from your attackers – SSH HoneyPot by callesgg on Tuesday September 19, 2017 @06:49PM (#15289451)
Just alter the ssh port, i have never received a ssh connection that i can not personally account for.
Re:Learn from your attackers – SSH HoneyPot by pilsetnieks on Tuesday September 19, 2017 @07:06PM (#15289524)
Security through obscurity is not the solution, though. Sooner or later someone does a port scan and finds that port. I've found that it's more efficient just to whitelist the IPs or subnets you might need and denying the rest.

Edit: I didn't mean changing the port is a bad thing. You can and should do it, and it will help a bit - just that it shouldn't be the only thing to rely on for your SSH security.

Re:Learn from your attackers – SSH HoneyPot by NeutronBoy on Tuesday September 19, 2017 @07:17PM (#15289567)
> Security through obscurity is not the solution, though

Security is about layers. Nothing is foolproof. It's about implementing layers of controls to reduce your attack surface to an acceptable level, with the trade-off that many controls increase the complexity of your setup or compromises the convenience for your users.

For example, for SSH, this probably includes

* changing the default port

* enforcing SSH key authentication

* enforcing passwords on SSH keys

* implementing fail2ban

* installing jump hosts for internal machines

* implementing a VPN rather than external facing hosts (and with that comes all the additional layers for the VPN)

* etc...

Re:Learn from your attackers – SSH HoneyPot by sdeziel on Tuesday September 19, 2017 @09:24PM (#15290063)
> * enforcing SSH key authentication

That cannot be enforced by the server because the key decryption occurs client-side. An alternative is to use Two Factor Authentication.

Re:Learn from your attackers – SSH HoneyPot by e12e on Tuesday September 19, 2017 @11:27PM (#15290565)
I think you mean the server can't enforce ssh key encryption/passphrase protection (next point down)?

And 2 or even 3 factor should maybe be on the list (key+pw, key+totp, key+pw+totp).

For keys, it's in theory possible to ease management with using ssh certificates and a CA - anyone know of a convenient way to manage totp secrets across multiple servers and users?

Re:Learn from your attackers – SSH HoneyPot by sdeziel on Wednesday September 20, 2017 @12:08AM (#15290769)
Yeah, I quoted the wrong line.
Re:Learn from your attackers – SSH HoneyPot by megous on Tuesday September 19, 2017 @07:29PM (#15289630)
It is part of it in this case. You've just eliminated most of non-targeted scanners. Your log is much more readable and what is left will probably be dedicated attackers.

This might help in forensic investigation afterwards. Less crap to wade through.

Re:Learn from your attackers – SSH HoneyPot by linsomniac on Tuesday September 19, 2017 @10:43PM (#15290370)
Security through obscurity is definitely not the solution, but I'll tell you that I've been running SSH on a non-WKS port since the mid '90s as a standard practice, and the number of attackers attempting to connect there seems to have been 0, even during the "lets try all sorts of common logins" crazy days.

Let's face it, the sort of person who moves SSH to a different port probably is also the sort to disable password logins. So the effectiveness of searching for their SSH daemon is probably pretty low.

Re:Learn from your attackers – SSH HoneyPot by avtar on Tuesday September 19, 2017 @07:12PM (#15289544)
> Security through obscurity is not the solution, though.

It's not the only solution but something that can be used to at least drastically reduce the amount of noise in logs.

> I've found that it's more efficient just to whitelist the IPs or subnets you might need and denying the rest.

That does sound more efficient but what if someone connecting doesn't have a static IP?

Re:Learn from your attackers – SSH HoneyPot by scaryclam on Wednesday September 20, 2017 @04:31AM (#15291725)
We use a VPN for this reason. It works pretty well and means we can lock things down to a single IP while allowing staff to still get on from home.
Re:Learn from your attackers – SSH HoneyPot by phil21 on Wednesday September 20, 2017 @12:44PM (#15295764)
I never understood this. If you allow roaming VPN sessions what is the difference between a roaming SSH session?

I'd argue they are effectively the same thing with the same auth methods available for both.

Why do you consider VPN to be a better protocol than SSH for security/authentication?

Re:Learn from your attackers – SSH HoneyPot by scaryclam on Wednesday September 20, 2017 @02:13PM (#15296669)
I don't consider it better, I consider it an additional barrier to attacking the production systems. Everyone authorised to access the servers (prod or non-prod) has to have an SSH key, protected by passphrase, to access the servers. This in addition to the requirement that they are either in the office or logged into the VPN means that any attacks have to come via that funnel.

Attackers who are not specifically targeting the company are unlikely to bother or to have the skills necessary. It's too much hassle and attackers scanning around for a random victim don't even see that the ports are open since they're behind a firewall.

So, it's not about this protocol vs that protocol for authentication, there certainly shouldn't be open access just because you got past the VPN auth, it's about layering your security to shrink the surface area and make it simpler to identify the entry points.

Re:Learn from your attackers – SSH HoneyPot by phil21 on Wednesday September 20, 2017 @05:47PM (#15298625)
Alright, so you use VPN as your bastion server - effectively.

I guess I never considered the need to SSH directly to machines. I completely agree security is defense in depth through layers.

I brought up the question since I was just at a client site that required VPN to ssh to their single bastion (jumpbox) ssh host, which then you used to further ssh to production machines. The VPN layer in that architecture seems rather silly - just lock down your bastion server (SSH) in the same way!

Re:Learn from your attackers – SSH HoneyPot by scaryclam on Wednesday September 20, 2017 @06:19PM (#15298836)
> Alright, so you use VPN as your bastion server - effectively.

No, I apologise if I wasn't clear, the bastion server is accessible only after you are either also within the office or logged in via the VPN. It's an additional hoop to jump through, not a replacement. The point being, the bastion server is locked down in addition to the requirement to be logged into the VPN or being physically located at the office. IP locking is not a replacement, it's a sensible addition. I think perhaps this is why you think it's silly; you're misunderstanding that it's not a different layer it's an additional one.

Re:Learn from your attackers – SSH HoneyPot by pilsetnieks on Tuesday September 19, 2017 @08:41PM (#15289907)
> what if someone connecting doesn't have a static IP?

Whitelist your ISPs subnet then, at the very least - there's much lower probability of an attacker coming from just your ISPs, and, of course, use other measures too - I didn't mean that to be the only solution for the problem.

Re:Learn from your attackers – SSH HoneyPot by secfirstmd on Tuesday September 19, 2017 @07:03PM (#15289514)
Yep, big advocate of that.
Re:Learn from your attackers – SSH HoneyPot by logicallee on Tuesday September 19, 2017 @06:21PM (#15289320)
EDIT:

I'm withdrawing the question per the accepted answer below.

-

original comment:

>it's just ridiculous and important to use non password authentication with ssh

Does this follow from the assumption (that you did not state) "since I won't bother to create a high-entropy password"?

Granted its a fairly safe assumption if you're not trying too hard but SSH supports passwords of arbitrary length so I'm curious if there's any other reason, besides not taking the time to create a high-entropy password.

-----

Accepted answer below (esp "Because your users cannot be trusted. I run servers which coworkers, all developers, get access to.")

Re:Learn from your attackers – SSH HoneyPot by tokenizerrr on Tuesday September 19, 2017 @06:35PM (#15289392)
Because your users cannot be trusted. I run servers which coworkers, all developers, get access to. It's either ssh keys or 2 factor authentication because most don't give a fuck about security and will insist using garbage passwords if not prevented from doing so (and then they will complain), even though the use of a password manager is mandatory.
Re:Learn from your attackers – SSH HoneyPot by jlgaddis on Tuesday September 19, 2017 @07:36PM (#15289658)
> ... will insist using garbage passwords if not prevented from doing so ...

  /etc/security/pwquality.conf
is how I prevent co-workers from doing so (on RHEL and derivatives).
Re:Learn from your attackers – SSH HoneyPot by tokenizerrr on Tuesday September 19, 2017 @07:45PM (#15289682)
Good to know. We do our user provisioning through an internal portal which enforces everything. The ssh servers als gets configured to disable password login so the only thing passwords are used for is sudo. All web stuff is behind a SSO gateway with password+2fa.
Re:Learn from your attackers – SSH HoneyPot by logicallee on Tuesday September 19, 2017 @06:43PM (#15289433)
Perfect answer actually. Accepted and I've updated my original comment.
Re:Learn from your attackers – SSH HoneyPot by spiritguy on Wednesday September 20, 2017 @12:12AM (#15290792)
One thing i was surprised to learn was that whatever you type as your password is actually transmitted to the server for validation! So if you typed the password for the wrong server in.. then you've just leaked that other password to the server you were trying to connect to! uh oh!

if you use keys, this doesn't happen.

Re:Learn from your attackers – SSH HoneyPot by eru on Wednesday September 20, 2017 @09:54AM (#15293709)
Private keys never leave the place they are born. Passwords not so much.
Re:Learn from your attackers – SSH HoneyPot by z3t4 on Wednesday September 20, 2017 @05:47AM (#15292015)
Don't forget about ipv6 if you have that enabled.
Re:Learn from your attackers – SSH HoneyPot by Karunamon on Tuesday September 19, 2017 @06:50PM (#15289452)
Only exception I can think of is SSHing into things where you’re not allowed to plug stuff in or put files on, like a public terminal of some kind. Password plus a second factor would be more usable there.
Re:Learn from your attackers – SSH HoneyPot by acranox on Tuesday September 19, 2017 @08:50PM (#15289940)
I did this with fail2ban. Initially just blocking the IP, and then sweeping back through occasionally and blocking the whole subnet when I had a few offenders in the subnet. There was no negative impact for me.
Re:Learn from your attackers – SSH HoneyPot by emveeoh on Tuesday September 19, 2017 @09:06PM (#15290011)
+1 fail2ban (properly configured, of course)
Re:Learn from your attackers – SSH HoneyPot by samstave on Tuesday September 19, 2017 @09:36PM (#15290097)
DOS against a range provided by an ISP assuming you could spoof the source over and over, you could have valid ranges auto-blocked for valid services where you DOS a range of IPs from any given ISP