One Field, Two Answers: A Reset Link Through an Email Array

Web & API Security Level 2/4 ~3 min December 4, 2026

The challenge

You, Pinecone's Harbor admin, copy reset links. Find what else the email field accepts. Get the reset link for [email protected].

What you'll learn

  • Spot an API parameter that accepts an array where one string is expected
  • Explain how ActiveRecord turns an array into an SQL IN (...) clause
  • Recognise a check and an action that read the same input differently
  • Fix it by accepting scalars only and reusing the authorized record

Skills tested

API testingRequest tamperingBroken access control

Prerequisites

  • What a JSON request body is
  • How a password reset link works

How it works

A JSON body can hold more than strings: "email": ["a", "b"] is just as valid as "email": "a". Frameworks pass that value through, and Rails' ActiveRecord happily accepts it: find_by(email: [a, b]) becomes WHERE email IN (a, b) LIMIT 1.

Harbor's endpoint uses the raw value twice. The authorization step, scoped to your org, asks is any of these a member? The reset service, not scoped at all, asks which account has one of these? and takes whichever row the database returns first. Put one member and one outsider in the list and the two questions get different answers.

GitLab's CVE-2023-7028 (January 2024) came from the same gap: its forgot-password form accepted user[email][] as a list, found the account from one address and mailed the reset link to all of them, an attacker's included.

Common mistakes

  • Answering Sam's token. The prefilled request returns a real link, dz5QxBmm5XBw2RnTux1b, but it is Sam's: read user.email in the response.
  • Sending Ada alone. The membership check runs first: a 404 says she is not in Pinecone Labs. The list needs a member to get past it.
  • Writing both addresses in one string. "sam@...,ada@..." is one address that matches nobody. It has to be a real list: a JSON array, or email[]= twice in a form body.
  • Expecting the order to matter. SQL IN has no order: Ada comes back whether she is first or last, because her row comes first in the index.
  • Dropping the CSRF header or the session cookie. Rails checks the token against the session before the endpoint runs, so either one gets a 422.

How to defend against it

  • Accept a scalar only: params.permit(:email)[:email] filters out arrays and hashes, or reject the request when params[:email] is not a String.
  • Act on what you authorized: pass the member record the check found to the reset service instead of looking the account up again from raw input.
  • Scope every lookup to the tenant: current_org.users.find_by!, never a global User.find_by, in admin features.
  • Log and alert on reset links issued for accounts outside the caller's org, and keep staff accounts out of customer-facing admin tools.

Full solution

Pro and Max members unlock the complete step-by-step walkthrough.

Go Pro

Community stats

115 completions
67% success rate
M2F14M3 First blood

Related Daily Hacks

42,000+ Hackers Real labs Free
Start Hacking Free or solve today's hack, no account needed