The Power of Swagger UI Docs-Broken access control
A Swagger UI documentation page exposed user-management API endpoints that required no authentication. An attacker could create users, read every user's details by username, edit other users' information, and delete users.
medium.com
Published on medium.com
In this write-up, I’ll share insights on exploiting critical vulnerability on swagger ui documentation
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the user-management API endpoints lacked authentication and authorization checks, so requests without a token or session were accepted.
Impact
An unauthenticated attacker could create accounts, read every user's details, modify other users' information and delete users.
What the attacker needed
No account needed; reachable Swagger UI page
The fix
The API should enforce authentication and authorization on every user-management endpoint, not just hide them behind documentation.
How it was found
- Gather subdomains and probe them with httpx to find live hosts.
- Find an admin portal login and run directory fuzzing with dirsearch.
- Discover the Swagger UI documentation path.
- Use the documented create-user request to add a user.
- Use the documented get-user request to retrieve user details by username.
- Edit other users' information through the same endpoints.
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 write-up has not been written yet. The Original tab links to the source.
Swagger UI is a page that lists and lets you try an API's endpoints. Here those endpoints had no login check, so anyone who found the page could create, read, change and delete user accounts. The mistake is that the API trusted anyone who could reach it.
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.