The vulnerability analysis is based on the detailed description provided, which includes the exact vulnerable code snippet from version 0.3.0 of StudioCMS. The vulnerability lies in the DELETE handler for the API token revocation endpoint. The code authorizes any user with 'editor' privileges to perform the action but critically fails to check if the user is revoking their own token. It directly uses the userID and tokenID from the request body to call the sdk.REST_API.tokens.delete function. This allows a lower-privileged user (an editor) to cause a denial of service by revoking API tokens of higher-privileged users (admins, owners).
The fixing commit 9eec9c3b45523b635cfe16d55aa55afabacbebe3 corroborates this analysis. The patch refactors the token revocation logic into two distinct handlers. The standard revokeApiToken handler is modified to exclusively use the authenticated user's ID from their session (userData.user.id), preventing them from specifying another user's ID. A new, separate handler, adminRevokeUserApiToken, is introduced for administrators, which includes proper permission and hierarchy checks to ensure that only authorized admins can revoke tokens belonging to other users, and only if the target user has a lower permission level. This confirms that the original logic was flawed as described.