Hook

Imagine having a Viewer account with no permission to create or delete API Keys.

Now imagine discovering that the same account can delete API Keys belonging to other users.

That was exactly what I found while exploring an application's API endpoints.

In this writeup, I'll explain how I discovered the issue, how a seemingly harmless API response exposed the information I needed, and how I used it to perform an unauthorized deletion.

Summary

During my security testing, I discovered an Insecure Direct Object Reference (IDOR) vulnerability in an application's API Key management functionality.

The application allowed a low-privileged Viewer account to obtain the identifier of an API Key belonging to another user.

Even though the Viewer role was not supposed to create or delete API Keys, the application failed to properly enforce ownership checks when processing deletion requests.

By exploiting this behavior, I was able to:

  • Disclose API Key identifiers belonging to other users.

  • Delete API Keys without their owners' authorization.

  • Repeat the attack against three different API Keys.

The vulnerability was reported through a bug bounty program and eventually marked as Resolved after being fixed.

Background

The application provided different user roles with different permission levels.

For this test, I used two separate accounts:

  • Account A: Owner

  • Account B: Viewer

The Owner account could manage API Keys, while the Viewer account was restricted from creating or deleting them.

This permission separation was expected to prevent lower-privileged users from modifying resources belonging to other users.

However, the API did not consistently enforce these restrictions.

Discovery Process

I started by exploring the application's API endpoints and observing how different user roles interacted with its functionality.

While testing the API Key management endpoints, I noticed something interesting.

Although the Viewer account was not allowed to create API Keys, attempting to create one with a name already used by another user returned a response containing information about the existing resource.

The response included the existing API Key's unique identifier.

This caught my attention because the identifier belonged to a resource that the Viewer account should not have been able to access.

I decided to investigate whether this information disclosure could lead to an actual unauthorized action.

The next thing I tested was whether the disclosed identifier could be used with the API Key deletion endpoint.

It worked.

The application accepted the deletion request from the Viewer account, even though that account had no permission to delete API Keys.

Reproduction Steps

To reproduce the vulnerability, two authenticated accounts are required.

Step 1: Create an API Key as the Owner

Log in using Account A (Owner).

Create an API Key with the following name:

text
TESTV1

Step 2: Attempt to Create an API Key as the Viewer

Log out and authenticate using Account B (Viewer).

Send a request to:

http
POST /api/cloud/api-keys

Attempt to create an API Key using the same name as the existing Owner resource.

Step 3: Observe the Response

Instead of properly enforcing resource ownership, the application returns a 409 Conflict response containing information about the existing API Key.

Example response:

json
{
  "status": 409,
  "message": [
    "The API Key cannot be created with name 'test'. Another resource of type api_key (id: a1ad5a7c-1eab-4526-af3b-4c8ff33a7dc5) already exists with the same name."
  ]
}

The important part is that the response exposes the existing API Key identifier.

Step 4: Use the Disclosed Identifier

Copy the disclosed API Key ID.

While still authenticated as the Viewer account, send a DELETE request:

http
DELETE /api/cloud/api-keys/{api-id}

Replace {api-id} with the identifier obtained from the previous response.

Step 5: Verify the Unauthorized Deletion

The deletion request succeeds even though the Viewer account does not have permission to delete API Keys.

Log back into Account A (Owner) and verify that the API Key has been removed.

The same behavior was successfully reproduced against three API Keys.

Impact

This vulnerability demonstrates a broken authorization mechanism in the application's API Key management functionality.

A low-privileged authenticated user could obtain identifiers belonging to other users and use them to delete their resources.

The confirmed impact included:

  • Unauthorized disclosure of API Key identifiers and associated metadata.

  • Unauthorized deletion of API Keys belonging to other users.

  • Potential disruption of integrations and services relying on deleted API Keys.

Although the API Key's actual secret value was not disclosed, the ability to delete another user's API Key without authorization represents a significant integrity and availability issue.

Fix

The vulnerability was eventually fixed by the program.

The report's status was changed to Resolved, confirming that the issue had been addressed.

From a security perspective, the important lesson is that authorization checks must be enforced on every operation involving a resource.

Restricting a button or hiding an interface element is not enough.

The backend must independently verify that the authenticated user is authorized to access, modify, or delete the requested resource.

Lessons Learned

This finding reminded me of a few important things when testing APIs:

  1. Never trust role restrictions in the UI. Always test the underlying API directly.

  2. Pay attention to error responses. A 409 Conflict response might reveal information that should remain private.

  3. Test ownership, not just functionality. Being able to access an endpoint does not mean a user should be allowed to interact with every resource.

  4. Look for chained vulnerabilities. An information disclosure issue can sometimes become much more impactful when combined with a missing authorization check.

  5. Verify the actual impact. Demonstrating an unauthorized deletion is much stronger than simply identifying an exposed resource ID.

Sometimes, the most interesting vulnerabilities are hidden in ordinary API responses.

Closing Thoughts

This was a good reminder that small details in API behavior can reveal much bigger security problems.

If you're interested in bug bounty hunting, API security, and learning from real-world vulnerability research, consider joining the Bugmith Community.

Visit the Bugmith Community About page to find community links and the Discord invitation.