# Orphaned Privileges: A Critical Access Control Issue in Web Applications

Listen to this Post

There are times when a user’s privileges must be revoked:

1. The user no longer needs the permissions.

2. The user has changed job roles.

  1. The user is no longer trusted due to misconduct.

However, many web applications fail to properly enforce privilege revocation, leading to orphaned privileges—where a user retains access despite apparent permission changes.

How to Find Orphaned Privileges

1. Grant Elevated Privileges (as an admin):

  • Assign a test user additional permissions or a higher role.
  • Example Linux command to simulate role assignment:
    sudo usermod -aG admin testuser 
    

2. Perform Privileged API Calls:

  • Use the test account to access restricted endpoints.
  • Example `curl` command to test API access:
    curl -X GET -H "Authorization: Bearer <token>" https://api.example.com/admin/data 
    

3. Revoke Privileges (as an admin):

  • Remove the test user’s elevated permissions.
  • Example Linux command to revoke group access:
    sudo deluser testuser admin 
    

4. Re-Attempt Privileged API Calls:

  • Check if the user can still access restricted endpoints.
  • Example command to verify enforcement:
    curl -X GET -H "Authorization: Bearer <token>" https://api.example.com/admin/data 
    

5. Verify Session Handling: