Found the error Not allowed to load local resource: file:///etc/passwd while looking at infosec.pub’s communities page. There’s a community called “ignore me” that adds a few image tags trying to steal your passwd file.

You have to be extremely poorly configured for this to work, but the red flags you see should keep you on your toes for the red flags you don’t.

  • himazawa@infosec.pub
    link
    fedilink
    English
    arrow-up
    12
    ·
    edit-2
    2 years ago

    Is this, by any chance, originated from the sub called ignore me? In that case is probably my bad because is set as the image of the channel. I was playing with lemmy in the previous version and forgot about it, sorry.

    It will not work since your browser can’t access local file that easily without breaking the sandbox :) also the that alert appears because your browser is trying to load an image with that path, nothing dangerous or remotely exploitable, don’t worry.

    Edit: I removed it so you shouldn’t see the alert anymore.

    P.S. not, it’s not trying to steal anything, it’s your browser trying to load that file as an image but instead of being let’s say this url: https://beehaw.org/pictrs/image/c0e83ceb-b7e5-41b4-9b76-bfd152dd8d00.png (this sub icon) , it’s this one file:///etc/passwd so you browser is doing the request to your own file. Don’t worry, nothing got compromised.

    /cc @[email protected]> BE

    • BlueBockser@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      But… why? Why even put that URL there? Even if it was most likely harmless for all users, this still looks like an attempt at data exfiltration.

      • himazawa@infosec.pub
        link
        fedilink
        English
        arrow-up
        5
        ·
        2 years ago

        Because I wanted to try if others URI schemas were supported instead of http / https. file:// was a valid one. Don’t worry, the day an attempt of data exfil will happen, you will not see it though your console logs.

      • jcg@halubilo.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago

        I doubt this person ever expected anyone to find it or to read that much into it lol

  • Farthom@lemmy.ca
    link
    fedilink
    English
    arrow-up
    6
    ·
    2 years ago

    Holy shit this is kind of unsettling. Though I would expect ALL major browsers to reject reading any local files like this… would this kind of thing actually succeed somewhere/somehow?

    • Rooster@infosec.pubOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      2 years ago

      If you ran your browser as root and configured your browser to load local resources on non-local domains maybe. I think you can do that in chrome://flags but you have to explicitly list the domains allowed to do it.

      I’m hoping this is just a bad joke.

        • Greg Clarke@lemmy.ca
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          2 years ago

          Are you sure? What do you get when you run $ cat /etc/passwd in terminal? Just paste the results here 😇

          Edit: to anyone reading this on the future, don’t actually do this, it was a joke

          • fox@vlemmy.net
            link
            fedilink
            English
            arrow-up
            7
            ·
            2 years ago

            yup pretty sure

            $ cat /etc/passwd
            fox:hunter2:1000:1000::/home/fox:/usr/bin/zsh
            

            😉

          • delial@lemmy.sdf.org
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            2 years ago

            Since you told me not to. There isn’t a risk on most linux systems; passwords were moved to /etc/shadow a long time ago. It only leaks the names of your users and largely useless info for most attackers:

            root:x:0:0:root:/root:/bin/bash
            daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
            bin:x:2:2:bin:/bin:/usr/sbin/nologin
            sys:x:3:3:sys:/dev:/usr/sbin/nologin
            sync:x:4:65534:sync:/bin:/bin/sync
            games:x:5:60:games:/usr/games:/usr/sbin/nologin
            man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
            lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
            mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
            news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
            uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
            proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
            www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
            backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
            list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
            irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
            gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
            nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
            _apt:x:100:65534::/nonexistent:/usr/sbin/nologin
            systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
            systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
            messagebus:x:999:999:System Message Bus:/:/usr/sbin/nologin
            systemd-timesync:x:998:998:systemd Time Synchronization:/:/usr/sbin/nologin
            systemd-coredump:x:997:997:systemd Core Dumper:/:/usr/sbin/nologin
            delial:x:1000:1000:,,,:/home/delial:/bin/bash
            sshd:x:103:65534::/run/sshd:/usr/sbin/nologin
            xrdp:x:104:110::/run/xrdp:/usr/sbin/nologin
            dictd:x:105:111:Dictd Server,,,:/var/lib/dictd:/usr/sbin/nologin
            nm-openvpn:x:106:112:NetworkManager OpenVPN,,,:/var/lib/openvpn/chroot:/usr/sbin/nologin
            sssd:x:107:113:SSSD system user,,,:/var/lib/sss:/usr/sbin/nologin
            
            • marvin@lemmy.sdf.org
              link
              fedilink
              English
              arrow-up
              4
              ·
              2 years ago

              Well it’s not completely useless. It offers some insights into the system. Which service accounts exists, what usernames are used.

              If an attacker finds a valid username they can then start bruteforcing the password.

              From your account list we can see you have sshd and xrdp. Do they both provide the same kind of bruteforce protection? Are there any recent exploits for either?

              • delial@lemmy.sdf.org
                link
                fedilink
                English
                arrow-up
                1
                ·
                2 years ago

                That’s why I said largely useless. An attacker can narrow down the attack surface by ignoring anything that can’t login, but that just leaves them with root and delial, and they already knew or could’ve guessed both of those pieces of information (in this context anyway).

                And as you noted when looking at the service accounts, they might be able to login or crack their way in via xrdp or sshd. So, unless you’re port-forwarding those protocols from the internet, how useful is that really? I would say largely useless. Assuming they port-scanned your public IP, they still need either an insecure config or an unpatched, remotely exploitable bug.

                That being said, you’re totally right. The average Linux user isn’t “administering” their system, so they probably aren’t following their distribution’s security mailing list, installing security patches as they’re released, and actually RTFM. It’s best for the average user to play it unbelievably safe.

                In this case, the machine isn’t actually running xrdp, and sshd doesn’t accept passwords or root logins. (Although, I need to setup knockd to protect that non-standard sshd port a bit more.) All passwords used on the system are random and longer than 32 characters. My router doesn’t port-forward to this machine, either.

                This has been an exercise of Cunningham’s Law for the benefit of those reading.

  • PenguinCoder@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    Nice share, thanks for the information. Definitely need to be careful both as a server operator with Lemmy, and a user of it.

  • laenurd@lemmy.lemist.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 years ago

    While this is concerning, I wonder what the author(s) of this were thinking would happen. I assume it’s supposed to be an attempt at stealing the server’s passwords, since I at least know of no browser that freely allows access to local files.

    • ollien@beehaw.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      FWIW, /etc/passwd itself contains no passwords (the name exists for historical reasons) but it definitely is a globally accessible file that can give you clues about the target system. Given this, it’s more likely the user is attempting to find out if arbitrary disk reads are possible by using a well known path on many servers.