github / github/codeql

[actions] Add detection for workflow_dispatch TOCTOU

オープン
#19,835 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

**Description of the issue**

There is a newer variation of GitHub Actions TOCTOU vulnerabilities known as "Workflow dispatch TOCTOU" - I wrote about a real-world example in a recent bug report writeup:

https://adnanthekhan.com/posts/dependabot-core-toctou-writeup/

I think this is a good candidate for a `High` detection where a PR has the following characteristics:

* Runs on workflow dispatch / repository dispatch with the PR number as an input parameter. Does NOT require a commit SHA.
* Checks out code from that PR without some approval check.
* Runs code.

High because there is a lot of context required to understand if a maintainer would _actually_ ever run the workflow on a fork, and that is not possible to determine via static analysis alone.

I believe this would require some code changes in the library code - adding a concept of a non externally triggered workflow that is intended to act upon untrusted code. This could then fire the UntrustedCheckoutTOCTOU alert

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、issue の workflow_dispatch および repository_dispatch シナリオと、ライブラリコードに既存する UntrustedCheckoutTOCTOU アラートを確認します。承認チェックなしで信頼できないコードに対して動作するワークフローをどのように表現するかを決定し、そのうえで、一致するワークフローが検出され、commit SHA を必要とするワークフローは検出されないことを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github-actions
領域
ci-cd, security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。