[Bug] Security Bug: Switching PHP Versions Causes Protected Directory to Download PHP Source Code
Maintainer thường phản hồi trong vòng 1 ngày
@wanghe-fit2cloud đang làm issue này rồi.
Từ ngày 28/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Contact Information
No response
1Panel Version
2.4.1
Problem Description
A potential security vulnerability in 1Panel allows PHP source code to be downloaded when accessing a directory protected by Basic Authentication after switching the website's PHP runtime version.
The issue is consistently reproducible in a freshly installed 1Panel virtual machine. After switching the PHP version, accessing the password-protected directory causes the browser to download the actual PHP source code instead of executing it.
The downloaded file contains the complete, current source code, including comments. Modifying index.php on the server changes the downloaded content accordingly.
This may expose sensitive application source code and credentials.
Environment
- 1Panel: Fresh installation in a virtual machine
- Initial PHP runtime: PHP 8.5.12
- Target PHP runtimes tested: PHP 7.0 and PHP 8.3
- Web server: OpenResty 1.31.1.1-2-4-noble
- Authentication method: Basic Authentication (password protection for a directory)
Actual Behavior
Instead of executing PHP scripts, the browser downloads a PHP source file.
When accessing the directory directly, the downloaded file contains the PHP entry-point code. When explicitly accessing index.php, the browser downloads the website's actual index.php file.
The downloaded source code is complete and up to date. If the contents of index.php are modified on the server, the downloaded file reflects those changes, including comments.
Restarting the server does not resolve the issue.
The problem has been reproduced with both PHP 7.0 and PHP 8.3 after switching from PHP 8.5.
Disabling the browser cache makes the website accessible again, but the underlying cause of the source-code exposure remains unclear.
Expected Behavior
Switching the website's PHP runtime version should not affect Basic Authentication or PHP request handling.
PHP files in password-protected directories should always be processed by PHP-FPM and should never be served as downloadable source code.
Security Impact
This behavior may expose the complete PHP source code of a website to unauthorized users, potentially including database credentials, API tokens, authentication logic, and other sensitive information.
Because the issue is reproducible after switching PHP versions and persists across server restarts, it should be investigated as a potential high-severity security vulnerability.
Additional Notes
- The issue is reproducible on a freshly installed 1Panel virtual machine.
- The password protection works correctly before switching PHP versions.
- Removing the Basic Authentication configuration afterward does not immediately resolve the issue in the affected browser.
- The issue has been reproduced with PHP 7.0 and PHP 8.3; other target PHP versions have not yet been tested.
Please investigate whether switching PHP runtime versions causes incorrect configuration generation or location matching for directories protected by Basic Authentication, resulting in PHP files being served as static files.
Steps to Reproduce
- Install 1Panel in a virtual machine.
- Install the PHP 8.5 runtime environment.
- Create a website and configure it to use PHP 8.5.
- Configure Basic Authentication to protect a specific directory of the website (eg: /test/).
- Access the protected directory and verify that the password prompt appears and authentication works correctly.
- Switch the website's PHP runtime from PHP 8.5 to PHP 7.0 or PHP 8.3.
- Access the same password-protected directory again.
The expected correct result
No response
Related log output
Additional Information
No response
- Ngôn ngữ chính
- Go
- Star
- 37.3k
- Fork
- 3.4k
- Merge trung bình
- 10 giờ 13 phút
- Pull request đã merge (30 ngày)
- 99
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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.
Issue khác của 1Panel-dev/1Panel
-
[Feature] [Feature] 1Panel AI Gateway add image edit API edpointCó thể đã có người làm @wanghe-fit2cloud đã nhận 1 ngày trước. Đang mởtype: ai-gateway
1Panel-dev/1Panel#14247 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] 1Panel-Gateway Functional RequirementsCó thể đã có người làm @wanghe-fit2cloud đã nhận 1 ngày trước. Đang mởtype: ai-gateway
1Panel-dev/1Panel#14245 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] OpenResty Upgrade FailedCó thể đã có người làm @wanghe-fit2cloud đã nhận 1 ngày trước. Đang mởtype: optimization
1Panel-dev/1Panel#14242 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] Scheduled Website Backups Cannot Select Website GroupsCó thể đã có người làm @wanghe-fit2cloud đã nhận 1 ngày trước. Đang mởtype: feature-request
1Panel-dev/1Panel#14241 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Node.js has officially been upgraded to 26.13.0 (LTS version). Please upgrade the Node.js environment.Có thể đã có người làm @wanghe-fit2cloud đã nhận 1 ngày trước. Đang mởtype: app-store type: optimization
1Panel-dev/1Panel#14238 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của 1Panel-dev/1Panel
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
schema-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
stefanhoth/paperless-ngx-cli#61 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Project submission: CodeAFĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
slavakurilyak/awesome-ai-agents#888 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement nav-pilot
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày