Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

Find Comment, Get Shell: Command Injection in dbt’s GitHub Actions- 2091

Lupin & HolmesPosted 26 Days Ago
  • The authors of this post were reviewing a GitHub project named dbt that relied on the GitHub Action find-comment. This Action is a utility for searching an issue, pulling request comments, and returning matching content to the next workflow. The bug isn't in find-comment; it's an integration issue with it in dbt.
  • The custom workflow is responsible for opening documentation issues across repositories. There is functionality to check if the comment has been placed in already. To perform a lookup, it uses the find-comment Action via string matching. The workflow returns these outputs, and adds them directly to a bash script, leaving it vulnerable to command injection.
  • Why would the bot have a command injection payload? It doesn't! However, the workflow only matches text, and doesn't check the sender of the message. Thus, there's a time of check vs. time of use issue: post the comment before the bot does. The workflow will then use the attackers comment instead of the bots, leading to command injection in the workflow. The workflow contains FISHTOWN_BOT_PAT, a token used to perform actions across repositories.
  • They found this bug using pure AI. An agent analyzed the repository, and noticed that the comment could be an interesting code injection sink. After reviewing the flow, it found the TOCTOU issue. Next, it created a small lab to test out the issue locally to confirm the bug. Overall, a good post on a CI/CD bug in the repository.