1. 64
  1.  

  2. 9

    As raggi points out on the orange website:

    It could be worse, the user has the old rsa host key present alongside newer ed / ecdsa keys, they may never rotate out the rsa one. A future mitm simply only advertises the rsa key, and mitm passes.

    Users will need to actively remove the old rsa key in order to be safe.

    1. 6

      Okay, I tested this and on a new enough OpenSSH client, the RSA key gets replaced using the mechanism described here: https://lwn.net/Articles/637156/ (if you connect using a key other than RSA).

      1. 3

        But this is also a very bad thing in the other direction. If you are MITM’d first, they can “update” the other keys if you connect with RSA first, right?

        1. 1

          I mean, it doesn’t really make any difference? The only situation where this makes any difference is if the user takes no action to update the keys manually, and in that case the MITM will continue as long as the man is in the middle, whether this mechanism exists or not. And then once you connect to actual GitHub, the fact that you got MITMed will be more noticeable.

    2. 5

      This is gonna be a huge pain to deal with for years. I understand why they rotated it, but I almost wish they didn’t.

      1. 6

        Why do you think this will last years?

        1. 14

          Call this SRE cynicism, but there’s usually a long tail of builds that you do at various companies. Some of those builds may not run very often, and somebody may have pinned the GitHub RSA key thinking that it would never change. It’s going to be interesting to see with the long tail of less often run builds is at some companies.

          1. 9

            now that i’ve been doing infra work in a non-hobbyist capacity for literally any amount of time i don’t call SREs cynical anymore, just realistic.

            1. 1

              I see your point and nice mention of the long tail. Things will likely be discovered and break like you said. I’d call this failing safe 🤷🏻‍♂️. If I revoked an SSL cert with a Certificate Revocation List (CRL), things might break (if clients don’t read the CRL). But I revoked the cert. This is what I wanted. The problem with SSH keys (as mentioned here by df) is that SSH keys don’t have an expiration and there’s no CRL.

              I know how I should rotate passwords and the impulse could be my password leaked out on my Twitch stream (or something). A leak is possible and I know how to rotate a password. I know what the impact is (my old password stops working). I know how to rotate an SSL cert. There’s an automated way to do it with certbot. I might do it every week. A leak of SSH keys is possible so what is the procedure? It’s this very story. There is no other option. There is no CRL.

              So in this way, SSH has no explicit mechanism because … it’s a circle of trust for servers and hostnames to me that is unrelated to a terminal user on Github. I mean, I don’t really get an interactive shell on Github but this is what SSH started out as. I can have a git repo on a normal Linux box but I am granted a user account. This is different (in this context) than the HTTPS access method on Github for the same feature (Github access).

              It’s similar to the TLS circle of trust but there’s no private key infrastructure by itself. So it’s nice how simple SSH is (no registrars, no fees, no PKI, no CRLs, no expiration) but … how do you rotate an SSH key like you would a password or a cert? You do it because you want to fail safe but you make the news. 🌻

              1. 2
        2. 5

          This is an argument for using HTTPS whenever possible. It’s not perfect, but there’s an established process for key revocation and rotation, and also there are good ways for large-scale services to use those with an HSM to make accidentally leaking the private key much harder. There’s a reason we don’t see private key leaks with normal websites very often.

          1. 4

            SSH servers can store the host keys in a HSM as well, FWIW. It seems like they just didn’t do that here.

            1. 3

              I see the point. OTOH, using http auth with github requires downloading some piece of proprietary (or otherwise GitHub branded) software since they disabled password auth. So currently, the only way to authenticate with GitHub by using only standard git tooling is SSH.

              1. 1

                It’s also possible to use multiple private keys, as long as they were signed for your domain, you don’t have to have that one key on every server

              2. 4

                As yetanotherjosh mentions on the orange site, please take a moment to verify the SHA256 of the new key after you remove the old one and try connecting to github.com again.

                1. 1

                  You can also just copy and paste their keys from the docs

                  github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
                  github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
                  github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
                  
                2. 4
                  $ ssh -o VerifyHostKeyDNS=yes github.com
                  The authenticity of host 'github.com (140.82.121.3)' can't be established.
                  ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
                  No matching host key fingerprint found in DNS.
                  

                  They didn’t update their DNS SSHFP records ?

                  What a security nightmare…

                  1. 5

                    I have to admit, until your comment I had never even heard of SSHFP records, much less the need to update them.

                    1. 2

                      Or the change just didn’t propagate yet?

                      1. 8

                        This is the exact comment they posted on the orange website, to which someone already replied that

                        GitHub doesn’t publish fingerprints as SSHFP records.

                        And that operation is nonsensical anyway as that’s the ED25519 key, which has not changed (the RSA key was the compromised one).

                        1. 1

                          The lack of SSHFP records in the first place should be concerning :/

                          1. 6

                            No. SSHFP is a flawed design. The idea here is that it is protected by DNSSEC. However DNSSEC only protects the connection between the authoritative nameserver and the resolver. Unless you’re using ssh on a server that also runs its own DNS resolver, the SSHFP record will not be protected from man in the middle attacks, and is therefore not a security mechanism.

                            1. 2

                              However DNSSEC only protects the connection between the authoritative nameserver and the resolver.

                              It doesn’t have to be that way. In major linux distributions, resolv.conf is managed which systemd-resolved, and it proxies DNS records after validate DNSSEC records, before handing them over (locally) to the libc or the application reading looking up the resolver address in resolv.conf.

                              So yes, in the hold times clients were not protected by DNSSEC, but since 2-3 years, in Debian/Fedora/(most distro with systemd) DNSSEC is enabled, thus increasing security.

                              1. 1

                                Not true. systemd-resolved checks DNSSEC, but doesn’t enforce it by default. It has no security value unless you manually configure it differently. See: https://www.freedesktop.org/software/systemd/man/resolved.conf.html

                                “DNSSEC= […] Defaults to “allow-downgrade”.”

                              2. 1

                                If your server is not running its own validating resolver, then your server is wrong

                                1. 1

                                  It is irrelevant what the server does. The key gets validated on the client.

                                  1. 1

                                    Unless you’re using ssh on a server that also runs its own DNS resolver

                                    I was replying to this. You should indeed be doing this.

                                    If what you meant was “maybe you’re using ssh not on a server” then sure, but you can/should also run a validating resolver for your local internet.

                              3. 2

                                I try not to find the matters of DNS records raise my adrenaline levels no matter my personal preference.

                        2. 4

                          Please note that this issue was not the result of a compromise of any GitHub systems or customer information. Instead, the exposure was the result of what we believe to be an inadvertent publishing of private information.

                          How can exposing a private key not be compromise?

                          1. 19

                            Because it was presumably a mistake by someone working at Github, and not an external party deliberately trying to get hold of the private key.

                            1. 14

                              To be clear, the exposing of a key itself was a compromise, but it was not the result of a separate compromise.

                              1. 7

                                It was in a public repo, so might have been downloaded. After that, there’s no way of knowing if it ended up in the hands of anyone malicious. If someone is able to fake your GitHub DNS reply (e.g. on a public WiFi network) then they can redirect you to a server that will accept your git pushes to private repos.

                            2. 1

                              Shame they didn’t enable secret scanning on that repo