Your app got hacked: what to do in the first hour, day and week

If your app was hacked, work in this order. First hour: close the hole and rotate every exposed key, without deleting logs. First day: find out what could be read and since when, and decide who must be told. Under GDPR Article 33, a breach that puts people at risk goes to the authority within 72 hours of you becoming aware. First week: tell users plainly, fix the cause, and prove the same request now fails.

The team behind Keybrum's attacksUpdated 11 min read

In short

  • Contain before you investigate: close the open table or route and rotate exposed keys. Do not delete logs, rows or deployments while doing it.
  • Closing the hole does not un-leak what was readable. Any key, token or password that sat in exposed data has to be revoked and reissued.
  • GDPR Article 33 gives 72 hours from the moment you become aware, where feasible, to notify the authority, unless the breach is unlikely to result in a risk to people.
  • In the United States every state has its own breach notification law. The rules differ, so check with a lawyer which ones apply to your users.
  • A fix is proven when the exact request that worked before is refused now. Keep both answers, with their dates.
On this page

First, what kind of problem do you have?

"Hacked" covers several situations, and the first minutes depend on which one you are in. Most small products are not broken into. Something was left open, and someone noticed.

What you learnedWhat it usually meansFirst move
Someone emailed you: a table or bucket is readable by anyoneOpen database rules or storage rulesClose the table, then check what it held
A provider warned you, or a bill jumpedAn API key leaked and is being usedRevoke the key at the provider
Users see data that is not theirsA missing ownership check between accountsTake the route offline or add the check
Content or settings changed and you did not do itWrite access for strangers, or a stolen admin sessionRemove the write access, sign out all sessions
Your data is posted or offered somewhereIt was copied at some point in the pastContain, then go straight to who to tell

If you are not sure, treat it as the worst row that fits. This guide is practical advice from people who test apps for a living. It is not legal advice, and where the law matters it says so.

The first hour: contain

The goal of the first hour is narrow: a stranger who tries again now gets nothing. Understanding how it happened comes later.

  1. 1

    Write down the time and what you know

    Open a note. Record when you learned of the problem, from whom, and the request or screenshot they sent. This note becomes your timeline, and under GDPR the clock for notification starts when you become aware.

  2. 2

    Close the hole, even crudely

    For an open Supabase table, turn row level security on: with no policy, the table refuses every client. For open Firebase rules, deny all. For a route that leaks, return an error or put the feature behind a maintenance flag. A broken feature for a few hours is the cheaper outcome.

  3. 3

    Rotate every exposed key

    Revoke keys at the provider and issue new ones, starting with anything that can spend money or read user data. The leaked API key guide gives the order and the per-provider steps. This includes keys that were stored in the exposed table, even if they belong to your users.

  4. 4

    Sign out sessions if accounts were at risk

    If session tokens, password hashes or an admin account were exposed, invalidate all sessions through your auth provider and reset the admin's password. Turn on two-factor sign-in on your hosting, database and domain accounts if it was off.

  5. 5

    Do not destroy evidence

    Keep the logs, the open rows and the old deployment as they are. The FTC's guide for businesses says it plainly: do not destroy evidence. You will need it to learn what was read.

sql
-- Supabase: which tables in the public schema are still open to the API?
select tablename
from pg_tables
where schemaname = 'public' and not rowsecurity;

-- Close one now. With RLS on and no policy, client keys get nothing.
alter table public.YOUR_TABLE enable row level security;
Run in the SQL editor of your own project. Your app will lose access to that table until you add policies, which is the point for the next hour.

The first day: find out what could be read

Now you need facts, because every later decision depends on them: which data, whose, since when, and whether anyone took it.

  1. What was reachable. List every table, bucket and route that answered a stranger. For each, write down the columns: emails, names, messages, files, tokens, payment references.
  2. Whose data. Count the people concerned, roughly. Note which countries they are in if you know, because it decides which laws apply.
  3. Since when. Find the deploy or migration that opened it. Your git history and your database migrations usually give a date.
  4. Whether it was read. Check your provider's API and database logs for requests to those tables from addresses that are not your app, and your storage logs for downloads. Check provider dashboards for usage you cannot explain.
  5. What was changed. If writes were open, compare recent rows with a backup. Look for new admin accounts, changed emails and edited content.

Be honest about what the logs can tell you. Many plans keep logs for a short time, and a request with the public key looks like normal traffic. If the data was open for months and your logs cover days, you cannot rule out that it was copied. Write that down as it is. "We have no evidence of access" and "we know there was no access" are different statements, and only the first is usually true.

Who to tell, and when

This part depends on where your users are. Two frames cover most solo products.

If you have users in the EU: the 72 hours

Under Article 33 of the GDPR, when a personal data breach occurs, the controller notifies the competent supervisory authority "without undue delay and, where feasible, not later than 72 hours after having become aware of it". There is one exception: when the breach "is unlikely to result in a risk to the rights and freedoms of natural persons". If you notify later than 72 hours, you give the reasons for the delay.

Article 33 asks the notification toIn practice
Describe the nature of the breach, with the categories and approximate number of people and records"An API table readable without sign-in, about 2,000 users: email, display name"
Give a contact point for more informationYour name and email
Describe the likely consequencesPhishing risk, account takeover risk, exposure of private content
Describe the measures taken or proposedTable closed at this time, keys rotated, users to be informed
Article 33(3), points (a) to (d).

Three details help a small team. You do not need the full picture to notify: Article 33(4) allows the information to be provided in phases. You must document every breach, including the ones you decide not to notify, with the facts, the effects and what you did. And if a processor of yours, such as a hosting or email provider, has a breach, it must tell you without undue delay.

Telling the people concerned is a separate duty. Article 34 requires it, without undue delay and in clear and plain language, when the breach is likely to result in a high risk to them. It lists exceptions, for example when the data was encrypted in a way that makes it unintelligible to anyone not authorised.

If you have users in the United States

There is no single rule. The FTC's guide states that all states, the District of Columbia, Puerto Rico and the Virgin Islands have laws requiring notification of security breaches involving personal information. What counts as personal information, the deadline and who must be told differ from one state to the next, and health or financial data can bring federal rules. Check with a lawyer which laws apply to your users. An hour of legal advice on day one costs less than a wrong notification.

How to write to your users

The FTC's guide suggests a notice that says what happened, what information was involved, what you have done, and what people can do. Add how you will contact them in future, so they can spot fake follow-ups. Keep it short, factual and free of adjectives.

text
Subject: Security incident at [Product]: what happened and what to do

On [date], we learned that [a database table / a storage folder / an API route]
of [Product] could be read without signing in. It was open from [date] to [date].

What was exposed: [email address, display name, ...].
What was not exposed: [passwords, payment details, ...].

What we did: we closed the access on [date, time], replaced the keys concerned
and checked that the same request is now refused.

What we know about access: [we found requests from outside our app on these dates /
our logs do not let us rule out that the data was copied].

What you can do: [change your password / revoke and recreate your API key /
be careful with emails that mention Product and ask you to sign in].

We will only write to you from [address]. We will never ask for your password.
Questions: [your name], [email].
A starting point. Have it read by a lawyer if the breach must be notified by law.
  • Say what was exposed in plain words. "Your email address and the messages you sent" is clearer than "some user data".
  • Do not minimise. If you cannot rule out that the data was copied, say so.
  • Give one concrete action. If there is nothing to do, say that too.
  • Send it yourself. A short message signed by the founder reads better than a notice from "the team".

The first week: fix the cause and prove it

Containment was a tourniquet. The week is for the real repair and for evidence that it worked.

  1. 1

    Replace the crude fix with the right one

    Write the policies or rules the app needs, one per operation, tied to the signed-in user. Add the ownership check on the route. The guides on Supabase RLS, Firebase security rules and IDOR have code to paste.

  2. 2

    Replay the request that worked

    Take the exact request from the report or from your own test, and send it again. It has to fail: an empty list, a 401 or a 403. Save the before and the after with their dates. This pair is your proof, for users, for an authority and for yourself.

  3. 3

    Look for the same mistake elsewhere

    One open table usually has siblings. Check every table, every bucket and every route with the same test, as a stranger and as a second user.

  4. 4

    Write the timeline

    One page: when it opened, when you learned, what you did and when, what was exposed, who was told. GDPR asks you to document breaches. It is also what you will want the next time someone asks.

  5. 5

    Make the check repeat

    The hole came from a deploy. The next one can too. Add a check that runs after each deploy, by hand from the vibe coding security checklist or automatically.

What Keybrum does after an incident, and what it does not

Keybrum is the automated pentest we build for apps made with AI. After an incident it is useful for two of the steps above: finding the siblings of the hole, and proving the fix.

It attacks your live app as a stranger and as two signed-in users. It asks every table and bucket named in your JavaScript for data with only the public key, looks for working keys in the bundle and in API answers, tries to read one account's data from the other, calls AI routes without a session and sends a forged event to webhook routes. Each finding keeps the request that worked and the response, with personal data redacted. After your fix, the same attack runs again, and the finding closes only when it fails. The report states which attacks failed and on which date, with what was not tested next to it.

What it does not do: it is not a forensic service. It does not read your logs, and it cannot tell you who accessed your data in the past or what they took. It does not decide whether you must notify, and it is not legal advice. It only attacks apps whose owner proved ownership.

A one-time report costs €49 and includes retests of its findings for 7 days, which fits the week after an incident. The Maker plan, €29 a month excluding VAT for 5 apps, attacks again on every deploy.

Questions

What should I do first if my app is hacked?

Close the access and rotate the exposed keys, in that order, and keep your logs. Then write down the time you learned of it and what you know. Investigation, notification and the proper fix come after a stranger can no longer get in.

Do I have to report a data breach within 72 hours?

Under GDPR Article 33, a controller notifies the supervisory authority without undue delay and, where feasible, within 72 hours of becoming aware of a personal data breach, unless it is unlikely to result in a risk to people. Other countries and US states have their own rules, so check which apply to you.

When does the 72-hour clock start?

Article 33 counts from the moment the controller has become aware of the breach. That is why the first step is to note when and how you learned of it. If you notify later than 72 hours, the notification must give the reasons for the delay.

Do I have to tell my users about a breach?

Under GDPR Article 34, yes when the breach is likely to result in a high risk to them, without undue delay and in clear and plain language. In the United States, state laws set the conditions. Outside any legal duty, telling users lets them protect themselves.

How do I know what data was accessed?

Start from what was reachable, then look in your provider's API, database and storage logs for requests that did not come from your app. Logs are often kept for a limited time. If they do not cover the whole period, you cannot rule out access, and you should say so.

Should I take my app offline after a breach?

Take offline the part that leaks, for as long as the fix takes. Closing one table or one route is usually enough and keeps the rest running. If you cannot tell where the leak is, taking the whole app down for a few hours is a reasonable choice.

How do I prove the vulnerability is fixed?

Send the exact request that worked before and show that it is now refused. Keep both responses with their dates. Then run the same test on the other tables and routes, as a stranger and as a second user.

Sources

  1. 1.Art. 33 GDPR: Notification of a personal data breach to the supervisory authority, gdpr-info.eu
  2. 2.Art. 34 GDPR: Communication of a personal data breach to the data subject, gdpr-info.eu
  3. 3.Data Breach Response: A Guide for Business, Federal Trade Commission
  4. 4.Hacking Moltbook: AI Social Network Reveals 1.5M API Keys, Wiz Research
  5. 5.Row Level Security, Supabase Docs

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub