You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As indicated in [**this blog post**](https://boostsecurity.io/blog/weaponizing-dependabot-pwn-request-at-its-finest), several organizations have a Github Action that merges any PRR from `dependabot[bot]` like in:
322
+
323
+
```yaml
324
+
on: pull_request_target
325
+
jobs:
326
+
auto-merge:
327
+
runs-on: ubuntu-latest
328
+
if: ${ { github.actor == 'dependabot[bot]' }}
329
+
steps:
330
+
- run: gh pr merge $ -d -m
331
+
```
332
+
333
+
Which is a problem because the `github.actor` field contains the user who caused the latest event that triggered the workflow. And There are several ways to make the `dependabot[bot]` user to modify a PR. For example:
334
+
335
+
- Fork the victim repository
336
+
- Add the malicious payload to your copy
337
+
- Enable Dependabot on your fork adding an outdated dependency. Dependabot will create a branch fixing the dependency with malicious code.
338
+
- Open a Pull Request to the victim repository from that branch (the PR will be created by the user so nothing will happen yet)
339
+
- Then, attacker goes back to the initial PR Dependabot opened in his fork and runs `@dependabot recreate`
340
+
- Then, Dependabot perform some actions in that branch, that modified the PR over the victim repo, which makes `dependabot[bot]` the actor of the latest event that triggered the workflow (and therefore, the workflow runs).
341
+
342
+
Moving on, what if instead of merging the Github Action would have a command injection like in:
Well, the original blogpost proposes two options to abuse this behavior being the second one:
355
+
356
+
- Fork the victim repository and enable Dependabot with some outdated dependency.
357
+
- Create a new branch with the malicious shell injeciton code.
358
+
- Change the default branch of the repo to that one
359
+
- Create a PR from this branch to the victim repository.
360
+
- Run `@dependabot merge` in the PR Dependabot opened in his fork.
361
+
- Dependabot will merge his changes in the default branch of your forked repository, updating the PR in the victim repository making now the `dependabot[bot]` the actor of the latest event that triggered the workflow and using a malicious branch name.
0 commit comments