• PM_Your_Nudes_Please@lemmy.world
      link
      fedilink
      English
      arrow-up
      46
      ·
      edit-2
      13 hours ago

      Yes, it’s actually a very creative name. It’s caused by the character * allowing anyone to log into an open SSH port. So it’s an amalgam of {*}{SSH}{port (hole)}.

      The long story short is that if you don’t have a password set for an account, Alpine saves the user’s password hash as “*” because no password hash will ever match it. Should be safe, right? Any password will always automatically fail, because the hash algorithm cannot return “*” as a result. So the only way to log in as that user is via something besides a password.

      And when musl (the underlying system that Alpine uses for SSH) gets a Null response from its password hash, it uses “*” to represent that null value. Because lots of programs throw a fit if they get a true null value. So instead of returning a null value, it just returns a *. Which shouldn’t match anything, right?

      So an attacker forces the password hash to return a null value. Simple to do, because the password hash is capped at 256 characters. So just enter something with more than 256 characters. Musl takes that null value, turns it into a *, and passes that onto Alpine. Alpine takes this *, and compares it with the list of saved usernames and password hashes. And it finds that the user (who has no password set, and shouldn’t be allowed to log in with a password) has a password hash of “*”. This matches the result musl just provided, so the attacker is able to log into the system.

  • esc@piefed.social
    link
    fedilink
    English
    arrow-up
    74
    ·
    1 day ago

    tldr: disable password auth in ssh.

    Also name misses the point I think, it’s a musl-hole.

  • yucandu@lemmy.world
    link
    fedilink
    English
    arrow-up
    88
    ·
    2 days ago

    The only time I ever exposed my SSH port to the WAN, I got about 750 connection attempts from China and 250 attemps from Russia per hour.

    • ripcord@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 hours ago

      One reason that I have my router ignore all connection attempts from Russia and China

    • Aquatic_Melon@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 hours ago

      How do you know this? What tool or utility tells you this fact? I have a port exposed for a game server but realising I don’t know how many attempts are being made.

    • Sintinium@lemmy.zip
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 hours ago

      Surprised me too, it’s even worse if you use a cloud host for a VPS since it’ll be a more known IP

    • wonderingwanderer@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      14
      arrow-down
      3
      ·
      1 day ago

      Yet some people will still say with a straight face “tHeRe iS nO hYbRiD wAr!1!1”

      Not in Ba Sing Se at least…

      • yucandu@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        23 hours ago

        This was about 20 years ago btw. I know it’s gotten worse. But it started earlier than most think.

        • wonderingwanderer@sopuli.xyz
          link
          fedilink
          English
          arrow-up
          4
          ·
          23 hours ago

          Yeah, BBC has a whole documentary about it. Plus the russian state department basically published it all in a propaganda manual. They don’t exactly try to hide this stuff…

    • pHr34kY@lemmy.world
      link
      fedilink
      English
      arrow-up
      14
      ·
      1 day ago

      99.999% of that is over IPv4. I leave IPv6 open to WAN for my own use and it’s not a problem.

    • nexusband@lemmy.world
      link
      fedilink
      English
      arrow-up
      16
      arrow-down
      2
      ·
      edit-2
      1 day ago

      yeah, while reading this i was going “What maniac exposes SSH to WAN anyway…?” the whole time. I fail to see any reason or point that can be justified exposing SSH to WAN.

      • muusemuuse@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        28
        ·
        1 day ago

        I used to have a synology NAS that would sleep of death itself. Synology support asked me to port forward SSH to the open internet and set no password so they could pull logs over the next few weeks.

        Yes, it was legit synology support not a scammer.

        No, I haven’t bought synology ever again.

      • dev_null@lemmy.ml
        link
        fedilink
        English
        arrow-up
        13
        ·
        edit-2
        1 day ago

        Any VPS provider just gives you an SSH IP and port. So that’s the default state, until you do something else, which I imagine many don’t, since key based authentication was always considered secure.

        So I don’t know the reason, but that’s the standard practice with most providers, like Digital Ocean or Linode or whatever. You can call them maniacs but you shouldn’t be surprised at something so ubiquitous.

  • Samsy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    17
    arrow-down
    2
    ·
    1 day ago

    Wait that means I have to expose a port. But I have zero exposed ports.

    This post was created by the pangolin-gang.

  • DevDave@piefed.social
    link
    fedilink
    English
    arrow-up
    13
    ·
    1 day ago

    practically need to rotate logs every hour if you foolishly leave ssh open on a open network. usually a bastion with ssh listening to port 34000 or such is a good first step.

    that said the conditions for this exploit are fascinating. no pam, shadow password set to *, using a alternative to glibc. The sacrifices to be more efficient feel on par with replacing a tank’s armor with paper mache and hope.

      • DevDave@piefed.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 hour ago

        I got into it with another sys admin on shifting port numbers. “Security through obscurity is not security!” to which I responded “Obscurity cuts out most of the bots” (therefore easier to spot real threats).

        Eventually we just went the secret squirrel bastion route.

  • boatswain@infosec.pub
    link
    fedilink
    English
    arrow-up
    40
    ·
    2 days ago

    Given this is a vuln when entering the password, just turn off password auth and use ssh keys only. It’s what you should be doing anyway.

    • asap@lemmy.world
      link
      fedilink
      English
      arrow-up
      21
      arrow-down
      11
      ·
      edit-2
      2 days ago

      The vuln is specifically for key-based accounts:

      Second, the target system account must be configured to be passwordless. Passwordless accounts are commonly used for accounts that use certificate-based authentication.

      • WhyJiffie@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        10 hours ago

        not true. regardless if all your user accounts are using key based auth or not, some system accounts will always be passwordless, because they are not supposed to be logged into.

      • AHemlocksLie@lemmy.zip
        link
        fedilink
        English
        arrow-up
        21
        arrow-down
        1
        ·
        2 days ago

        But passwords need to be enabled for SSH. You must submit a faulty password of a specific kind, and the SSH server misinterprets it for passwordless accounts, which means the server must be configured to allow you to attempt a password.

    • jj4211@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 day ago

      Easier said than done.

      If you have to support the sort of user that barely managed to download a copy of putty a few years ago and kept using this, then walking them through key generation and use is a nightmare.

      One could fairly argue that maybe such people shouldn’t have access to a system, but it is a reality.

      Of course the likelihood that a system using musl is something that class of user would be accessing is lower.

      Maybe now that ssh is generally “just there” for Windows users, you can more easily work with them to generate a key, or give them a zip file to make them have a key in a standard way. But the interaction of ssh and windows file security can be… Interesting, though mostly an issue on the ash server side.

  • MonkderVierte@lemmy.zip
    link
    fedilink
    English
    arrow-up
    12
    ·
    edit-2
    1 day ago

    Further, OpenSSH using musl (pronounced muscle) must not use PAM (pluggable authentication modules),

    which Alpine doesn’t ship by default. Maybe one or the other remote administration suite depends on it, but those are often suspectible to exploits anyway. But you don’t expose either to WAN, right?

    • sorter_plainview@lemmy.today
      link
      fedilink
      English
      arrow-up
      26
      ·
      2 days ago

      The person who discovered *sshole said OpenWRT is affected, but by default, that OS uses the Dropbear package, not OpenSSH, for SSH connections (though maintainers provide instructions for installing the latter).

  • AppleMango@lemmy.world
    link
    fedilink
    English
    arrow-up
    17
    arrow-down
    2
    ·
    2 days ago

    Most ssh ports should be accessed through a VPN anyway, not exposed directly to the internet

  • IronKrill@lemmy.ca
    link
    fedilink
    English
    arrow-up
    27
    arrow-down
    1
    ·
    2 days ago

    Well that sucks. IIRC a lot of my docker images are alpine based, but they’d be safe due to never having their SSH ports exposed I assume.

    • fonix232@fedia.io
      link
      fedilink
      arrow-up
      24
      ·
      2 days ago

      Why would you even have an SSH server running in a Docker container (unless the purpose of the container is being a jumpbox or similar)?

      I can’t emphasise it enough how much more secure you get when you use rootless, read-only containers that are limited to truly just the software you want to run and its dependencies.

      Alpine is great for dev containers, but the final container should be:

      • immutable on the app layer (any executable path needs to be read only)
      • have only the absolutely necessary GNU tooling, service management, etc. included (for most software you don’t even need these tools, and why would you give an attacker who gain access to your container, an easy way to e.g. scan your network?)
      • only the data mounted, rw only if absolutely necessary (e.g. if you host a Jellyfin server, just an example, you should have the mounted media be RO, and only the config and caches be writable, mounted noexec of course)
      • IronKrill@lemmy.ca
        link
        fedilink
        English
        arrow-up
        8
        ·
        2 days ago

        While I have not done it, I could see it being appealing as it’s quicker than SSHing into the parent box first for a commonly used tool. I had a direct SSH into a systemd container for a while before deciding the extra config wasn’t worth it.

      • MonkderVierte@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 day ago

        unless the purpose of the container is being a jumpbox or similar

        What’s wrong with a rootless jumpbox?

        • fonix232@fedia.io
          link
          fedilink
          arrow-up
          3
          ·
          1 day ago

          Nothing, my point was that SSH in a container is unnecessary unless it’s for the specific purpose of the container.

  • heartSagan5@lemmy.zip
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    6
    ·
    2 days ago

    Alpine? The one that doesn’t use glibc? Wasn’t this why they chose a different C runtime? For security. Ooops.

    • grue@lemmy.world
      link
      fedilink
      English
      arrow-up
      18
      ·
      2 days ago

      “Security” and getting rid of that pesky copyleft licensing in order to make it so corporate users have to give back as little as possible.