From BOLA to Account Takeover via javascript: URI Injection
The Supabase-backed form builder lacked object-level ownership checks on form updates and allowed arbitrary URI schemes in a redirect field. An attacker could modify any form to inject a javascript: URI, which executed when a victim visited the short URL, exfiltrating their JWT and leading to account takeover.
medium.com
Published on medium.com
A few months ago, a group of friends building a startup asked me to perform a penetration test on their web application. I do freelance security work on the side, and this was exactly the kind of engagement I enjoy, a real product, real code, and a team that wanted to find issues before launch.
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 backend only checked that the JWT was valid but not whether the user owned the form, and the redirect handler did not validate the URI scheme.
Impact
An attacker could take over admin accounts during the approval flow and compromise regular users via published forms, gaining full authenticated access and exposing sensitive user information.
What the attacker needed
A free account; victim clicks a link; admin approval of malicious form
How it was found
- Send a PATCH request to the Supabase REST API to modify a form, including fields like is_approved and status.
- Set the form_url field to a javascript: URI payload.
- Create a malicious form with the payload and wait for admin approval.
- When an admin visits the short URL, the redirect handler executes the payload and exfiltrates the admin's JWT.
- Use the stolen JWT to take over the admin account.
- Modify published forms to inject the same payload, compromising regular users who visit them.
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 app let any logged-in user edit any other user's form, not just their own. It also had a redirect page that would run any link starting with 'javascript:', which is code that runs in the browser. By combining these, an attacker could steal a victim's login token and take over their account.
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.