by nmaludy · 6y ago · 0 comments
Results: The honey pot listening on standard port 22 received 1,000s of login attempts (sorry, don't remember the exact number). The honey pot listening on the random high-numbered port received exactly 0.
I know this is just an anecdote and it might not necessarily be true today, but this experiment always sticks in my head. At least the guy used the scientific method: created a hypothesis, conducted the experiment, analyzed his results.
If I change a port for anything to another random port I won't get any login attempts for a few days but eventually I start getting hit again. I can repeat this over and over. I imagine what is happening is that the bad actors are scanning for open ports and they feed that periodically to another process that attempts logins.
You may be interested to know this is called "Defense in depth".
https://en.wikipedia.org/wiki/Defense_in_depth_%28computing%...
> It’s where you keep the mechanism secret, not the key.
I think this can be, as you write, defense in depth if the secret of the mechanism is not the only defense.
As example the block cipher for the Common Scrambling Algorithm https://en.wikipedia.org/wiki/Common_Scrambling_Algorithm has been secret. As it seems that has delayed the analysis of the system for about 8 years, but not damaged the procedure.
Edit: I believe you are implying that they used “security by obscurity” incorrecty, which I don’t believe they did. If I read that wrong, my bad!
(Moving SSH port plus something like fail2ban could be considered defense-in-depth against the incidental DDOS-like issues, though.)
There was not a single brute force attempt. None.
Let the server and client share a secret. Use that secret to encrypt the UTC date (2020-09-21), and sample some decimals from the first few bits (adding 100 or so, to avoid low-ports).
You could use that mechanism to rotate ports every 24 hours. This way, the bots wouldn't be able to learn the ssh port for more than 24 hours, without the shared secret.
Sounds like fun, or an easy way to lock yourself out of a box by mistake, depending on your perspective. :)
I think I'd sooner implement port knocking rather than port-hopping
Maybe you'd knock to get a number, and hash the number to get the real port.
Defense in depth! :)
This is THE way to go !
I imagine the people who had to use these things locked themselves out all the time. :)
When I see this in practice, the first thing I check is how auth is being done and the overall security of the host. Then, I look for how they are doing SIEM because cleaner logs is a common reason and they'd be better off with a more proactive management approach.
You don't see a difference in a 2-orders-of-magnitude noise reduction when looking for attacks!?
/s
//Side note, you should never allow login as root, and you should not really allow remote password login at either, only keys
That's a minimal (read: insufficient) improvement, but if it were behind a real layer of security then it would strictly be an improvement.
> Side note, you should never allow login as root, and you should not really allow remote password login at either, only keys
I'm on board with keys, but why not allow root? If it's secured by a key, what's the harm?
FWIW, when I chose my port, I looked at port scanning statistics back in the day, looking for the least scanned ports. It appears those stats have held true for a couple decades at least.
"VoIPBL is a distributed VoIP blacklist that is aimed to protects against VoIP Fraud and minimizing abuse for network that have publicly accessible PBX's"
It's very similar to what you linked but is targeted to catching VoIP abuse.
I still use it with a super oppressive jail time and few retries, with a few whitelisted IPs and it seems to work ok.
Worse, from an economic perspective, theres enough hosts listening on port 22 that a bot can try instead while they wait for timeouts, so you're not really imposing a cost on them. If you view running a botnet as a form of multi-armed bandit problem, the best you can really do is limit the economic value by slowing them down a tad versus their many, many other options.
Keep forgetting to enable fail2ban.
But as soon as you found that "PermitRootLogin" can be set with no then all brute forces become useless since they can't match combination of user/password.
But for mine usage it increase memory usage. I'm using it on OrangePi Zero with 256MB RAM.
Port 22 is opened for world so anyone can join. Device have 2 users - root and jacob. I make a change and disable root login from WAN. Now can login from root from LAN. Since noone knows that "jacob" exists i'm saved.
And reading many of the responses in this thread it makes sense to me. So many people in this thread talking about how many less failed password login attempts they get when they change the port, indicating they allow password based login in the first place.
Most scans are smart enough to give up as soon as they see publickey as the only method, but some keep trying to connect hundreds of times.
You may answer that you could still miss a few of theses simple password, that your solution would be more effective, sure, but then you use security by obscurity to protect yourself.
By the way, security by obscurity does works, it's not bad per say, just as that FBI agent just proved, it does have an effect. If it didn't, there wouldn't be so many case where it was used. The issue with security by obscurity is when you rely on that to protect from vulnerabilities and then ignore them. It only lower the likeliness of getting attack, it doesn't make attack less effective, it doesn't protect from any vulnerabilities.
Sadly, too many time, we just ignore it, hide everything and hope to avoid targeted attack which would foil that obscurity pretty quickly. This is when it get bad.
I don't need a research to see the difference in how much logging journalctl generates immediately after I disable port 22.
"They" are just a bunch of bots that try to hit 22 once and that's it. If it's open report it's open if not then move onto the next target.
The only time a human is going to look for SSH on non-22 ports is when they are actively attacking you or your organization.
Then again, is port knocking security by obscurity enough?
I can say from personal experience that this anecdote is both accurate (20 years ago and up till today) and meaningful.
No idea where you get this notion that brute force attack are no threat or without cost.
They certainly do pose a security risk (takes only one insufficiently trained employee/intern for a potential breach) and they certainly come at a cost (way beyond dirty just logs).
True indeed, yet even today I have seen little evidence of scanning beyond standard ports (pretty much the same as in the past). Criminals are opportunistic by default and tend to go for low hanging fruit (standard ports, with standard server config). I certainly did see in increase on standard ports. Even while full range scanning has become more feasible, I have not seen much evidence of its use.
How? If they've leaked their key, why do you assume the port hasn't leaked too? On the other hand if they haven't leaked their key how would they get in?
Or are you allowing password authentication like it's 1999?
That is assuming you have such authority or technical means. If you're maintaining systems for a company, there's a good change that the product vendor simply won't allow fucking around with their system like that (ergo: yes, in practice you are indeed stuck with your 1999 authentication).
I'm not saying that it is good security (that's why layers security is often paramount), but it is situation I've encountered more than a few times.
Great for you, if you are GOD on all the systems you work with. Even then, your client/employer might simply tell you to stuff your objections and accept the bad authentication policy, because to them the risks are simply not worth the business disruption. I totally agree that is a flawed argument. But decisions usually aren't always (if ever) called on valid arguments.
Good for you, if you are in a position where you never had to deal with such real life situations.
Why? Unnecessary attack surface that provides no tangible benefit.
Sketchy parsers operating on untrusted, unstructured log data. fail2ban is worse than useless
Granted, there usually is a lot more at fault when you run into such problems, but I find people not looking at logs a rather weak argument for letting them get spammed full with garbage. Certainly terrible hygiene, at least.