php / php/php-src

Allow php-fpm to protect users/website operators on a multi-user system against each other

オープン
#15,499 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Feature SAPI: fpm Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

Right now, there seems to be no obvious way to make sure that an PHP FPM pool for one user can only execute PHP scripts that actually belong to that user. I.e. Alice can connect to Bob's FPM pool's Unix domain socket, and ask Bob's pool to execute scripts under Alice's control, and usurp Bobs' identity.

Currently, neither of the approaches below work:

  1. protect the socket using listen_owner and listen_mode so that only user www-data may connect to it. Doesn't work, as Apache can be tricked using various .htaccess directives to connect to any backend. Not all of these directives can be disabled using AllowOverride and AllowOverrideList, as some of them (such as RewriteRule) have legitimate purposes, which are commonly used by popular CMS.

  2. Use php_value[open_basedir]
    Although this does allow to restrict the directory from which PHP scripts may be executed, it also applies to data files opened by the script. So it's not always possible to set it to a restrictive enough value to be truly secure.

=> What would be needed would be:

  • a way to set the directory from which PHP scripts may be called, without affecting from where data files may be opened
  • optionally, a switch to only allow FPM to execute PHP scripts that belong to the user of the FPM pool, without allowing to execute scripts which are writable by users other than that users
  • optionally, a switch to only allow FPM to execute PHP scripts whose execute bit is set (allows the user to explicitly flag those scripts that he wants to make accessible via FPM)

This corresponds more or less to what suexec does for CGI scripts.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず PHP-FPM プールと Unix ソケットの処理を確認し、次に要求された制御を open_basedir および issue で言及されている suexec の動作と比較します。データファイルへのアクセスを制限せずに、スクリプトの場所、所有権、実行ビットのチェックをどのように定義できるかを判断します。セキュリティモデルと設定の動作が、実装およびテストを行える程度に明確に仕様化されていれば完了です。

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

評価

技術スタック
php
領域
backend, security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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