thisclosed_#2 - PostgreSQL Database Exfiltration through the abuse of PostgREST requests
The application exposed a PostgREST endpoint that allowed querying database tables without proper authorization checks. An attacker could request specific columns from the users table, such as id and email, to exfiltrate sensitive information.
Published on blog.hckrt.com
bug-bounty | security-testing | ethical-hacking | writeup
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 application did not enforce proper authorization checks on the PostgREST endpoint, allowing access to database tables and columns that should have been restricted.
Impact
An attacker could exfiltrate sensitive information from database tables that should not be accessible to a regular user.
What the attacker needed
Access to the web application; HTTP Basic Authentication credentials
The fix
The issue was fixed by the customer, as acknowledged in the article.
How it was found
- Intercept the GET request to /pg/vw_contract_with_orgs?select=*
- Modify the request to point to the users table: /pg/users?select=*
- Observe permission denied error for table users
- Modify the request to select only the id column: /pg/users?select=id
- Receive the contents of the id column
- Add more columns such as email, updated_at, created_at to the select parameter
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.
The application used a tool called PostgREST to turn its database into a web API. The author found that by changing the web address, they could ask for data from tables that should have been private, like the list of users. This let them see information such as user IDs and email addresses.
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.