The Register Home Page

back to article GitHub supply chain attack spills secrets from 23,000 projects

It's not such a happy Monday for defenders wiping the sleep from their eyes only to deal with the latest supply chain attack. StepSecurity disclosed a compromise of the popular GitHub Action tj-actions/changed-files, which works to detect file changes in open source projects, noting that more than 23,000 GitHub repositories …

  1. Anonymous Coward
    Anonymous Coward

    The "delete this action and find an alternative" seems kind of dumb advice. The vulnerability has been found, fixed, dodgy commits cleaned up and steps have been taken to prevent it happening again. Arguably this repository/organization is now more secure and has a better security posture than before. By switching surely you're now potentially swapping to an action written by someone else that's less maintained?

    I am using this action in a couple of places, but went through the pain of pinning all actions to the commit SHA so I feel slightly vindicated now.

    1. David 132 Silver badge
      Happy

      "Oh, I see there is now since yesterday a tk-actions/changed-files-clean-safe-honest repo, that must be a new updated version, I will switch to using that one instead, because what could possibly go wrong with blindly and unthinkingly pulling in unseen code from a complete stranger?"

  2. m4r35n357 Silver badge

    Put M$ in charge of your CI . . .

    . . . and see what happens ;)

    People never learn.

    1. ecofeco Silver badge
      Holmes

      Re: Put M$ in charge of your CI . . .

      "The only thing we learn from history is that we do not learn from history."

      -Georg Hegel 1820-something (series of lectures)

      1. Anonymous Coward
        Anonymous Coward

        Re: Put M$ in charge of your CI . . .

        "The only thing we learn from history is that we do not learn from history."

        Complementing: History does not repeat, but it rhymes

    2. Matt Dainty

      Re: Put M$ in charge of your CI . . .

      I love a cheap shot at micros~1 as much as the next person, but to be fair, this wasn't their fault.

      There's a third party marketplace for actions you can use in your GitHub workflows to save you reinventing the same wheels over and over again. It just so happened that one of those actions was compromised.

      1. m4r35n357 Silver badge

        Re: Put M$ in charge of your CI . . .

        GitHub is yet another example of M$ taking something good (Git) and enshittfying it for public consumption. If your IT dept. understands Git and SSH you don't need insecure walled-up "actions" in the first place, or even a GitHub account. If not, Hahahahah!!!

        Also, people should not have ANY sensitive information on there to leak - would you agree with that?

        Any damage they suffer through using GitHub is therefore self-inflicted.

  3. ecofeco Silver badge
    FAIL

    LOL, and who owns Github?

    Rhetorical question.

    Horses for courses.

    1. IGotOut Silver badge

      Re: LOL, and who owns Github?

      And you of course know GitHub was a clusterfuck before MS don't you?

      1. m4r35n357 Silver badge

        Re: LOL, and who owns Github?

        It was a pretty damn useful software distribution centre to start with. The bells & whistles were just an enticement for the unwary. It could probably be done much more effectively in plain HTML, but even that is not necessary for a Git distribution site.

  4. sev.monster

    Rather, put some people you've never met and have no contract with or support from in charge of your CI. At least large orgs would be protected if they dealt directly with people, but nowadays it's common to use whatever off the shelf solution exists without properly vetting it.

    1. ecofeco Silver badge

      Something, something, world, oyster, pearl, dark hole, stinky fingers, no pearl.

      Shocked Pikachu faces.

  5. Terry 6 Silver badge

    Well beyond my competence, but....

    Do I detect the creak of stable doors being being closed while horses vanish off into the distance?

    1. Anonymous Coward
      Anonymous Coward

      Re: Well beyond my competence, but....

      Yes, but this is to remind users to check their repos for keys and such that their predecessor and/or coworkers should never have uploaded. If you don't think they're doing the same thing because they don't trust you, you're deluding yourself.

  6. malfeasance

    Not impacted but rotated anyway

    I have pinned usage of tj-actions to a versioned sha hash. Dependabot updates me with a PR if it changes.

    The last PR was Feb 10 (long ago) to 45.0.7 with a subsequent PR once again at the weekend to a new hash.

    Ostensibly I would not have been affected but I rotated keys anyway.

    I’m not sure I understand how projects would have been affected because my usage model seems quite vanilla.

    1. Anonymous Coward
      Anonymous Coward

      Re: Not impacted but rotated anyway

      "I have pinned usage of tj-actions to a versioned sha hash"

      Kudos for you. You are one of the few whom do not directly link their JS/other stuff being used - in their pages - to Google and the likes. Most devs do link their stuff without pinning and are susceptible to chain attacks.

  7. Ashto5

    Really ??

    Someone never learn, a package is someone else’s code you are seriously putting your business at risk.

    1. hh121

      Re: Really ??

      I've asked the same thing before and got nothing serious in reply - how do you trust any code from some rando on the interwebs, whether it's Linux distros, Github packages, Nuget packages and all the rest? At least with something provided by Microsoft/IBM/HP et al, you know they vetted their staff before hiring them, or you know who to sue if it all goes really pear-shaped.

      1. Zippy´s Sausage Factory

        Re: Really ??

        Wait, Microsoft and HP are vetting staff?

      2. David Pearce

        Re: Really ??

        Except that you have probably agreed that you cannot sue them in a 50 page EULA

      3. Anonymous Coward
        Anonymous Coward

        Re: Really ??

        Classic xkcd:

        https://xkcd.com/2347/

        And remember: curl / libcurl is used from TV sets to nuclear power plants

      4. m4r35n357 Silver badge

        Re: Really ??

        Learning who to trust is a life skill. Nobody can tell you that.

        Asking who to trust is an admission that you do not have it yet. Saying "at least" only amplifies that.

        Assuming you will be able to sue "Microsoft/IBM/HP et. al." is delusional.

        1. hh121

          Re: Really ??

          Your point is taken, but it doesn't address the basic problem of who is putting that software out there, how do you know who they are and if they can be trusted. You seem to think I can figure that out somehow for the millions of packages out there, but that shouldn't be my job, nor the job of everyone else out there to clear that hurdle. Just like everyone reads every EULA completely and understands it. Not.

          Perhaps a better way of putting it would be that Microsoft/HP/IBM et al would suffer incredible reputational damage and loss of business ($$$) if they allowed someone to put something malicious into their packaged software. They are therefore far more likely to put significant resources and safeguards into their process, which is what I saw (from a distance) when I worked there a very long time ago.

          And in this sort of scenario it wouldn't be me sueing Microsoft, it would be major corporations with an axe to grind, or governments threatening sanctions. I am certainly not delusional enough to try that myself.

          Someone sneaking a package into github probably doesn't give a monkeys, specially if they're safely squirreled away in North Korea or Russia.

  8. frankyunderwood123 Silver badge

    Busy day for some

    The org I work for is very switched on. Private repos are scanned for secrets constantly. We don’t use GitHub actions. Frequent and strict security training for all employees, however..,

    It’s still going to be a busy day. I suspect there will be a mandatory credentials reset.

    The bottom line is don’t store secrets in GitHub repos. Use a secrets manager as part of the deploy pipeline.

    1. Matt Dainty

      Re: Busy day for some

      This wasn't really anything to do with storing secrets in the repository, if that was the case anyone could just clone a public repository and pick through it. Good advice nonetheless though.

      GitHub provides safe secret storage, (it's all based on public key crypto if you peek under the hood), but at some point you have to provide those secrets to your pipeline(s), in the clear, unless every tool knows how to directly speak to your chosen secrets manager.

      Normally what happens is any GitHub secrets used automatically install a filter such that any time that secret value is logged, it gets ***'d out, which can be mildly amusing if you're testing things and set the secret value to something fairly commonplace that occurs naturally in your logs, i.e. set a secret with a value of "test", anywhere "test" appears in your logs, even if it's nothing to do with that secret, it gets ***'d out.

      Because secrets are write-only if you ever forget what you set the secret to, you can't just run an action that logs it because it will get masked out as above, but you can pipe the secret value through base64 or similar encoding and log that, the filters are not (yet) clever enough to catch that. You can then pick the encoded value out of the logs and decode it. This is basically what the attack was doing.

      1. m4r35n357 Silver badge

        Re: Busy day for some

        M$ provides safe secret storage - do you mean they don't have access to your data?

  9. Claptrap314 Silver badge
    Megaphone

    This is unfixable

    Git uses SHA-1, which is fine if you are not being attacked. The system relying on SHA-1 for protection, however clearly is broken. This is a BIG DEAL.

    1. Anonymous Coward
      Anonymous Coward

      Re: This is unfixable

      A SHA-1 collision that is still a valid GitHub action that still does what it's supposed to do, _and_ contain a trojan?

      I'll take those odds.

    2. m4r35n357 Silver badge

      Re: This is unfixable

      Do keep up. It uses SHA-1 for hashing, not security.

      Git is not inherently secure or insecure. If you protect it with SSH then it has the security of SSH.

      1. Jon 37

        Re: This is unfixable

        Git uses SHA-1 for hashing, not security. That is okay.

        However, as soon as someone writes code to "get the code with this SHA hash from someone else's Git repo and run it", then the SHA is being used for security. It's the only thing authenticating that the code being run is what you intended to run. That's one of the options that GitHub provide.

        Now, you might be happy with that level of security. Or you might not. Personally I would be a lot happier using SHA3-256, although even SHA256 would be an improvement.

        1. m4r35n357 Silver badge

          Re: This is unfixable

          That fantasy is covered by the AC post above. I suppose it is at least one level above "hit yourself with a hammer", but these days I can't claim to be surprised any more at weird dev practices.

          We used to be specifically taught not to do that with shell scripts without reading them first . . .

          I trust Linus to understand the implications, and there are reams of posts about this on the LKML going back to the early days of Git, for any historians here.

          1. hh121

            Re: This is unfixable

            How much code does Linus actually look at (or amyone else you can name and actually trust), versus the swathes of code that gets lumped together in a distro, or randomly downloaded in some addon, just 'because'.

            Ain't no million eyes on every element, let alone trustworthy eyes or even competent.

            1. m4r35n357 Silver badge

              Re: This is unfixable

              Please read and understand the AC comment above, as well as mine.

              Tossing in "truisms" might appear wise, but does not add to the discussion.

              1. hh121

                Re: This is unfixable

                I saw the AC comment and I have no opinion on SHA-1, collisions etc, nor claim any expertise. Certainly wouldn't comment on it. I was referring to the idea that Linus looks at everything up and down the stack.

  10. This post has been deleted by its author

  11. This post has been deleted by its author

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like