Skip to content
Access control Write-up Intermediate

Server-side code still needs a permission check.

Three Next.js applications exposed Server Actions that performed sensitive operations without checking the caller's identity or permissions. An unauthenticated attacker could create users and API keys, read and modify content, obtain S3 upload URLs, and retrieve private user and partner data.

parsasec.com

Published on parsasec.com

I found the same access-control mistake at three companies: a Server Action performed a sensitive operation without checking who was calling.

skydesperados, on parsasec.com

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 Server Actions lacked authorization checks, so any caller could invoke them regardless of authentication or role.

Impact

An unauthenticated attacker could create admin accounts, read and modify private content, obtain S3 upload permissions, and access user profiles and partner contract details.

What the attacker needed

None

The fix

The actions should be fixed by verifying the caller's identity and permissions before performing sensitive operations, accepting only necessary fields, and returning only allowed data.

How it was found

  1. Find the action ID by watching network requests that carry the Next-Action header.
  2. Connect action IDs to function names by reading the JavaScript chunks.
  3. Replay a known request without cookies or authorization headers.
  4. For the first app, create a user and set an API key via the getResults action.
  5. Use the API key to access the admin API and read restricted collections.
  6. For the second app, read content, change a record by ID, and request a presigned S3 upload URL.

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.

Next.js Server Actions let a web page call a function on the server. The browser only gets an identifier for that function, not the code itself. If the server does not check who is calling before doing something sensitive, anyone who finds that identifier can call the function directly and do things they should not be allowed to do.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.