Users can read and change other organisations’ invoices through the API
- Affected
- api.example.com: GET and PATCH /v2/invoices/{id}
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Description
The API loads an invoice by the ID in the URL and returns it to any signed-in user. It does not check that the invoice belongs to the caller’s organisation. The same gap applies when an invoice is updated.
Steps to reproduce
- Sign in as the member test account in Organisation A.
- Request GET /v2/invoices/48213, an invoice that belongs to Organisation B.
- The API returns the full invoice. A PATCH request to the same address changes its status.
- Invoice IDs are sequential, so other invoices can be found by counting. We used only the two test organisations set up for this engagement.
Evidence
GET /v2/invoices/48213 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJ… (member, Organisation A)
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 48213, "organisation_id": "org_B", "customer_name": "[redacted]",
"total": "12,400.00", "status": "unpaid", "due_date": "[redacted]"}Impact
Any signed-in user of any customer could read every other customer’s invoices, including customer names and amounts, and mark them paid or change their details. No special knowledge is needed.
Remediation
- For every request that loads an object by its ID, check on the server that the object belongs to the caller’s organisation. Take the organisation from the session, never from the request.
- Return 404 Not Found for objects in other organisations, so their existence is not revealed.
- Add automated tests that call each endpoint with another organisation’s IDs, and run them on every build.
- Non-sequential IDs make guessing harder, but they are hardening, not a fix.
References
Retest result
Fixed. Requests for Organisation B’s invoices now return 404 Not Found, for both reading and updating. We also checked the 12 other endpoints that take an ID and found no cross-organisation access.