Skip to content

Any logged-in user can run any module's dosql handler; index.php has no module access check #463

Closed

Description

@caseysoftware

index.php (L234–245 on dev-5.0.0 @ 179b4eaf) checks the form token and then requires modules/<m>/<dosql>.php for any logged-in user. It never checks that the user can access module m, so each module's do_* handler has to do its own permission checks. Handlers that forget can be reached by users who can't even open the module.

Found while testing the HelpDesk add-on on dev-5.0.0 (web2project/modules-helpdesk). A user with the Empty Role gets access denied on m=helpdesk but could still POST m=helpdesk, dosql=do_item_aed, del=1, item_id=1 with their own __nonce, and the ticket was deleted. (The add-on's own missing canDelete() check is filed on its repo.)

The core handlers mostly rely on BaseObject::store()/delete() calling canEdit()/canCreate()/canDelete(). Even so, a module-level gate would close the whole class of bugs for core and add-ons.

Suggested fix: before the dosql require, refuse the request unless $AppUI->isActiveModule($m) and canAccess($m) pass (redirect to ACCESS_DENIED). The same check for a=do_* in the module dispatch. Keep the per-object checks as they are.

Reproduced on dev-5.0.0 @ 179b4eaf, PHP 8.3.6, MariaDB 10.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions