A walk-through of a High-severity cross-company account-takeover
The user-management endpoints in InvoiceShelf resolved target users by global primary key without checking that the target belonged to the caller's company, and the authorisation policy only verified that the caller was an owner of their own company. An owner of one company could therefore read and overwrite any user account in any other company, including changing their email and password and moving them into the attacker's company as a super admin.
Published on medium.com
Multi-tenant apps carry an implicit promise: my data is mine, your data is yours, and the wall between us holds even when we share the same server. Self-hosted SaaS like InvoiceShelf lets one installation host multiple “companies.” The whole model depends on every object-level operation asking two questions, not one:
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
The route-model binding looked up the target user by global primary key without tenant scoping, and the policy only checked that the requester was an owner of their own company rather than comparing the target user's company to the caller's.
Impact
An owner of one company could read other tenants' user data and fully take over any account on the installation by resetting credentials and granting super admin in their own company; the text notes a non-owner gets a 403, so the flaw is specific to owners.
What the attacker needed
An account that is Owner of a company; knowledge of a target user ID; multi-company installation
The fix
Version 2.4.1 was fixed by adding a check that the target user belongs to the caller's company, mirroring the scoping already present on the delete path.
How it was found
- As the owner of Company A, send a GET request for a user ID that belongs to Company B.
- Observe a 200 response returning the other company's user.
- As the same owner, send a PUT request for that user with a new email, password, and a company membership pointing at Company A with a super admin role.
- Observe a 200 response and that the victim's credentials are overwritten and they are moved into Company A.
- As a non-owner member of Company A, repeat the request and observe a 403, confirming the route is access-controlled in general.
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.
InvoiceShelf is software that lets one server host several separate companies. Each company should only be able to see and change its own users. Here, the software checked that you were an owner of some company, but never checked that the user you were editing belonged to your company, so an owner of one company could take over accounts in another.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.