News for hackers. Stuff that matters.
Re:OpenSSH user enumeration by jarfil on Saturday August 18, 2018 @11:56PM (#17792480)
Usernames are not a secret, passwords are a secret.
Re:OpenSSH user enumeration by asveikau on Sunday August 19, 2018 @12:14AM (#17792554)
I don't know, judging by my SSH logs it seems a lot of the automated malicious login attempts are looking for common software used to deploy code. Knowing that a target machine has a username used by some popular software might be valuable information in an attack.

But on the subject of passwords, best practice for SSH for a long time has been to disable password based login entirely and rely on keys.

Re:OpenSSH user enumeration by mrkoot on Sunday August 19, 2018 @02:24AM (#17792884)
Exactly - it also works for non-SSH accounts, thus allowing software enumeration by testing for default/common/known default service users.

For instance, an OpenBSD box running Tor may have a user "_tor", a Debian-based box (e.g. Ubuntu) may have a user "debian-tor", and so on (depending on how Tor was installed, in my case via pkg_add & apt-get; usernames might vary for different OS/repo versions). I have tested this using the PoC against some of my own systems (the ones that have PasswordAuthentication still enabled) and it works for those.

Re:OpenSSH user enumeration by mrkoot on Sunday August 19, 2018 @03:36PM (#17795815)
...and apparently the same issue exists in Dropbear up until current version (2018.76 / Feb 2018), which has an entirely different code base. A comment on /r/blackhat [0] led a colleague and me to look at Dropbear's sources, and it happens to have logic that is sufficiently similar [1] for the same PoC to work; tests against v2018.76 and a couple of earlier versions (e.g. v2013.58) are successful.

Shodan shows some 66k services identifying as SSH-2.0-dropbear [2], as opposed to some 15k identifying as SSH-2.0-OpenSSH [3].

Issue has been reported to the vendor today.

[0] https://www.reddit.com/r/blackhat/comments/97ywnm/openssh_us...

[1] https://github.com/mkj/dropbear/blob/master/svr-auth.c#L175-...

[2] https://www.shodan.io/search?query=SSH-2.0-dropbear

[3] https://www.shodan.io/search?query=SSH-2.0-OpenSSH

Re:OpenSSH user enumeration by mrkoot on Monday August 20, 2018 @01:16PM (#17801774)
Vendor confirmed the issue, noting that it exists in "probably all versions" of Dropbear (i.e., v2018.76 and earlier) and that a patch will follow in the next couple of days: http://lists.ucc.gu.uwa.edu.au/pipermail/dropbear/2018q3/002...
Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @08:22AM (#17793999)
As others have noted - this allows user enumeration. Which can be very useful:

Does a system appear to run one of the many horribly insecure "enterprise" backup solutions? Or some other horrible, ancient system?

Does $person from orgchart appear to have a $user? (target for spear phising, compromise of laptop).

Information hinting at distribution (eg: Ubuntu).

Is there a jboss user? Etc.

Re:OpenSSH user enumeration by acdha on Sunday August 19, 2018 @12:49PM (#17795027)
How much of a difference does this really make? Most attacks which I’ve seen simply launched the attack immediately so if you have enterprise software using the vendor’s configuration you’re screwed anyway, and both options are quickly blocked by fail2ban after splatting off the public key-only setup of any security conscious server.
Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @01:57PM (#17795380)
Maybe knowing software a is likely running and managed by user b helps constructing a targeted attack.
Re:OpenSSH user enumeration by acdha on Sunday August 19, 2018 @02:32PM (#17795546)
Perhaps but it’s a limited change from what’s already possible. Spending time on basic best practice stuff securing those accounts will pay a lot more dividends in more scenarios than adding a minor impediment to finding them.
Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @06:18PM (#17796490)
Fwiw I mostly agree - reading /etc/passwd shouldn't be able to help compromise your system. But it's also an error for sshd or any daemon to allow the enumeration of your list of users. I mean when we get to read /etc/passwd via httpd we call it an exploit... (even if we don't get shadow too).
Re:OpenSSH user enumeration by xorcist on Sunday August 19, 2018 @05:49AM (#17793521)
Incidents happens when several things which are innocent on their own suddenly interact in unforeseen ways.
Re:OpenSSH user enumeration by mackal on Sunday August 19, 2018 @12:27AM (#17792599)
They are useful though. If you check a bunch of usernames from a person leak and find matches, you got a password to try.
Re:OpenSSH user enumeration by thaumaturgy on Sunday August 19, 2018 @03:21AM (#17793025)
A correct sshd_config includes:

    PasswordAuthentication no
Re:OpenSSH user enumeration by shpx on Sunday August 19, 2018 @06:25AM (#17793620)
You can also use https://tinyssh.org instead of the sshd from OpenSSH. It only implements key based authentication and newer encryption algorithms. It's available on Ubuntu:

    sudo apt install tinyssh
    wget https://github.com/yourusername.keys -O ~/.ssh/authorized_keys 
    sudo systemctl enable tinysshd.socket
but it's not widely used, which makes using it risky. To my knowledge there hasn't been a formal audit. Also it doesn't implement the scp protocol, but you can use rscync over ssh

    alias scp="rsync -e ssh --progress"
Re:OpenSSH user enumeration by half-kh-hacker on Sunday August 19, 2018 @07:17AM (#17793790)
> Also it doesn't implement the scp protocol

From the FAQ[1]:

> TinySSH doesn’t have problem with scp protocol, only doesn’t have scp program.

I assume this means an OpenSSH `scp` command will work just fine when pointed at a tinyssh daemon, without the rsync alias.

[1]: https://tinyssh.org/faq.html

Re:OpenSSH user enumeration by exikyut on Sunday August 19, 2018 @08:58AM (#17794110)
TIL TinySSH exists.

Immediate pro: Public domain / CC0

Immediate potential-con: Doesn't implement compression

Re:OpenSSH user enumeration by mrkoot on Sunday August 19, 2018 @04:48AM (#17793334)
+1. But just to be sure: that does not prevent testing for usernames and hence enumerating software by testing for known/common service account usernames (e.g. "_tor" on OpenBSD and "debian-tor" on Debian-based OSs). (No claim was made to the contrary; just mentioning this to prevent anyone from thinking otherwise.)
Re:OpenSSH user enumeration by jwilk on Sunday August 19, 2018 @05:59AM (#17793547)
To disable logging in with password you also need:

  ChallengeResponseAuthentication no
Re:OpenSSH user enumeration by mwpmaybe on Wednesday August 22, 2018 @12:49PM (#17820030)
I got a chill up my spine when I read this but fortunately it looks like this is the default on Ubuntu 16.04 and 18.04 (at least).
Re:OpenSSH user enumeration by jwilk on Friday August 24, 2018 @03:03PM (#17837092)
Apparently Debian disabled it in 2005:

  openssh (1:4.1p1-1) experimental; urgency=low
  
    […]
    * Disable ChallengeResponseAuthentication in new installations, returning
      to PasswordAuthentication by default, since it now supports PAM and
      apparently works better with a non-threaded sshd (closes: #247521).
    […]
  
   -- Colin Watson <[email protected]>  Tue, 31 May 2005 01:33:33 +0100
https://bugs.debian.org/247521
Re:OpenSSH user enumeration by flas9sd on Sunday August 19, 2018 @10:47AM (#17794489)
for a longer explanation see https://blog.tankywoo.com/linux/2013/09/14/ssh-passwordauthe...

Though, if you're using TOTP via a PAM module, you'll want it

Re:OpenSSH user enumeration by mirimir on Sunday August 19, 2018 @12:57AM (#17792687)
Does anyone still use password authentication on servers that actually matter? I mean, I'm just a hobbyist, and I switched to keys several years ago. Basically, I just use root and user, because anything else unnecessarily adds information.
Re:OpenSSH user enumeration by mercer on Sunday August 19, 2018 @07:04AM (#17793750)
I had a server that used password authentication for the root user (on the standard port). After a few months of uptime it was hacked.

I suppose even minimal extra security would've helped (no root user, only allow x login attempts in y time, changing the port for ssh), but I was still surprised someone got in so soon by simply guessing a 20+ string of gibberish (I still wonder if maybe something else happened).

All that said, I've had servers running for years without any successful hack, and in all those cases using ssh keys instead of password logins probably made all the difference.

Re:OpenSSH user enumeration by obituary_latte on Sunday August 19, 2018 @07:41AM (#17793872)
It was something else. Nothing or no one brute-forced a 20+ random string pass. More likely some service (Wordpress, phpbb etc) got owned. I’ve had multiple servers running for years with < 15 char non random root pass (stupid as it is to do so) with no problems.
Re:OpenSSH user enumeration by mercer on Monday August 20, 2018 @09:58AM (#17799889)
I'd be inclined to think the same, if not for the fact that this server wasn't running anything particularly 'ownable' that I can think of.

The only alternative that I can think of is that one of the two other users' machines was compromised, but AFAIK I didn't give them root access. Plus, the logs show an extreme number of login attempts (tens of thousands of entries in auth.log) with an eventually successful root login.

Any other ideas of what might've been an alternative cause?

Re:OpenSSH user enumeration by obituary_latte on Tuesday August 21, 2018 @05:38AM (#17808262)
From the logs it sounds like maybe the password was in some lookup file or something. i.e. somehow that password was leaked and added to some list somehow.

Maybe you’re right though.

Re:OpenSSH user enumeration by mercer on Tuesday August 21, 2018 @11:59AM (#17810771)
it's maddening that I can't tell for sure, but I'll agree that I find it still somewhat hard to believe that a 20-character random root password was brute-forced.

EDIT: to be clear, I am pretty sure was the only person who used the root password to log in, and the single other user used a similarly long and random password with a different username. if I'd been compromised my problems would be quite a bit bigger. All I know is that right before the 'fatal' root login, there are 40.000+ lines of login attempts from ip's that originated from shady places (at least based on entering them in various GeoIP sites).

Re:OpenSSH user enumeration by protomyth on Sunday August 19, 2018 @07:11AM (#17793767)
The current version of OpenSSH doesn’t allow root login by default.
Re:OpenSSH user enumeration by mrkoot on Sunday August 19, 2018 @05:20AM (#17793439)
Yes. Large corporate networks often still have (some) production systems that allow password-based authentication. I don't know how widespread it still is, but I still encounter it frequently at clients (which may be a skewed sample).

Just to be sure: PasswordAuthentication does not need to be enabled for the PoC to work, and username testing can also be used for software enumeration by testing for common/default non-SSH users, .g. "_tor", "debian-tor", etc. (I apologize for repeating here what I also stated in other comments in this thread, but this aspect should not be overlooked.)

Re:OpenSSH user enumeration by jakobdabo on Sunday August 19, 2018 @05:59AM (#17793550)
Can somebody please explain to me why exactly using good passwords and allowing root login is bad security? Every SSH security tutorial mentions those but they never mention the reasons.

If somebody hacked into my password manager and managed to steal the root user's password then they could do the same with my private key. Where is the difference?

Also, if somebody hacked into a non-root administrative account, they can just use sudo to elevate. What makes disabling root login more secure?

Re:OpenSSH user enumeration by acdha on Sunday August 19, 2018 @07:54AM (#17793902)
Mistakes: if it’s a server used by a small number of security conscious admins, it’s moot. If it’s used by a lot of people, however, the odds go up dramatically that someone will have a weak password, one which is on a common list, or reused on a site which you’re just about to learn was breached.

Keys can be leaked but since it involves copying files and users aren’t penalized for using strong ones it’s much less common.

Re:OpenSSH user enumeration by Borealid on Sunday August 19, 2018 @06:05AM (#17793566)
1. A "good" key safe for the forseeable future would have around 256 effective security bits. To get a key that strong, your password would have to be (speaking VERY generously here) 40 characters long and truly random.

2. When using real password authentication, connecting to a compromised server results in a disclosure of your password. When using challenge-response authentication, it does not. Note that correctly-configured OpenSSH uses challenge-response even for password-based methods. Incorrectly configured SSH will send passwords over the wire.

Re:OpenSSH user enumeration by jwilk on Sunday August 19, 2018 @06:13AM (#17793587)
> Incorrectly configured SSH will send passwords over the wire.

What do you mean?

Re:OpenSSH user enumeration by pests on Sunday August 19, 2018 @07:33AM (#17793849)
Real password based vs challenge response.

With real password when you type your password into the ssh password prompt it then sends that password to the server.

Challenge response is a method in which you usually encrypt or hash random server provided data. You send the hash. The server knows your password and can hash the data with it too. The hashes are compared not the password. In this method the password never leaves your machine. Replay attacks are prevented due to the server sending different data for you to hash on different login attempts.

Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @08:11AM (#17793961)
Note also that requiring a password for sudo might have some issues, as the password is sent over the ssh connection as you type. I'm not sure what the state of the art is wrt counting and guessing characters - or if mossh makes the problem worse - or helps. For the general idea, see:

http://www.securiteam.com/securitynews/5KP0O0A3PU.html

Does anyone know of recent work on passively attacking interactive ssh in order to guess what's being typed? I could see machine learning helping here, given the ability to observe enough sessions to form a training set...

Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @11:15AM (#17794581)
Of course, with Pam for sudo authentication you could use otp, u2f with or in place of a password.
Re:OpenSSH user enumeration by e12e on Sunday August 19, 2018 @08:00AM (#17793920)
Just to add to @borealid's comment: a password that encodes 96+bits of entropy is effectively a shared symmetric key (OK, technically a secret).

Point being - it needs to be managed like a key: it's inconvenient to type, hard to remember, should be stored encrypted at rest, preferably in an hsm.

Gnupg agent/ssh agent and the various key agents for desktops all do this, and generally support hsm as well.

There's also a small difference in the complexity of enumerating the keyspace of rsa/ed2259 vs trying random passwords. With key stretching I'm not sure if there's implicit differences in rate of attempting login.

As for no direct root login via ssh - I think it depends a bit on the server. On a shared system login via regular user +sudo leaves an easier audit trail (who ran "sudo apt-get dist-upgrade" on Friday evening and took the weekend off without checking that production systems didn't crash... Was it "root" or "bob "?).

Then there's the nudge towards only doing what needs root as root (eg: curl/wget stuff as regular user, verify signatures, content - then run as root).

Is it more secure to locally dump and asymmetrically encrypt backups on disk as root - locally, and have a dedicated backup-user that gets the archives? Probably.

In general ssh keys (and certs more so) makes it feasible to split up access and authorization, revoke access etc without relying on something complex like ldap/kerberos for user management.

> Also, if somebody hacked into a non-root administrative account, they can just use sudo to elevate.

If they only have your ssh key, they'd typically need your password to elevate. Or you might require a shared root password - or set a password on wheel and require newgrp wheel before sudo. Not sure if the latter with disabled root account has much benefit, though.

Re:OpenSSH user enumeration by acdha on Sunday August 19, 2018 @12:42PM (#17794979)
One other nice thing about keys is that you can restrict them to a specific command. If you have users who are running well defined tasks that can be a great way to avoid handing out full accounts.
Re:OpenSSH user enumeration by simias on Sunday August 19, 2018 @06:50AM (#17793699)
There are situations where using a password can be a little more convenient, for instance if you like to connect to the machine from random computers and you don't want to/can't carry your private key with you all the time. Obviously it's not the best security-wise, using a hardware token containing the key or even OTPs are probably a better solution.
Re:OpenSSH user enumeration by dddddaviddddd on Sunday August 19, 2018 @08:47AM (#17794082)
Some servers I manage accept either password with two-factor code, or keys. Helpful when logging in from a new machine without having to carry authorized keys around somehow.
Re:OpenSSH user enumeration by bpye on Sunday August 19, 2018 @09:14AM (#17794162)
I use a YubiKey with a GPG key as my SSH key, means I just need to plug it in to authenticate to any of my remote hosts.
Re:OpenSSH user enumeration by IshKebab on Sunday August 19, 2018 @10:50AM (#17794494)
Absolute nonsense. Usernames can be sensitive information in many situations.
Re:OpenSSH user enumeration by ddtaylor on Sunday August 19, 2018 @12:52AM (#17792672)
Are you willing to send me a list of all your usernames on all your systems?
Re:OpenSSH user enumeration by mirimir on Sunday August 19, 2018 @12:58AM (#17792690)
Sure. It's root and user, on everything :)
Re:OpenSSH user enumeration by ddtaylor on Sunday August 19, 2018 @02:15AM (#17792868)
Does that mean that `wc -l /etc/passwd` is just two?
Re:OpenSSH user enumeration by daurnimator on Sunday August 19, 2018 @06:39AM (#17793671)
No. There will be plenty of system user. But they do not have SSH access permitted.
Re:OpenSSH user enumeration by tjoff on Sunday August 19, 2018 @08:42AM (#17794070)
It doesn't matter if ssh access is permitted.
Re:OpenSSH user enumeration by mirimir on Sunday August 19, 2018 @04:06PM (#17795924)
So how is an attacker going to access the machine?
Re:OpenSSH user enumeration by tjoff on Sunday August 19, 2018 @06:48PM (#17796630)
If a certain account is present then the attacker might know a certain service is running and then target that.

Might also reveal the purpose of the machine (oh, this is probably the build server) or who is managing it.

Re:OpenSSH user enumeration by mirimir on Sunday August 19, 2018 @06:57PM (#17796676)
Nothing crucial should be directly accessible from the Internet.
Re:OpenSSH user enumeration by tjoff on Monday August 20, 2018 @02:26AM (#17798072)
Indirectly then, or, the publicly facing servers are crucial enough.

It is information leakage, not the end of the world but it can potentially be helpful for an attacker.

Re:OpenSSH user enumeration by zaarn on Sunday August 19, 2018 @04:28AM (#17793252)
List of all users allowed to use SSH on my systems:

- root

- user

- ansible_conf_daemon_user

End of List. It's all containers so IDGAF and I use pubkey authentication on each user.

Re:OpenSSH user enumeration by xorcist on Sunday August 19, 2018 @05:46AM (#17793515)
For non trivial environments with audit requirements this is not an option.

Running all software under the same uid is also usually best avoided, you'll always have data at rest somewhere (which needs to be backed up, access controlled, and so on).

Re:OpenSSH user enumeration by zaarn on Sunday August 19, 2018 @05:51AM (#17793528)
Of course there is other users but they aren't configured for SSH via AllowUser.

Additionally most of those are containers where running it all as the same UID isn't a problem.

Re:OpenSSH user enumeration by xorcist on Sunday August 19, 2018 @10:01AM (#17794351)
User ids without login privileges can be just as interesting to enumerate.

Containerization isn't really relevant to protecting data, as you'd normally find data volumes and backups attached.

Re:OpenSSH user enumeration by zaarn on Sunday August 19, 2018 @10:40AM (#17794474)
Well, it would but the exposed containers don't have any non-default users.

Plus, this is LXC, not Docker. There is no data volumes or backups attached. Backups are shipped to an append only server via SSH tunnel with low privileges, which also doesn't have nonstandard users setup.

Re:OpenSSH user enumeration by brodsky on Sunday August 19, 2018 @02:07AM (#17792851)
there is an "ubuntu" user on most of my systems. I hope you find this information useful.
Re:OpenSSH user enumeration by Someone1234 on Sunday August 19, 2018 @02:41AM (#17792934)
I know you're being facetious but, yes, I would find that information useful. Now I've just IDed the distribution I'm targeting.
Re:OpenSSH user enumeration by blattimwind on Sunday August 19, 2018 @04:58AM (#17793366)
This is usually in the OpenSSH version string anyway, e.g. "OpenSSH 6.7p1 Debian 5+deb8u4 (protocol 2.0)". Guess what distro that server is running?
Re:OpenSSH user enumeration by eahman00 on Sunday August 19, 2018 @05:01AM (#17793377)
I believe only Debian does that, out of vanity (I presume).
Re:OpenSSH user enumeration by jwilk on Sunday August 19, 2018 @06:22AM (#17793611)
https://salsa.debian.org/ssh-team/openssh/raw/master/debian/...

Subject: Include the Debian version in our identification

This makes it easier to audit networks for versions patched against security vulnerabilities. It has little detrimental effect, as attackers will generally just try attacks rather than bothering to scan for vulnerable-looking version strings. (However, see debian-banner.patch.)

Re:OpenSSH user enumeration by thaumaturgy on Sunday August 19, 2018 @03:29AM (#17793048)
A disappointing number of servers happily give away this information in their http response headers. For those that don't, `nmap -O` will sometimes do the trick.
Re:OpenSSH user enumeration by Someone1234 on Sunday August 19, 2018 @03:42AM (#17793088)
nmap's OS detection won't normally tell you the distribution, only the OS (and maybe kernel version).
Re:OpenSSH user enumeration by est on Sunday August 19, 2018 @01:37AM (#17792782)
yeah but what if some user names are known to have a weak secret?