Security: the superuser password of hypha.php is stored in plain text; options to improve password storage
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 53/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- authentication, security
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- JavaScript
- Stelle
- 5
- Fork
- 9
- Merge medio
- 18h 49m
- PR unite (30g)
- 13
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Medium Level: Easy Type: Bug Value: Users
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Impact: Low Level: Easy Type: Bug Value: Coders
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
PlanBCode/hypha#586 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PlanBCode/hypha
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JimLiu/baoyu-design#23 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
Data Manager offers a one-click purge of the onboard tools registry, labelled "Tool execution data"Apertadata-safety effort:low model:light plan planner:opus-5-5
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Docs: four cross-page links point at anchors that do not existForse già presa @6t9xstar l’ha presa oggi. Apertadifficulty:easy documentation good first issue hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/TypeScript#65083 ·
I maintainer di solito rispondono entro 1 giorno