Stack

How to security test a Remix app

Updated

Test Remix by treating every loader and action as a public HTTP endpoint: loaders return data that is serialized to the client, and actions accept whatever the form posts. The bug is a loader returning a full record or an action reading a tenant id from formData.

Where this class of bug actually lives in a Remix app

  • Loader over-fetching. useLoaderData receives exactly what the loader returned, so a full Prisma record with include ships relations to the browser.
  • Action trust. formData.get('id') for the record being edited is client-controlled; the tenant must come from the session.
  • Resource routes. A route with no component is a raw endpoint — often the one nobody reviews, because it is not visibly a page.
  • Headers and cookies. A loader returning headers that set a cookie without HttpOnly hands the session to any XSS.

What to try first

  1. Open the Network tab and read the _data request response for every route; that is the loader payload verbatim.
  2. Replay each action POST with a swapped id and another tenant's value.
  3. Enumerate resource routes and request them with no session.
  4. Check Set-Cookie flags on login and refresh.

A reproduction you can keep

The ?_data= URL returns the loader result directly, which makes over-fetching trivial to confirm:

Read the loader payload, then replay the action
curl -sS 'https://staging.example.com/dashboard?_data=routes/dashboard' \
  -H 'Cookie: session=***'

curl -sS -i 'https://staging.example.com/invoices/1003' -X POST \
  -H 'Cookie: session=***' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data '_action=update&status=paid'

# vulnerable: payload carries internal fields; the action pays another tenant's invoice
# fixed: payload carries a projection; the action 403s

What "fixed" has to look like

Loaders should return a projection and actions should derive tenant scope from the session, so a foreign id in the body produces a 403 or 404 with no side effect. Confirm by re-reading the record after the replay.

Where people get this wrong

  • Shared loader code used by both a page and a resource route can leak the page's internal fields to the resource route's callers.
  • Remix revalidates loaders after an action, which can hide an over-fetch until you look at the raw payload.
  • A catch boundary that renders the error object shows stack traces in the page source.

What Offense does here

Offense runs an agent swarm against your app in a disposable sandbox, keeps the request, the identity and the vulnerable response as evidence, and replays the same attack after the fix so the retest is a control comparison rather than a green check. It does not read your source and it does not patch your code: the finding goes to your coding agent with the reproduction attached. The hosted workspace is invite-only — join the waitlist — and the free dependency audit in /install needs no account.

Questions this page answers

Can a Remix loader be called directly?

Yes, with ?_data= and the route id, or as a resource route. It is a public endpoint returning JSON.

Do Remix actions validate input?

Only if you do. formData is raw request data; use zod or a schema and derive identity from the session.

Written by Offense Research, reviewed December 2, 2026. Correct something? Email imran@offenseresearch.com.