High: several sensitive admin actions bypass sudo re-authentication

オープン
#1,176 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript

調査の方向性

packages/hydrooj/src/handler/manage.ts から始め、postRestart、SystemScriptHandler.post、SystemUserImportHandler.post を近くにある保護されたハンドラと比較します。packages/hydrooj/src/service/server.ts の requireSudo を読み、その後 /manage ハンドラを確認して、一貫した step-up 保護になっていることを確認します。完了条件は、一覧にある影響の大きいアクションとその他の機密性の高い管理ルートで、意図した sudo 確認が強制されることです。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
7.3k
フォーク
504
平均マージ
11時間 29分
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hydro-dev/Hydro のほかの issue

hydro-dev/Hydro の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。