‹ BackHN Continuity

Thread

Sourcehut account takeover via build logs (XSS in ansi2html)

153 points · 29 comments · arusekk

  1. vhantz · · focus · HN ↗
    > The worse impact is that you have access to all the deploy keys, and on builds.sr.ht, there are deploy keys for sr.ht itself (probably not the case with other instances).

    This is the most unexpected bit.

    Circumstances made it so I got a new computer right around the time srht put out their anti-LLM policy. So I immediately started setting up a forgejo instance on my home network. With the latest waves of attacks on he AUR, I decided to keep that machine completely free from all AUR packages or helpers. So I also set up a package registry through the forgejo instance. With some work I have a workflow that takes a PKGBUILD and publishes an arch package that I can just `pacman - Syu` to install. Obviously I only put my own pkgbuilds and the few I have manually vetted there.

    Even after manual vetting I wanted to lock things down as much as possible on the CI. So. I went with rootless podman, and some patching of arch's build infra just to get it to be able to run `pkgctl build`.

    One of the main thing I looked out for was making sure no credentials were available anywhere during the jobs where the pkgbuilds (which can contain arbitrary commands) are being executed. I'm sure srht has to consider many more scenarios than I do. That will definitely make it harder to wall off credentials access. But it is still surprising that deploy keys are left laying around.

    BTW this is not an attack on srht. I stopped actively using it because of their new policy. I still have a paid subscription that I do not plan to cancel anytime soon. I still have my public projects where I don't use LLMs there. I think opinionated maintainers and projects (Linus/linux, Poettering/systemd and Drew come to mind) are a net good for open source. Opinionated people make better software because they care imo. And those opinions don't have to be restricted to purely technical matters.

    But anyway, it's a small team and there is a lot to cover, but they should get those leaking keys under control as much as possible.

    1. arusekk · · focus · HN ↗
      I think you might have misunderstood. The source code of SourceHut itself is hosted on SourceHut, and it has a CI/CD setup that packages the microservices as alpine packages, signs and uploads them automatically to mirror.sr.ht, as files. This is no different than having a pypi-upload action (or similar) on GitHub.

      The only material difference is that the deploy keys for *.sr.ht present (by design) on builds.sr.ht also have access to `doas apk upgrade -Ua` and to `doas rc-service *.sr.ht restart` on the production infra. Which is harmless by itself, but might result in Continuous Ownage if a rogue build happens to have access to the keys.

      1. vhantz · · focus · HN ↗
        Yeah that's the same thing I do. Except the credentials to upload or to interact with the infra in any way are not available during the build job in the workflow. Forgejo reuses the same GitHub conventions so initially they were all available there too
    2. zenoprax · · focus · HN ↗
      Is your Forgejo+AUR workflow available? I'm looking to do the same (plus Vagrant and OCI images). Getting a headstart on hardening would be a boon.
      1. vhantz · · focus · HN ↗
        It's a lot of different parts, the workflow itself is pretty straightforward. It is also all archlinux oriented because that's what I use everywhere. I'll try and clean it up over the weekend and make it available somehow. Where can I reach you once that's done?
        1. zenoprax · · focus · HN ↗
          Thanks, I appreciate it. Email to hn@zenoprax.com will reach me (reply will be from my real email).
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.