Forgejo 16.0.3以前に深刻なRCE、テンプレート展開が悪用され任意コード実行
Forgejo <=16.0.3 Critical RCE
Forgejo 16.0.3以前に、テンプレートリポジトリからのリポジトリ生成機能を悪用したリモートコード実行(RCE)の脆弱性が見つかった。変数テンプレート展開で新たな.gitフォルダを作成でき、gitの初期化時に取り込まれてしまう。悪意あるテンプレートにより、Forgejoホスト上の任意データの読み取りや任意プロセスの実行が可能になる。修正版16.0.4では、変数展開後に既存の.gitフォルダを削除する。
悪意のあるテンプレートリポジトリを利用して、Forgejoホストから任意のデータを読み取ったり、Forgejoホスト上で任意のプロセスを実行したりすることが可能であり、リモートコード実行攻撃に該当します。
HNでの議論
62- amiga386
URLは https://codeberg.org/forgejo/forgejo/milestone/139655 に変更すべきです。
> PR: Critical: fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the .git folder, performs variable template expansion on files listed in .forgejo/template, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new .git folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized.
- techknowlogick
私に質問があったのでここにだけ投稿します。Giteaはこれらの問題の両方から保護されています。
(バイアス注:Giteaのプロジェクトリーダーシップの一部です)
編集:注記として、セキュリティインシデントは誰にでも起こるものであり、報告した人を非難すべきではありません。特にそうすることで全体的に報告される問題が減ってしまうからです。
- keel-control
彼らがLLMの貢献を禁止した後、最初に思ったのはこれでした。
彼らは脆弱性のチェックにAIを使わないかもしれませんが、攻撃者は使うでしょうから、それで不利になるのです。
- Macha
codebergのレート制限のためリリースノートが現在読めないので、リリースノートにある2つの修正は以下の通りです:
https://codeberg.org/forgejo/forgejo/pulls/14301:
*Critical:* fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the `.git` folder, performs variable template expansion on files listed in `.forgejo/template`, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new `.git` folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing `.git` folder is removed from the directory before the git repository is initialized.
https://codeberg.org/forgejo/forgejo/pulls/14301:
ensure authorization reducer is accessed when checking editable PRs in APIs. When editing a git repo contents through Forgejo's API, a specialized security control is used to permit repository maintainers to edit branches that they do not own when an open pull request with the "allow maintainer edit" option is present. This specialized security control did not take into account API-specific security res […]
- jzebedee
関連する変更:
Security bug fixes
PR: Critical: fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the .git folder, performs variable template expansion on files listed in .forgejo/template, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new .git folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized.