Improper authorization on `/api/as/v1/credentials/` allows any App Search user to access all API keys and escalate privileges
The API endpoint for listing credentials did not enforce role-based access control, so any authenticated App Search user, even with the lowest role, could retrieve all API keys. An attacker could use a leaked private admin key to create or delete API keys, escalating privileges.
- Triaged in 5 hours
- Fixed in 35 days
- Paid in 5 hours
- Disclosed after 44 days
Summary
Hello team, I hope you're doing well! App Search has a credentials page located at /as#/credentials that lists all the API keys a user has access to, if any. That same page will 404 for users with Analyst or Editor role. This is all working as intended, however there is also an API endpoint to query that same data at /api/as/v1/credentials/ and this will list all existing API keys for any authenticated user regardless of their App Search role.
Steps to reproduce
I'm going to use the cloud environment for the reproduction
Preparation
- Log in App Search with the admin (
elastic) user and go to theUsers & rolespage (/as#/role-mappings/) - Click
Add mapping - In the
Attribute valuefield enterh1-repro - In the
Rolebox selectAnalyst - In the
Engine AccessselectLimited Engine Access, no need to select any engine- We now have created the most limited role possible
- Log in Kibana with the admin (
elastic) user and go to theStack Management>Userspage (/app/management/security/users/) - Click
Create user - In the
Usernamefield enterhi-repro - Set any password you like and then click
Create user
Reproduction
- Log in App Search with the
h1-reprouser - Navigate to
/as#/role-mappings/and observe that it's a 404 because you don't have access to this page - Navigate to
/api/as/v1/credentials/and observe that you have access to all the API keys
Impact
Privilege escalation. The default App Search install has a Private API Key with read/write access to all engines. If a Private Admin Key has been created before. the attacker can use it to create new API keys or delete existing ones.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker with any authenticated account could obtain all API keys, and if a private admin key exists, use it to create or delete API keys, leading to privilege escalation.
What the attacker needed
An authenticated App Search account
How it was found
- As admin, create a role mapping for attribute value 'h1-repro' with Analyst role and limited engine access.
- As admin, create a new user 'hi-repro' with any password.
- Log in as 'hi-repro' and confirm the role-mappings page returns 404.
- Navigate to /api/as/v1/credentials/ and observe all API keys are listed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
App Search has different user roles that control what you can see and do. The web page for credentials correctly blocked low-privilege users, but the underlying API did not check roles, so anyone logged in could fetch all API keys. API keys are like passwords that grant access to the system, so leaking them is dangerous.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.