Just a random thought experiment. Let’s say I have my account on a lemmy instance: userA@mylemmy.com. One day I decide to stop paying for the domain and move to userA@mynewlemmy.com, and someone else gains it and also starts up a lemmy instance.

If they make their own userA@mylemmy.com, how do federated instances distinguish who’s who?

Have I misunderstood the role of domain names in this?

  • heartlessevil@lemmy.one
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    I imagine it works exactly like email where it is possible to inherit someone else’s expired domains.

    Checking out the relevant specifications: ActivityPub and WebFinger

    • Both of them identify users by URL, there is no numeric ID, UUID, or public key.
    • Using IDs or UUIDs would not be secure since the imposter could just copy the ID from the previous user as well as the username and domain name.
    • Verifying identity would necessitate the user having a public key as their unique identifier, and federated servers performing a challenge-response that requires the user to have the corresponding private key for that public key.

    In conclusion, it certainly seems like you could take over someone else’s domain name, and I suspect that public key cryptography is the only way to avoid this.

    (edited to add: expired domains aren’t the only attack surface here, domain takeover is also a thing, either by transferring the domain or simply changing the DNS records.)

  • Setarkus.LW@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    I don’t think you have to worry about that since user’s data should be stored on the instance they registered on, which means that data should only be stored on those servers (I don’t think that kind of data would be federated, correct me if I’m wrong).
    So unless someone were to restart those servers with the same domain name and the data intact, it shouldn’t happen.

    • fubo@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I’ve only read the ActivityPub spec; I haven’t read the Lemmy code.

      With that in mind, my impression is —

      The new domain owner — if they set up an ActivityPub server instance (e.g. a Lemmy) and got a list of the old user’s post URLs — might be able to delete or edit the old user’s posts stored on other instances. That is a vulnerability, albeit a small one.

      If the old user was still listed as a moderator of communities hosted on other instances, the new domain owner might be able to take over that moderator role.

      One way to fix this would be for instances to issue a public-key cryptographic identity to each user, and distribute users’ public keys to other instances. Then activities purporting to be from that user would need to be signed by that user’s private key.

      Users’ private keys would stay local to their home instance, so users don’t have to do any key management themselves.

      This would mean that if an instance goes away (and its key material is destroyed) then nobody can ever act as any of those users again. A new user created with the same username and domain would be a distinct user for all other instances too.

      • 𝘋𝘪𝘳𝘬@lemmy.ml
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        That is a vulnerability, albeit a small one.

        “Small one” is very wrong here. This is by far the largest gaping security hole in the whole specification.

        • Vlyn@lemmy.ml
          link
          fedilink
          English
          arrow-up
          0
          arrow-down
          1
          ·
          1 year ago

          Since when is stealing a domain name easy? If it would be then google.com would redirect to another scam site every five minutes.

          The only way you’re going to steal a domain is if the owner stops paying for it.

          If you steal gmail.com you could impersonate anyone with a gmail email address. How is that an argument?

          • 𝘋𝘪𝘳𝘬@lemmy.ml
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Since when is stealing a domain name easy?

            You either social engineer the needed data or hack the domain owner and change the Admin-C or Tech-C and then either directly or by request change the IP for that domain. You could also bribe some one working there or someone who works for the registrar or somehow gain access to the mail account of Admin-C or Tech-C.

            https://www.hackingloops.com/domain-hijacking-how-to-hijack-domain-names/

            You could also try to poison the instance’s DNS cache so the domain in question is resolved to an IP where the server is under your control.

            https://en.wikipedia.org/wiki/DNS_hijacking

            You could also register domain names that are either unpaid for whatever reason and thus marked as in transit and if the transit period is over you just claim the address.

            https://en.wikipedia.org/wiki/Domain_drop_catching

            And since you mentioned google.com:

            https://money.cnn.com/2016/01/29/technology/google-domain-purchase/index.html

            To recite @[email protected]: Depending on DNS for security is generally a bad idea.

            • Vlyn@lemmy.ml
              link
              fedilink
              English
              arrow-up
              0
              arrow-down
              1
              ·
              1 year ago

              Sure, but if you lose your domain you already lost. That’s it, game over.

              I do agree it would make sense to issue every Lemmy instance and every user an asymmetric key pair they can sign against, just for extra security. But that might also break things because instances per domain are no longer unique. You can have lemmy.ml@publickey1 and then lemmy.ml@publickey2 and then lemmy.ml@publickey3 and so on. It would be an absolute mess.

              This doesn’t even have to be an attack. A new instance owner might decide to re-setup their instance and nuke everything or they simply lost the data. Or on a faulty Lemmy update things break and the private key gets regenerated or jumbled up. Especially right now in the early stages of this platform where things are bound to go wrong you don’t want to accidentally nuke an entire instance.

              What do you do then if a legitimate owner sets up the instance under the same domain again?

              Besides that, if an instance really gets removed (which basically happens if someone takes over the domain, they don’t have access to the instance data itself) other instances can simply defederate in an emergency. Though the only damage would be moderator accounts on other instances. The content is dead the moment the instance dies anyway (there just isn’t a mechanism yet to clean it up if there is no delete events being sent, but that will probably come).

              • 𝘋𝘪𝘳𝘬@lemmy.ml
                link
                fedilink
                English
                arrow-up
                0
                ·
                1 year ago

                You can have lemmy.ml@publickey1 and then lemmy.ml@publickey2 and then lemmy.ml@publickey3 and so on.

                The key should OF COURSE not be a part of the URL. It should also not be instance specific or specific to a certain federated server. It should be in the protocol itself. A field in the Actor object where a public key can be placed and then whenever an action is done, it gets signed. The private key stays with the user.

                All of your other considerations would automatically become non-issues, since the key pair stays with the user and not on the instance. As long as the public key field is intact it can be verified that the action was performed by a specific actor. And if not, it can be seen as unverified.

                You could also bind administrative activities to key-based authentication.

                • Vlyn@lemmy.ml
                  link
                  fedilink
                  English
                  arrow-up
                  0
                  ·
                  1 year ago

                  This was an example, not an identifier.

                  lemmy.ml is the domain. And the instance on that domain has a private and a public key.

                  If you nuke your first instance and recreate it the keys will be different, which means you suddenly have two different instances for lemmy.ml when the new instance starts to federate. Which basically is lemmy.ml-1, lemmy.ml-2, …

                  So what should other servers do? Only accept the first public key they ever saw for a domain as an instance? Then block new instances from the same domain? Or is there a way to differentiate the instances? Or do you nuke all content of an old instance when a new one pops up with a different public key?

                  If someone creates a second instance for the same domain all hell breaks loose either way. Because the new instance can have [email protected] that already existed with the old public key. Should federation just crash at that point? Throw an error? Block this user because it existed in the past? Treat it as a new user, but with the same name (which would be horrible UI wise)?

          • monobot@lemmy.ml
            link
            fedilink
            English
            arrow-up
            0
            ·
            edit-2
            1 year ago

            You would be surprised: https://money.cnn.com/2016/01/29/technology/google-domain-purchase/index.html

            Google.com, one of the most valuable domains on the Internet, was mistakenly sold for $12 last fall.

            Google paid $12,000 to get it back.

            But you are right about email, it is about the same.

            But with time we could be more careful in federation to keep track of domains expiration dates and owners.

            Maybe just instances need to be verified with public/private keys and not all accounts on them.

            • Vlyn@lemmy.ml
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 year ago

              It absolutely makes sense to secure content and especially moderator positions in other communities by public/private keys.

              But look at my replies to /u/Dirk below. If someone actually takes over a domain, sets up a new Lemmy instance and creates the same user again (but without matching keys), how should other instances treat that user? Like a new one? Or block all federation? Do you get warnings interacting with that user (as they could just write another community moderator to invite them “again”)?

              • monobot@lemmy.ml
                link
                fedilink
                English
                arrow-up
                1
                ·
                1 year ago

                All valid arguments, code needs to be checked abou what is possible to implement. Even if we start with one way of dealing with those instances, it will be possible to chamge in the future.

                Thank you for good discussion in this thread.