I got hacked for $21M on Christmas Day - here's the Supabase RLS mistake I made
onedollarchat.com·20h·
Discuss: r/webdev
🔒Rustls
Preview
Report Post

Built a side project called OneDollarChat - a global chat where every message costs $1. Posted it on Reddit, got some traction, went to bed.

Woke up to find a user with a balance of $21,474,836.47. That's INT_MAX. On Christmas morning.

What happened:

My Supabase RLS policy said "users can update their own row." Sounds safe, right?

Except "their own row" included the balance column. So they just... updated it.

-- What I had (bad) CREATE POLICY "Users can update own row" ON users FOR UPDATE USING (auth.uid() = id); -- What I needed (good) CREATE POLICY "Users can update own profile" ON users FOR UPDATE USING (auth.uid() = id) WITH CHECK ( -- o...

Similar Posts

Loading similar posts...