Skip to content

ls / - #3

Open
nahallacman wants to merge 1 commit into
mainfrom
HackingTime
Open

nahallacman wants to merge 1 commit into
mainfrom
HackingTime

Conversation

@nahallacman

@nahallacman nahallacman commented Sep 3, 2025

Copy link
Copy Markdown
Owner

What Is This?

This is a proof of concept on how an improperly escaped GitHub Action printing something like a PR title using echo can be used for executing code directly on an action runner.

The Hack

Many LLMs are suggesting code where you directly run commands directly that use user input as part of a string. This is dangerous as there is no sanitization of the symbol types that are being executed on the terminal. If dangerous characters like ` are added, a string can be escaped and a new command started.

This proof of concept just prints the root directly with a PR title:
image
but other malicious code could easily be run here like exporting API keys, downloading and running malware, and

What Can I Do?

  • Escape all text before running it directly in a terminal setting.
  • Ensure that there are protections against who can do things like:
    • Create PRs with user entered messages
    • Add commits with user entered messages to branches that get CI/CD ran on them
  • Ensure that new code added in a PR can't be run immediately, use pull_request_target instead of pull_request so the CI/CD code that is ran is what has already been merged safely.
    • Note that this only is safe if you have trusted people who can merge code. If anyone can merge a PR, this protected can be defeated.
  • Add layers of security to your environment, don't trust just access control of who can add code and open PRs to be your only mechanism to block this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant