Bulk Force Password Reset and Session Revocation for Compromised Accounts

Overview

Administrators may need to immediately invalidate existing sessions and force password resets for a large number of users identified as compromised during a security incident. This prevents further unauthorized access while analysis continues. Since the platform lacks a single endpoint for bulk password resets, this article explains how to programmatically address this issue by scripting against the Management and Authentication APIs.

Applies To
  • Management API
  • Authentication API
  • Compromised Accounts
Solution

Follow these steps to revoke access and enforce password changes for affected users. Scripting these API calls is recommended for bulk operations.

NOTE: When scripting changes for a large number of users, adhere to the Management API rate limits to prevent requests from being blocked.

  1. Invalidate Existing Sessions

To prevent further unauthorized access using current tokens, invalidate sessions and refresh tokens immediately.

  1. Force Password Resets

Once sessions are invalidated, trigger a password reset using one of the following methods:

    • Email via Authentication API: Make a POST call to the /dbconnections/change_password endpoint to send a reset email. Refer to database-connections/password-change for details.

    • Email via Management API: Create a password change ticket that sends a reset email using the tickets/post-password-change endpoint.

      • NOTE: For both email methods, the reset link is single-use, and only the most recently generated link remains valid.

    • Post Login Action: Set a custom value in a user's app_metadata (e.g., "force_reset": true). Create a Post Login Action to check for this value, deny access, and prompt the user to reset their password before logging in.

    • Direct Update: Set a new, random password via a PATCH call to the /api/v2/users/{id} endpoint. Users must then select the "I forgot my password" link on the login page to set a new password. Proceed with caution on this option and ensure a different random password is set for each user being reset, and some mechanism exists to check the user has changed it; otherwise, new attack vectors may inadvertently be introduced. 

  1. Implement Future Protection

To enhance security and enforce password policies moving forward:

Recommended content

No recommended content found...