Steal api key - #12
Open
nahallacman wants to merge 7 commits into
Open
nahallacman wants to merge 7 commits into
nahallacman wants to merge 7 commits into
Conversation
nahallacman
force-pushed
the
StealAPIKey
branch
from
September 3, 2025 20:20
d157526 to
469e45a
Compare
nahallacman
force-pushed
the
StealAPIKey
branch
from
September 3, 2025 20:22
469e45a to
410444d
Compare
nahallacman
force-pushed
the
StealAPIKey
branch
from
September 5, 2025 00:42
95462d7 to
9b9d6d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Is This?
This is a proof of concept showing how you don't need to exfiltrate data outside of GitHub to print a protected piece of information like an API key.
The Hack
In a pipeline, you can run code that uses environment secrets that may be sensitive. A good example of this might be an API key. By default the GitHub Actions environment prevents those keys from being printed in simple means like
echo "$API_KEY", turning the output from the API key contents to****.To get around this, we can use workflow dispatch to receive data from one pipeline and display it in another. The workflow that is dispatched does not have the same environment as the original pipeline, meaning the dispatched workflow does not know that the API key is a secret and does not censor it when it is printed.
This is a way to be able to exfiltrate the API key into another pipeline, and print out the sensitive data in the GitHub Action output. This contrasts with the typical sort of hack where people exfiltrate the API key to another URL they own, something that might be caught by platform security monitoring and reveals the URL that the API key was sent to for further inspection by a CIS team.
Where Is The API Key Displayed?
It gets sent to the workflow dispatch receiver, which is a different pipeline. You can find the example of the run where the API Key was leaked here:
https://github.com/nahallacman/GitHubActionSecurityTesting/actions/runs/17478722657/job/49644654264
What Can I Do?
ls /#3 to protect who can create PRs, create CI/CD code, etc.