Re: SSH bruteforce on its way...

From: Kurt Seifried (bt_at_seifried.org)
Date: 10/26/05

  • Next message: Justin: "Re: SSH bruteforce on its way..."
    To: "Russell Fulton" <r.fulton@auckland.ac.nz>, <incidents@securityfocus.com>
    Date: Tue, 25 Oct 2005 16:54:35 -0600
    
    

    >> Nah, there were some exploits a while back that took advanteage in
    >> some timing flaws in the SSHd that let attackers determin valid
    >> usernames.
    > Would you please provide some supporting references. I can not find any
    > evidence of existing timing attacks against openssh. In fact Openssh
    > goes to some trouble to defeat such attacks.

    The worst thing I find is that ssh brute forcers have been harvesting email
    addresses and using the username portion in their brute force attempts (I'm
    seeing the regular ones like adm, apache, ftp, games, gopher, operator, root
    and also pretty much complete lists of the email@ names) so relying on
    obscurity no longer works, there's more then one way to harvest a username.
    [*]

    Actually it happened in the PAM backend used by OpenSSH portable on Linux
    systems/etc:

    http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-0190

    Basically pam behaves differently when it comes to wrong username (no delay)
    vs. wrong username and password (enforced delay), you can prevent this by
    using the "nodelay" option in your pam configuration (/etc/pamd/sshd).

    > While on this thread, one effective counter measure against brute force
    > password attacks is to use decent passwords which everyone should be
    > doing anyway. We have lost about 3 systems here to ssh brute force
    > attacks and in all cases the systems were in serious breach of our
    > policies (which are not particularly draconian).

    You can use PAM to restrict which users are allowed to login, from an older
    article of mine:

    http://www.samag.com/documents/s=1161/sam0009a/0009a.htm

     Limiting User Access to Services
    auth required /lib/security/pam_listfile.so \
       item=user sense=allow \
       file=/etc/imapusers-allow onerr=failThis can help (i.e. email users are
    allowed to authenticate to pop/imap/smtp but not say to ssh. You can also
    use OpenSSH's AllowUsers and AllowGroups in sshd_config to limit access to
    certain users or groups ("staff" for example), conversely you can use
    DenyUsers and DenyGroups ("users" for example) to restrict various users.

    > In one case I did feel a bit sorry for the victims, they had installed a
    > third party package that created an account with an insecure password
    > and they never noticed. A good case for simple monitoring script like
    > the one that is run nightly on OBSD system that warns you about changes
    > in critical files.

    Or to lock those accounts out so they can't be used to login via ssh, telnet
    or other interactive services (see above). Least privilege and all that good
    stuff. Additionally requiring key authentication and preventing password
    based authentication ("PasswordAuthentication" in sshd_config) will pretty
    much squash any remote brute forcing attempts.

    > Russell.

    * Alternative ways:
    http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1013
    http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=user+enumeration
    Web harvesting, email, usenet news (google groups is great for this) and so
    on.

    -Kurt Seifried
    http://seifried.org/freescan/


  • Next message: Justin: "Re: SSH bruteforce on its way..."

    Relevant Pages

    • RE: SSH authentication via PAM
      ... Depending on your PAM ... Regardless of how PAM works, I won't be able to get any of the module-types to authenticate, authorize, or account if sshd does not pass the username correctly. ...
      (SSH)
    • newbie: help writing pam-aware app
      ... guide and the app developer's guide I put together a little app to see ... supplied to pam isn't associated with the password obtained through ... This seems to be the case when the username is ... Note that the authentication failed even though the password for root ...
      (comp.os.linux.development.apps)
    • Re: newbie: help writing pam-aware app
      ... I'm having exactly the same problems with PAM. ... > guide and the app developer's guide I put together a little app to see ... This seems to be the case when the username is ... > Note that the authentication failed even though the password for root ...
      (comp.os.linux.development.apps)
    • Re: pam-krb5 3.6 released
      ... verify the tickets, but this means the application needs to run as root ... pam-krb5 is a Kerberos v5 PAM module for either MIT Kerberos or Heimdal. ... supports configuration either by PAM options or in krb5.conf or both. ... similar work uses the correct username but only change the PAM ...
      (comp.protocols.kerberos)
    • Re: shutting down dictionary attacks
      ... >>With reflexion PAM is for sure responsible of this, i think the sshd ... >>is still connected to PAM who is responsible of password login, ... A way to stop that attacks is to run sshd on another port ...
      (SSH)