KRYPTHEON.
PROOF / A REAL RUN

Four holes planted. Here is what it said.

KRYPTHEON / 2026

Demo Bank is a small bank app built for Kryptheon's demos, with four security holes put in on purpose. On 2026-11-17 the released kryptheon-night 0.1.43 was run on it, the holes were fixed, and it was run again. This page is the output of those runs, unedited.

The four planted holes

Anyone could read every account and balance. Any signed-in customer could change another customer's balance. One payment could be credited twice. A deposit could point at an account that does not exist.

What it looks like

Screenshots of the bank and the Kryptheon dashboard, taken by a script while they ran.

Before: a visitor who is not logged in sees every customer's balance
Before: a visitor who is not logged in sees every customer's balance
Kryptheon's finding, its proof, and the fix to paste into an AI tool
Kryptheon's finding, its proof, and the fix to paste into an AI tool
After the fix: Re-check ran the attack again - Result: fixed
After the fix: Re-check ran the attack again - Result: fixed
After: the same visitor sees nothing - the database refused
After: the same visitor sees nothing - the database refused
Before: the payment company sends one payment again, and the bank adds it twice
Before: the payment company sends one payment again, and the bank adds it twice
After: the second message changes nothing
After: the second message changes nothing

1. The scan, on the bank with its holes

All four were found, in one CRITICAL and two HIGH findings. Two more were found that nobody planted: an email that can exist twice, and a balance that can go negative. Each comes with the prompt to paste into an AI tool.

npx kryptheon-night - the bank with its holes

  Kryptheon Night Shift
  I attack a copy of your database and tell you what got in.

  Database: postgresql://postgres@127.0.0.1:54390/demobank

  Connecting ...
  Connected.

  Reading the shape of public ...
  2 tables, 4 rules. Building a copy ...
  Copy matches. Seeding two people and attacking it ...
  Trying to change data that is not ours ...
  Looking for rows that could point at nothing ...
  Trying numbers no app should store ...
  Pointing rows at another organization's ...
  Racing two requests against each other ...
  Copy deleted.

  5 problems found.

  --------------------------------------------------------------------
  CRITICAL   accounts

  Anyone can read your accounts table, and any signed-in customer can change rows in it.

  Anyone on the internet, without logging in and without an account, can
  read this table. I did it myself just now and got back 2 rows,
  including email addresses (email) and amounts of money (balance). Your
  signed-in customers can read each other's rows for the same reason.
  Signed in as one of your customers, I changed 1 of another customer's
  rows on a copy of your app, in a table holding email addresses (email)
  and amounts of money (balance). Every one of those was undone straight
  away - nothing on the copy was kept, and your live app was never
  touched.

  The table has row level security switched on, and there is a rule on
  it written for changing rows. That rule is the one letting this
  through: it does not check who is asking, so it accepts the request
  from a stranger exactly as it would from the person the row belongs
  to.

  Paste this into Lovable, Claude or Cursor:

    My app has a security problem.
    
    The "accounts" table can be read and written by anyone who is not logged
    in, because the rule you wrote for changing rows lets everybody through.
    I proved it on a copy: I read 2 rows and changed rows.
    
    Row level security is already on for this table, so the rules on it are
    the problem: remove the rule that lets everyone in, and write separate
    rules for reading, inserting, updating and deleting. A rule written FOR
    ALL covers far more than reading.
    
    Each of them should compare "user_id" to the id of the signed-in user
    (auth.uid()): USING for reading, updating and deleting, WITH CHECK for
    inserting and updating, so nobody reads, changes or writes a row under
    somebody else's name. Give logged-out visitors no rule at all unless
    they truly need one.
    
    Then check every other table for the same thing.

  --------------------------------------------------------------------
  HIGH   accounts

  Your accounts table lets the same email exist twice.

  I opened two connections to a copy of your app and inserted the same
  email from both at the same moment. Both were accepted, so there are
  now 2 rows holding the identical value. Signing in is not affected:
  your app signs people in through auth.users, which keeps each email
  unique. But anything that looks a person up by this column can get two
  rows back and pick the wrong one.

  There is no unique constraint and no unique index on this column, so
  the database has no way to refuse the second one. Checking in your app
  code before inserting does not close this: between the check and the
  insert, the other request has already been accepted.

  Paste this into Lovable, Claude or Cursor:

    My app has a security problem.
    
    Two rows in the "accounts" table can hold the same "email". I proved it
    by inserting the same value from two connections at the same moment, and
    both were accepted.
    
    First, find the rows that already share a value and show them to me. Do
    not delete or merge any of them without asking me: the rule below cannot
    be created while they exist, and deleting rows to make it pass loses
    real data.
    
    Then add a unique index on lower("email"), so that "accounts"."email" is
    unique whatever the case - Ann@example.com and ann@example.com are the
    same person. It has to be in the database itself. Checking in
    application code before inserting is not enough - between the check and
    the insert, the other request has already gone in.
    
    If the same value is allowed to repeat for different owners, make it
    cover both columns together rather than leaving it off.
    
    Find everything that writes this column - app code, and any database
    trigger or function, such as one that copies each new sign-up into this
    table - and make sure each one handles "this value already exists"
    instead of failing. If people can edit this column themselves, decide
    whether they should: once it is unique, someone who puts another
    person's value in first will block that person.
    
    Sign-in uses auth.users, so this column is only a copy of the email
    there. Consider not letting people edit it at all and keeping it in step
    with auth.users.
    
    Afterwards, sign up a brand-new account and edit an existing profile to
    make sure both still work, and run this check again.
    
    Then look for the same missing constraint on every other table and fix
    those too.

  --------------------------------------------------------------------
  HIGH   deposits

  Your deposits table lets the same gateway_payment_id exist twice.

  I opened two connections to a copy of your app and inserted the same
  gateway_payment_id from both at the same moment. Both were accepted,
  so there are now 2 rows holding the identical value. Payment providers
  send the same webhook again whenever your server is slow or answers
  with an error, so one payment saved twice can unlock the plan, the
  credits or the order twice.

  There is no unique constraint and no unique index on this column, so
  the database has no way to refuse the second one. Checking in your app
  code before inserting does not close this: between the check and the
  insert, the other request has already been accepted.

  Paste this into Lovable, Claude or Cursor:

    My app can count one payment twice.
    
    Two rows in the "deposits" table can hold the same "gateway_payment_id".
    I proved it by inserting the same value from two connections at the same
    moment, and both were accepted.
    
    First, find the rows that already share a value and show them to me. Do
    not delete or merge any of them without asking me: the rule below cannot
    be created while they exist, and deleting rows to make it pass loses
    real data.
    
    Then add a unique constraint on "deposits"."gateway_payment_id". It has
    to be in the database itself. Checking in application code before
    inserting is not enough - between the check and the insert, the other
    request has already gone in.
    
    Then change the webhook handler, and anything else that saves this
    column. Save the row that claims this payment first, and give the plan,
    the credits or the order only when that save succeeded - in one
    transaction or one database function, so a second copy can never get
    past it. When the save fails because the value already exists (Postgres
    error 23505), treat it as "already done": change nothing more and answer
    200. Answering with an error makes the provider send it again and again.
    
    If the webhook checks the provider's signature, keep that check first,
    before anything is saved. If it does not, tell me: without it anyone can
    send it a payment that never happened.
    
    Afterwards, make one payment in the provider's test mode, send the same
    webhook to your server twice (the provider's dashboard can resend it),
    check the plan, credits or order were given only once, and run this
    check again.
    
    Then look for the same missing constraint on every other table that
    keeps payments or webhooks and fix those too.

  --------------------------------------------------------------------
  HIGH   deposits

  Your deposits table can point at an account that does not exist.

  I added a row to deposits naming an account that is not in your
  accounts table, and it was accepted. So when one of them is deleted,
  the rows here stay behind pointing at nobody - and a signup or
  checkout that stops halfway leaves the same thing. The row I added was
  undone straight away.

  There is no foreign key between these two tables, so the database has
  no idea they are related. It will not refuse a row that points at
  nothing, it will not stop somebody being deleted while their rows are
  still here, and it will never find these rows again afterwards.

  Paste this into Lovable, Claude or Cursor:

    My app has a data problem.
    
    The "deposits" table has a "account_id" column that is meant to point at
    "accounts". There is no foreign key between them, so the database does
    not know they are related. I proved it by adding a row naming one that
    does not exist, and it was accepted.
    
    Add a foreign key from "deposits"."account_id" to "accounts"."id".
    
    Decide on purpose what should happen when the parent row is deleted: ON
    DELETE CASCADE if the children should go too, ON DELETE SET NULL if they
    should stay without an owner, or nothing at all if the delete should be
    refused while children exist.
    
    There may already be rows pointing at nothing, and the constraint will
    not be created until those are dealt with. Find them first.

  --------------------------------------------------------------------
  LOW   accounts

  Your database itself does not stop 1 number no app should store (a negative price, a percent over 100) - only your app's code does.

  I tried each one on a copy and the database took it (every write was
  rolled back). This is not a hole by itself: your app may well refuse
  these values before they reach the database. It means nothing stops a
  bug, a script or a fix run by hand from storing them.

  Paste this into Lovable, Claude or Cursor:

    My database accepts some values my app should never store. Kryptheon tried each one on a copy:
    
    - accounts table takes -10 as balance.
    
    First check whether my app's code already refuses each of these. For the ones it does, add the same rule
    in the database too (a CHECK constraint for a range; for a row naming another organization's record, a
    foreign key on (organization_id, <parent>_id) to the parent's (organization_id, id), with a unique
    (organization_id, id) on the parent). Before adding a rule, find the rows that already break it and show
    them to me - do not delete or change any of them without asking.

  --------------------------------------------------------------------
  Nothing here touched your live app. I built a copy, attacked the copy,
  and deleted it. Not one real customer was involved.

  --------------------------------------------------------------------
  What I did not test

    Every table I could reach was attacked, and every attack I have
    finished, ran.

    One thing is never reported, on purpose: the lost update - two
    withdrawals of 100 from a balance of 100 that both go through.
    Every Postgres database behaves that way unless the app asks it
    not to, so whether yours is affected depends on code I never see.
    Flagging it would mean flagging every app with a number in it.

  This can also run every night by itself:  npx kryptheon-night install

2. Nothing real was touched

A fingerprint of every row of the bank's own tables, taken right before and right after the scan. The rows it read were the two made-up people it put in its own copy, and the copy is gone afterwards.

tablebefore the scanafter the scan
accounts4 rows, f1d934ded84 rows, f1d934ded8
deposits3 rows, 1d4dcbdfbd3 rows, 1d4dcbdfbd
schemasauth,publicauth,public

3. The fix

A ready-made fix of the kind an AI tool writes from those prompts (kept ready so the demo works without internet), applied to the bank:

the fix

Fixed:
  1. Strangers can no longer read accounts.
  2. Customers can no longer change any balance.
  3. One UPI payment can be saved only once.
  4. A deposit must point at a real account.
  +  Two accounts can no longer share one email.

Now press Re-check in the Kryptheon dashboard to prove it.

4. The same scan again

It ran every attack again. Five were refused, so it calls them fixed. The negative balance was not part of the fix, so it still says open. Finding less is not called safe: every report ends with what was not tested.

npx kryptheon-night - after the fix

  Kryptheon Night Shift
  I attack a copy of your database and tell you what got in.

  Database: postgresql://postgres@127.0.0.1:54390/demobank

  Connecting ...
  Connected.

  Reading the shape of public ...
  2 tables, 3 rules. Building a copy ...
  Copy matches. Seeding two people and attacking it ...
  Trying to change data that is not ours ...
  Looking for rows that could point at nothing ...
  Trying numbers no app should store ...
  Pointing rows at another organization's ...
  Racing two requests against each other ...
  Copy deleted.

  5 problems are fixed:

    accounts (read by anyone) - I ran the same attack again and it was refused.
    accounts (written by any signed-in customer) - I ran the same attack again and it was refused.
    accounts (the same email twice) - I ran the same attack again and it was refused.
    deposits (the same gateway_payment_id twice) - I ran the same attack again and it was refused.
    deposits (rows left pointing at nothing) - I ran the same attack again and it was refused.

  1 still open:

    accounts - Your accounts table takes -10 as balance.


  1 problem found.

  --------------------------------------------------------------------
  LOW   accounts

  Your database itself does not stop 1 number no app should store (a negative price, a percent over 100) - only your app's code does.

  I tried each one on a copy and the database took it (every write was
  rolled back). This is not a hole by itself: your app may well refuse
  these values before they reach the database. It means nothing stops a
  bug, a script or a fix run by hand from storing them.

  Paste this into Lovable, Claude or Cursor:

    My database accepts some values my app should never store. Kryptheon tried each one on a copy:
    
    - accounts table takes -10 as balance.
    
    First check whether my app's code already refuses each of these. For the ones it does, add the same rule
    in the database too (a CHECK constraint for a range; for a row naming another organization's record, a
    foreign key on (organization_id, <parent>_id) to the parent's (organization_id, id), with a unique
    (organization_id, id) on the parent). Before adding a rule, find the rows that already break it and show
    them to me - do not delete or change any of them without asking.

  --------------------------------------------------------------------
  Nothing here touched your live app. I built a copy, attacked the copy,
  and deleted it. Not one real customer was involved.

  --------------------------------------------------------------------
  What I did not test

    Every table I could reach was attacked, and every attack I have
    finished, ran.

    One thing is never reported, on purpose: the lost update - two
    withdrawals of 100 from a balance of 100 that both go through.
    Every Postgres database behaves that way unless the app asks it
    not to, so whether yours is affected depends on code I never see.
    Flagging it would mean flagging every app with a number in it.

  This can also run every night by itself:  npx kryptheon-night install
tablebefore the scanafter the scan
accounts4 rows, f1d934ded84 rows, f1d934ded8
deposits3 rows, 1d4dcbdfbd3 rows, 1d4dcbdfbd
schemasauth,publicauth,public

What this does not prove

This is one small app, built by us, with holes we knew about. It shows what a run looks like and that it leaves your data alone. It does not show that Kryptheon finds every problem in your app - no tool does, and every report says what it could not test.