Security: the superuser password of hypha.php is stored in plain text; options to improve password storage
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 53/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- authentication, security
Hướng nghiên cứu
Start with hypha.php, especially the password declaration near line 10, the installer write near line 111, and the login check near line 454; then read system/core/crypto.php to see how password hashing is handled. The issue recommends hashing the superuser password, verifying it on login, and safely writing the value into PHP source. Done means existing installs can transition safely and new passwords are no longer stored in plain text.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
How Hypha stores passwords now
| Password | Where | How |
|---|---|---|
| Member accounts | data/hypha.xml, attribute password of <user> |
password_hash($password, PASSWORD_DEFAULT) (bcrypt with salt) in system/core/crypto.php. Accounts from older Hypha versions can still hold an unsalted MD5 hash, compared with ==. That part is #426, with PR #491. |
Superuser of hypha.php (install and maintenance) |
hypha.php itself, line 10: $password = '...'; |
Plain text. The installer writes the posted value into the PHP source with preg_replace (line 111), and the login compares it with === (line 454). |
So member passwords are hashed (not encrypted, which is right for passwords), apart from the legacy MD5 hashes of #426. The superuser password is not protected at all.
Why the superuser password matters
- Anyone who gets a copy of
hypha.phpreads the password. Ways to get one: a backup, a.vorigeor.bakcopy in the web root, the builder of #413, a mistake in the web server configuration that serves PHP as text, or a container image or repository that contains the file. - People reuse passwords, so the password often opens other services as well.
- The installer puts the posted value into PHP source without escaping. A
'in the password breakshypha.php, and$1or\1in it is changed bypreg_replace. Only someone already logged in tohypha.phpcan do this, but it turns a password field into PHP code. ===on a secret is not constant-time.
Options to improve
- Hash the superuser password. Store
password_hash()output inhypha.phpand check it withpassword_verify(). When$passwordis not a hash (an existing install), accept it once, then write the hash at that login, or ask for a new password. Write the value withvar_export()instead ofpreg_replace, so no character can break the source. Effort: small. This option alone takes away most of the risk. - Retire the legacy MD5 member hashes and rehash on login: #426 / PR #491.
- Use Argon2id where available.
PASSWORD_ARGON2IDexists when PHP is built with libargon2 or libsodium (the official PHP images have it). Together withpassword_needs_rehash()(part of PR #491), hashes move over at the next login. Bcrypt with cost 12, the default from PHP 8.4, is also acceptable. This is a choice, not a must. - Keep the hashes out of reach. Make sure
data/can never be downloaded (#427 / PR #494), and preferably support a data folder outside the web root. A hash that cannot be read cannot be attacked offline. - Limit guessing of member and superuser passwords: #424 / PR #493 for members.
hypha.phphas no limit yet. - Optional, larger: move the superuser credentials out of
hypha.phpinto a file outside the web root, or into an environment variable (useful for containers). Or drop the separate superuser and let an administrator account of the site do maintenance.
Suggested order
Option 1 first: it is small, it closes the plain-text password, and it is not covered by any open issue. Then merge PR #491 and PR #494.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- JavaScript
- Star
- 5
- Fork
- 9
- Merge trung bình
- 18 giờ 49 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Type: Bug Value: Coders
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
PlanBCode/hypha#586 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PlanBCode/hypha
Issue tương tự
-
no timer on tournament pageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
hexlet-codebattle/codebattle#2374 ·
-
docs: Code on siteĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
saadeghi/daisyui#4846 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
spec-feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
automated-link-issue broken-link
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 65/100
JuanPabloDiaz/freeForGeeks#313 ·