Allow php-fpm to protect users/website operators on a multi-user system against each other
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
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:
-
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.
-
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét việc xử lý pool PHP-FPM và Unix socket, sau đó so sánh các cơ chế kiểm soát được yêu cầu với open_basedir và hành vi của suexec được đề cập trong issue. Xác định cách có thể định nghĩa các kiểm tra về vị trí script, quyền sở hữu và bit thực thi mà không hạn chế quyền truy cập vào các tệp dữ liệu. Công việc được xem là hoàn tất khi mô hình bảo mật và hành vi cấu hình được đặc tả đủ rõ ràng để triển khai và kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- backend, security
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100