High: several sensitive admin actions bypass sudo re-authentication

Aperta
#1,176 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
typescript

Direzione di ricerca

Inizia da packages/hydrooj/src/handler/manage.ts e confronta postRestart, SystemScriptHandler.post e SystemUserImportHandler.post con gli handler protetti nelle vicinanze. Leggi requireSudo in packages/hydrooj/src/service/server.ts, quindi esamina gli handler /manage per verificare una protezione step-up coerente. Il lavoro è completato quando le azioni ad alto impatto elencate e le altre route di gestione sensibili impongono la conferma sudo prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Several high-impact administrative actions appear to require only PRIV_EDIT_SYSTEM but do not enforce requireSudo re-authentication, while other sensitive admin routes in the same file do require sudo confirmation.

This leads to inconsistent protection for dangerous actions such as restart, script execution, and bulk user import.

Impact

If an admin session is stolen, left open, or used in a shared environment, an attacker may be able to:

  • restart the service
  • execute system scripts
  • bulk import accounts and modify groups

without triggering the extra sudo confirmation that is already used elsewhere for sensitive operations.

Code References

Sensitive actions without requireSudo
  • packages/hydrooj/src/handler/manage.ts:80-89
    • postRestart() executes pm2 reload
  • packages/hydrooj/src/handler/manage.ts:92-131
    • SystemScriptHandler.post() executes global.Hydro.script[id].run(...)
  • packages/hydrooj/src/handler/manage.ts:235-307
    • SystemUserImportHandler.post() performs bulk user creation and group updates
Sensitive actions with requireSudo in the same file
  • packages/hydrooj/src/handler/manage.ts:134-170
    • system settings
  • packages/hydrooj/src/handler/manage.ts:173-231
    • config editing
  • packages/hydrooj/src/handler/manage.ts:314-349
    • user privilege management
Sudo implementation
  • packages/hydrooj/src/service/server.ts:47-73
    • requireSudo decorator implementation

Why this is a security issue

The project already recognizes the need for step-up authentication through requireSudo, but the protection is applied inconsistently.

Restarting the service, executing system scripts, and bulk importing users are all high-impact actions and should be protected at least as strictly as settings or privilege pages.

Suggested Fix

  • Apply @requireSudo consistently to all high-impact administrative actions.
  • Review all /manage/* handlers for step-up authentication consistency.
  • Consider documenting a security policy for which actions must require sudo confirmation.

Additional Notes

This report is based on code review of:

  • packages/hydrooj/src/handler/manage.ts
  • packages/hydrooj/src/service/server.ts
Lingua principale
TypeScript
Stelle
7.3k
Fork
504
Merge medio
11h 29m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hydro-dev/Hydro

Tutte le issue di hydro-dev/Hydro

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.