-
Notifications
You must be signed in to change notification settings - Fork 6
36 lines (32 loc) · 1.14 KB
/
Copy pathgithub-env.yml
File metadata and controls
36 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# github-env.yml
#
# what:
# this vulnerability compounds with dangerous Workflow triggers,
# like pull_request_target.
#
# since the triggered Workflow runs in the context of the upstream repository,
# in the proper scenario an attacker can manipulate what goes through
# $GITHUB_ENV, either adding new variables to the environment or tweaking
# existing well-known ones (e.g. variables used by programming languages)
#
# how:
# user error.
#
# see also:
# - https://www.synacktiv.com/en/publications/github-actions-exploitation-repo-jacking-and-environment-manipulation
# - https://securitylab.github.com/advisories/GHSL-2024-177_Litestar/
on:
# NOT OK: pull_request_target enables this attack
pull_request_target:
permissions: {}
jobs:
vulnerable:
runs-on: ubuntu-latest
steps:
# NOT OK: attacker-controlled $TITLE can lead to code execution by setting
# an environment variable like $LD_PRELOAD, for example
- run: |
message=$(echo "$TITLE" | grep -oP '[{\[][^}\]]+[}\]]' | sed 's/{\|}\|\[\|\]//g')
echo "message=$message" >> $GITHUB_ENV
env:
TITLE: ${{ github.event.pull_request.title }}