Skip to content
Access control Write-up Advanced

Unauthenticated Strapi Relational-Filter Leak → Super-Admin Takeover → Server-Side Code Execution

A public Strapi blog endpoint allowed relational filters to query private administrator fields, creating a boolean oracle that let an unauthenticated attacker recover a live super-admin password-reset token. The token was exchanged for a super-admin JWT, and an editable email template that evaluated Lodash expressions then allowed JavaScript execution in the Node.js server process.

redhunter01 Follow

Published on medium.com

Bug Bounty

redhunter01, on medium.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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

Context

The target was an application running an older Strapi 3.x deployment. Strapi is a headless CMS, and the feature at the centre of this research is its public content API: content types such as blog posts are exposed over HTTP and can be filtered through query parameters. The affected content endpoint was:

HTTP
GET /blog-ens

The application allowed public filtering through query parameters, for example:

HTTP
GET /blog-ens?_where[created_by.id]=2

No authentication or authorisation header was required. A public blog endpoint being filterable is common, so at first glance this does not necessarily look dangerous. The interesting question was what relationships those filters could traverse, and that question led to the vulnerability.

Setup

No special accounts, tools or roles were needed to start: the entry point is unauthenticated. The public blog-ens content type had a relationship through created_by, so a filter could reference properties belonging to the related administrator object. Conceptually, the relationship graph looked like this:

Text
blog-ens
   │
   └── created_by
          │
          └── admin_users
                 ├── email
                 ├── isActive
                 ├── blocked
                 ├── role
                 └── resetPasswordToken

The controlled proof of code execution used a researcher-owned test account, and application state was restored afterwards.

Finding it

The critical problem was that fields could be used in filtering even though they were not returned in the normal API response. An application might correctly hide resetPasswordToken from JSON responses while accidentally allowing:

Text
_where[created_by.resetPasswordToken_gt]=...

to query it. The data is not being directly returned; instead, the application unintentionally provides an oracle about the data.

This is the core lesson of the research. Developers often think that because the API does not return a private field, the field is protected. That is not necessarily true. Consider an API returning:

JSON
{  "username": "alice"}

while the backend still allows queries against a private field:

Text
?_where[passwordResetToken_gt]=...

The attacker does not need the server to return passwordResetToken directly. They only need the server to answer questions about it. That is an indirect information disclosure.

Exploitation

Step 1: Establish a baseline

Before attempting to recover anything sensitive, the researcher established a baseline. The public request:

HTTP
GET /blog-ens?_where[created_by.id]=2

returned 17 records. This gave a known-good count to compare against.

Step 2: Confirm the administrator had a reset token

The next test checked whether the administrator had a reset token at all. The condition:

Text
resetPasswordToken_null=false

returned 17 records, while:

Text
resetPasswordToken_null=true

returned 0. That established a reliable boolean signal: the response count changes depending on the truth of a condition about a private field.

Step 3: Turn comparison into a boolean oracle

The key discovery was that relational comparison operators could be used against the private field, for example:

Text
_where[created_by.resetPasswordToken_gt]=<PROBE>

The number of returned blog records changed depending on whether the stored token was lexicographically greater than the supplied value. Effectively:

Text
Condition TRUE      ↓17 records
Text
Condition FALSE      ↓0 records

The API had become a binary communication channel. Conceptually:

Text
Attacker
   │
   │ "Is token > X?"
   ▼
Strapi
   │
   ▼
Database
   │
   ├── TRUE  → records returned
   └── FALSE → no records

This is the same fundamental idea behind blind SQL injection: you do not need the application to directly reveal the secret if you can repeatedly ask questions about it.

Step 4: Recover the token with binary search

Once the comparison operator worked, the question became whether the actual value could be recovered. The _gt operator allowed questions such as:

Text
Is the token greater than A?
Is the token greater than B?
Is the token greater than C?

Instead of trying every possible character sequentially, the search space can be divided, for example conceptually:

and then the range narrowed. This is binary search over the character set. The source report used this approach against the hexadecimal token alphabet and recovered the complete 40-character value.

The general technique matters because a secret character can be one of:

Text
0123456789abcdef

A naive approach might ask:

Text
Is it 0?
Is it 1?
Is it 2?
...

but a comparison oracle allows:

Text
Is it greater than 7?

then:

then divide again. The amount of information gained per request becomes much larger. Whenever you have an ordered oracle, think binary search.

The token itself was deliberately omitted from the published report because it was a live credential. The methodology is the point: for every position, determine the character, from position 1 through position 40.

Step 5: Verify the recovered value exactly

After recovering the candidate value, an exact-match verification was performed. The complete candidate returned 17 records. Changing one character caused 0 records. Removing one character also caused 0 records. That demonstrates that the oracle recovered the exact value, rather than producing an ambiguous partial result.

Step 6: Exchange the token for a super-admin JWT

At this point the security meaning of the recovered value had to be understood. The field was resetPasswordToken, which immediately changed the severity of the finding: a reset token is not merely information, it is potentially an authentication credential. The chain changed from information disclosure to information disclosure plus authentication material. The next question was whether the password-reset endpoint would accept the recovered token.

The administrator reset endpoint was:

HTTP
POST /admin/reset-password

The request supplied:

JSON
{  "resetPasswordToken": "<RECOVERED_TOKEN>",  "password": "<TEMPORARY_VERIFICATION_PASSWORD>"}

The server returned HTTP 200 along with a valid administrator JWT. The resulting identity was confirmed as:

Text
isActive: true
role: strapi-super-admin

The JWT successfully authenticated to:

HTTP
GET /admin/users/me

and returned 200 OK. At this point the account-takeover portion of the chain was proven.

Step 7: Confirm the password change is persistent

The researcher did not stop after receiving the JWT. The newly assigned administrator password was also verified through the normal administrator login endpoint. The login request returned another valid administrator JWT. That eliminated the possibility that the reset endpoint had generated a temporary or unusual token: the password change produced a functioning administrator credential.

Step 8: Map the administrative attack surface

With administrator access, the next phase was to determine what a Strapi super-admin can actually control. Rather than immediately modifying application code, the researcher looked for administrative functionality involving users, settings, email templates, content, plugins, configuration and templates. One particularly interesting area was:

Text
/users-permissions/email-templates

The application allowed authenticated administrators to retrieve and modify these templates. This became the second major pivot.

Step 9: Reach server-side evaluation through the template engine

The email template functionality accepted dynamic Lodash template expressions. This created a dangerous situation:

Text
Administrator-controlled template
        ↓
Template renderer
        ↓
JavaScript evaluation
        ↓
Node.js server process

If arbitrary expressions can execute rather than merely substitute inert variables, the template system is no longer just formatting email; it becomes a potential code-execution primitive. The report confirmed that the crafted template expression was evaluated during password-reset template rendering.

Step 10: Prove execution safely

Responsible testing matters here. No destructive actions were attempted. Instead, the proof was designed around a controlled filesystem marker. The server-side execution did three things:

  1. Write a known marker to /tmp
  2. Read the marker back
  3. Use that value against a researcher-owned test account

The marker was:

Text
strapi_e2e_rce_20260619

and was written to a temporary file. The server then read the file and used the value to rename an account controlled by the researcher. The pattern is:

Text
Controlled input
      ↓
Server-side evaluation
      ↓
Known filesystem operation
      ↓
Read result
      ↓
Controlled application-side effect

This establishes execution without requiring destructive exploitation. Simply saying "I think I have RCE" is weak; a stronger proof demonstrates an observable server-side side effect:

Text
Attacker-controlled template
        ↓
Node.js filesystem API
        ↓
/tmp/test-marker
        ↓
Read marker
        ↓
Modify researcher-owned object

Now there are multiple independent signals: a filesystem write, a filesystem read, and an application-side effect. That makes the RCE claim extremely difficult to dispute.

The complete chain

Text
UNAUTHENTICATED
                      │
                      ▼
               Public Strapi API
                      │
                      ▼
              Relational filter
                      │
                      ▼
           Private admin-field oracle
                      │
                      ▼
         resetPasswordToken recovered
                      │
                      ▼
           /admin/reset-password
                      │
                      ▼
              Super-admin JWT
                      │
                      ▼
           Administrator privileges
                      │
                      ▼
         Editable email templates
                      │
                      ▼
          Dynamic template evaluation
                      │
                      ▼
        JavaScript in Node.js process
                      │
               ┌──────┴──────┐
               ▼             ▼
        Filesystem write  Filesystem read
               │             │
               └──────┬──────┘
                      ▼
              Confirmed server RCE

Root cause

The chain had multiple underlying security failures.

  1. Relational authorisation failure. Public filters could traverse into private administrator fields.
  2. Private-field filtering was not restricted. Sensitive properties could participate in _gt, _lt, _eq, _contains, _null and related query operations.
  3. Reset tokens were indirectly exposed. A security-sensitive credential became recoverable through the public query oracle.
  4. Reset tokens were sufficient for administrator password reset. The token could be exchanged for a new administrator password and JWT.
  5. Dynamic server-side template evaluation. Administrator-editable email templates allowed executable expressions.

Together, an authorisation failure, credential disclosure, a weak reset boundary and template execution created the full compromise chain.

The underlying design mistake is a mismatch between output protection and query capability. The application protected the output field but not the query capability. Framework metadata often contains concepts such as private, hidden, protected or admin-only, but these controls may only affect serialisation. A field can be hidden from JSON while remaining queryable, sortable, filterable or searchable. The security policy must apply to all ways of interacting with the data, not only the final response.

Impact

An unauthenticated attacker could recover a live administrator password-reset token character by character through the public blog endpoint, exchange it at the administrator reset endpoint for a super-admin JWT, and then use administrator privileges to edit email templates whose dynamic Lodash expressions were evaluated inside the Strapi server process. That evaluation allowed confirmed JavaScript execution in the Node.js process, with filesystem write and read demonstrated through a harmless marker file.

The difference in impact between the individual findings is the point. Finding A, an attacker can determine whether a reset token exists, is interesting but limited. Finding B, an attacker can recover the complete reset token, submit it to the password-reset endpoint, change the administrator password and receive an administrator JWT, is a fundamentally different impact: the attacker has crossed from information disclosure to account takeover. The report notes that the recovered token was accepted directly by the administrator reset endpoint, which transformed the disclosure into account takeover.

The report was accepted as an incident, the severity was ultimately assessed as critical, and the organisation chose immediate remediation and decommissioning of the affected product.

Fix

The remediation should happen at multiple layers.

Immediately:

Text
Rotate administrator credentials
Invalidate administrator sessions
Invalidate existing reset tokens

Secrets to rotate:

Text
Database credentials
Email credentials
API keys
Cloud credentials
JWT/session secrets

Framework: upgrade the EOL Strapi v3 deployment to a supported version.

API authorisation: prevent public relational filters from traversing private relationships such as:

Text
created_by
updated_by
admin_users

Query allowlisting: explicitly allow only safe fields, operators and relationships, rather than allowing arbitrary relational queries.

Template security: remove dynamic template evaluation and only permit predefined inert variables. The report's remediation specifically recommends removing dynamic Lodash template evaluation and allowing only inert, explicitly approved variables. The security boundary needs to be explicit allowed variables plus no arbitrary evaluation.

Cleanup was part of the workflow. The investigation restored the original email templates, the temporary filesystem marker, the researcher-owned test user and the registration configuration, and confirmed that the old reset token had been consumed. Responsible research is not exploit, screenshot, report; it is discover, validate, demonstrate, minimise impact, restore state, document, report.

Variants to test

When testing APIs built on frameworks such as Strapi, do not only inspect the JSON response. Study the query language exposed by the API. Look for operators such as:

Text
_where
_eq
_ne
_gt
_gte
_lt
_lte
_contains
_null
_sort

Then investigate relationships:

The important question is whether a public object can query properties belonging to a private related object. A positive result is a response whose record count changes when you vary a condition on a field that is never present in the JSON.

Concrete things to try:

  1. Private-field equality. Send _where[created_by.resetPasswordToken_eq]=<guess> and compare the count with a deliberately wrong guess. A positive result is a count difference between the two requests.
  2. Private-field comparison. Send _where[created_by.resetPasswordToken_gt]=<probe> with probes across the alphabet. A positive result is a stable split in record counts, which turns into a binary search.
  3. Null checks. Send resetPasswordToken_null=false and resetPasswordToken_null=true. A positive result is a count difference between the two requests, proving the field participates in filtering.
  4. Other sensitive fields. Once a private field is queryable, prioritise fields with security significance: resetPasswordToken, apiKey, secret, token, verificationCode, passwordResetToken, session, oauthToken. A positive result is any of these producing a count-based signal.
  5. Authorisation at the query layer. Check whether the application blocks admin_users.password_gt, admin_users.resetPasswordToken_eq, admin_users.email_contains and admin_users.role_eq even though it correctly refuses to return admin_users.password. A positive result is a count-based signal from a field that is never returned.
  6. Reset-token behaviour. If you discover a resetPasswordToken, ask whether it is expired, single-use, bound to the correct account, whether it invalidates old sessions, whether it requires another verification factor, and whether it can reset an administrator. A positive result is a reset token that the administrator reset endpoint accepts.
  7. Template engines after takeover. Once administrator access is obtained, first map privileges and look for templates, plugins, configuration, webhooks, scripts, uploads, integrations, email templates and content. Whenever you find Lodash templates, Handlebars, Mustache, Jinja, Twig, EJS, Pug or custom expression languages, ask whether the input is merely interpolated or actually evaluated. A positive result is a controlled side effect, such as a harmless marker written and read back, rather than a destructive command.

Every vulnerability should lead to a new question: what can this public endpoint filter, which related objects can it reach, can I turn this into a boolean oracle, is this token actually usable, what administrative features process attacker-controlled input, is this template engine performing evaluation or just interpolation, and can I prove execution safely with a controlled side effect.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 27 min read.

What happened, in plain words

A website was built with a tool called Strapi, which is a way of storing content (like blog posts) and serving it to other programs over the internet. The site had a public page that listed blog posts, and anyone could add little instructions to the web address to filter which posts came back. That part is normal and harmless on its own.

The problem was that the filter could follow a link from a blog post to the person who wrote it, and that person was an administrator. By asking carefully worded questions through the filter, a researcher could make the site answer yes or no about a secret value stored on the administrator's account: a password-reset token. A reset token is a short code that proves you are allowed to set a new password. By asking enough yes/no questions, the researcher worked out the whole token, one character at a time.

With that token, the researcher set a new password for the administrator account and logged in as a super-admin. From there, the researcher found that the site let administrators edit the text of automated emails, and that this text was not treated as plain text but actually run as a small program on the server. That allowed the researcher to run code on the server itself, which is about as serious as it gets. The proof was done carefully: a harmless file was written and read back, and a test account owned by the researcher was renamed, then everything was put back.

The report was accepted, rated critical, and the organisation chose to fix things immediately and shut the affected product down.

1. The starting point: a public blog endpoint

Strapi is what people call a headless CMS. "CMS" means content management system: software for storing articles, images and similar content. "Headless" means it does not come with its own visible website; instead it offers an API, a way for other programs (or a browser) to ask it for data over the internet.

An API is easiest to picture as a waiter in a restaurant. You do not walk into the kitchen; you tell the waiter what you want, and the waiter brings it back. In web terms, your browser sends a request ("give me the list of blog posts") to a server (the computer that holds the data), and the server sends back a response (the list, usually in a format called JSON, which is just structured text).

The affected content endpoint was:

HTTP
GET /blog-ens

Line by line:

  • GET is the type of request. It means "give me something", as opposed to POST, which means "here is some data, do something with it".
  • /blog-ens is the address of the resource on the server. Think of it as the name of the dish on the menu. blog-ens is the name of this particular content type (blog posts, in English).
  • Together, this says: "server, please send me the list of blog posts".

The application allowed public filtering through query parameters, for example:

HTTP
GET /blog-ens?_where[created_by.id]=2

Line by line:

  • Everything up to the ? is the same request as before.
  • The ? marks the start of query parameters: extra instructions added to the address, like telling the waiter "only the vegetarian dishes".
  • _where[created_by.id]=2 is one such instruction. _where is Strapi's name for a filter. Inside the square brackets, created_by.id means "the ID of the user who created the post". =2 means "must equal 2". So the whole thing says: "only give me blog posts created by user number 2".

No authentication or authorisation header was required. Two words worth unpacking:

  • Authentication is proving who you are, like showing your passport.
  • Authorisation is what you are allowed to do once you are known, like a passport not granting you the right to enter every room.

A header is a small piece of extra information attached to a request, such as "here is my identity badge". Saying no header was required means the request worked for a complete stranger with no account at all. In security language, that is an unauthenticated request.

A public blog endpoint being filterable is common, so at first glance this does not necessarily look dangerous. The interesting question was what relationships those filters could traverse, and that question led to the vulnerability.

2. Setup: what was needed to start

No special accounts, tools or roles were needed to start: the entry point is unauthenticated. Anyone with a browser or a simple command-line tool could send the request.

The public blog-ens content type had a relationship through created_by, so a filter could reference properties belonging to the related administrator object. A relationship in a database is a link between two records, like the line on a family tree connecting a child to a parent. Here, each blog post is linked to the user who created it, and that user record is an administrator account.

Conceptually, the relationship graph looked like this:

Text
blog-ens
   │
   └── created_by
          │
          └── admin_users
                 ├── email
                 ├── isActive
                 ├── blocked
                 ├── role
                 └── resetPasswordToken

Line by line:

  • blog-ens is the starting point: the public blog posts.
  • created_by is the link from a post to its author.
  • admin_users is the table (think: spreadsheet) of administrator accounts.
  • email, isActive, blocked, role and resetPasswordToken are individual columns in that spreadsheet. email is the address, isActive says whether the account is enabled, blocked says whether it is banned, role says what permissions it has, and resetPasswordToken is the secret code used for password resets.

The diagram is the key to the whole story: the public blog posts are connected, through one link, to private administrator data.

The controlled proof of code execution used a researcher-owned test account, and application state was restored afterwards.

3. Finding it: hidden fields can still answer questions

The critical problem was that fields could be used in filtering even though they were not returned in the normal API response. An application might correctly hide resetPasswordToken from JSON responses while accidentally allowing:

Text
_where[created_by.resetPasswordToken_gt]=...

Line by line:

  • _where again means "filter".
  • created_by.resetPasswordToken means "follow the link from the blog post to its creator, then look at that creator's reset token".
  • _gt means "greater than". It is a comparison operator, a way of asking a question rather than demanding an exact match.
  • =... is where the value to compare against would go.

So this instruction says: "give me blog posts whose creator's reset token is alphabetically greater than this value". The data is not being directly returned; instead, the application unintentionally provides an oracle about the data.

An oracle, in security, is anything that answers questions about a secret. It does not have to reveal the secret directly. A classic everyday comparison: a friend has a number between 1 and 100 and will only answer "is your number higher than X?". They never tell you the number, but after enough questions you know it exactly.

This is the core lesson of the research. Developers often think that because the API does not return a private field, the field is protected. That is not necessarily true. Consider an API returning:

JSON
{  "username": "alice"}

Line by line:

  • The curly braces { } mark an object: a collection of named values.
  • "username" is the name of a field.
  • "alice" is its value.
  • So this response says: "the user is called alice", and nothing else. No password, no token, no email.

while the backend still allows queries against a private field:

Text
?_where[passwordResetToken_gt]=...

Line by line:

  • ? starts the query parameters, as before.
  • _where[passwordResetToken_gt] is a filter on a field called passwordResetToken, using "greater than".
  • =... is the value to compare against.

The attacker does not need the server to return passwordResetToken directly. They only need the server to answer questions about it. That is an indirect information disclosure. "Disclosure" simply means information leaking out; "indirect" means it leaks through side effects rather than being printed on the screen.

4. Exploitation

Step 1: Establish a baseline

Before attempting to recover anything sensitive, the researcher established a baseline. A baseline is a known, normal result you can compare later results against, like weighing yourself before a diet so you can tell whether anything changed.

The public request:

HTTP
GET /blog-ens?_where[created_by.id]=2

Line by line:

  • GET asks for data.
  • /blog-ens is the blog post list.
  • ?_where[created_by.id]=2 filters to posts created by user number 2.

returned 17 records. This gave a known-good count to compare against. A record is one row of data, here one blog post. So the server said: "there are 17 blog posts by user 2".

Step 2: Confirm the administrator had a reset token

The next test checked whether the administrator had a reset token at all. The condition:

Text
resetPasswordToken_null=false

Line by line:

  • resetPasswordToken is the field being tested.
  • _null is an operator meaning "is empty / has no value".
  • =false means "the statement 'it is empty' is false", in other words: the token exists and has a value.

returned 17 records, while:

Text
resetPasswordToken_null=true

Line by line:

  • Same field, same operator.
  • =true means "the statement 'it is empty' is true", in other words: there is no token.

returned 0. That established a reliable boolean signal: the response count changes depending on the truth of a condition about a private field. Boolean means true or false. A signal is an observable difference you can rely on, like a light switching on or off.

Why this step mattered: before trying to read a secret, you want to know the secret exists and that your questions actually reach it. If both requests had returned 17, the field would not be participating in filtering at all, and the whole approach would be dead.

Step 3: Turn comparison into a boolean oracle

The key discovery was that relational comparison operators could be used against the private field, for example:

Text
_where[created_by.resetPasswordToken_gt]=<PROBE>

Line by line:

  • _where starts a filter.
  • created_by.resetPasswordToken follows the link from post to creator, then looks at the token.
  • _gt asks "is it greater than".
  • <PROBE> is a placeholder for the value you are testing. A probe is a test value you send to see how the system reacts, like dipping a toe in water to check the temperature.

The number of returned blog records changed depending on whether the stored token was lexicographically greater than the supplied value. Lexicographic means in dictionary order: comparing text character by character, the way a dictionary sorts words. "apple" comes before "banana" because a comes before b.

Effectively:

Text
Condition TRUE      ↓17 records

Line by line:

  • Condition TRUE means the question you asked was true.
  • ↓ means "results in".
  • 17 records means the server returned the full set of 17 posts.
Text
Condition FALSE      ↓0 records

Line by line:

  • Condition FALSE means the question was false.
  • 0 records means the server returned nothing.

The API had become a binary communication channel. Binary means two states only, like a light switch. The server was now effectively answering yes or no to any question about the secret.

Conceptually:

Text
Attacker
   │
   │ "Is token > X?"
   ▼
Strapi
   │
   ▼
Database
   │
   ├── TRUE  → records returned
   └── FALSE → no records

Line by line:

  • Attacker is the person sending the request.
  • The arrow with "Is token > X?" is the question being sent.
  • Strapi is the application receiving it.
  • Database is where the actual data lives.
  • TRUE → records returned means if the answer is yes, posts come back.
  • FALSE → no records means if the answer is no, nothing comes back.

This is the same fundamental idea behind blind SQL injection. SQL injection is when an attacker sneaks database instructions into input the application trusts. Blind means the attacker cannot see the database output directly, only whether something happened or not. You do not need the application to directly reveal the secret if you can repeatedly ask questions about it.

Step 4: Recover the token with binary search

Once the comparison operator worked, the question became whether the actual value could be recovered. The _gt operator allowed questions such as:

Text
Is the token greater than A?
Is the token greater than B?
Is the token greater than C?

Line by line:

  • Each line is a yes/no question about the secret.
  • greater than uses dictionary order, as explained above.
  • A, B, C are probe values.

Instead of trying every possible character sequentially, the search space can be divided, for example conceptually:

Line by line:

  • Each line is a range of characters.
  • A-F means "from A to F".
  • The idea is to ask "is the character in the first half or the second half?", then split again.

and then the range narrowed. This is binary search over the character set. Binary search means repeatedly halving the possibilities: is it in this half or that half? With 16 possible characters, you need about 4 questions instead of up to 16. The source report used this approach against the hexadecimal token alphabet and recovered the complete 40-character value. Hexadecimal means using the characters 0-9 and a-f, a common way of writing tokens.

The general technique matters because a secret character can be one of:

Text
0123456789abcdef

Line by line:

  • This is the alphabet of hexadecimal characters.
  • Each character in the secret is one of these 16 possibilities.

A naive approach might ask:

Text
Is it 0?
Is it 1?
Is it 2?
...

Line by line:

  • Each line tests one exact value.
  • This works but is slow: worst case, 16 questions per character.

but a comparison oracle allows:

Text
Is it greater than 7?

Line by line:

  • One question splits the 16 possibilities into two groups of 8.
  • If yes, the character is in 8-f; if no, it is in 0-7.

then:

Line by line:

  • 0-7 is the lower half.
  • 8-f is the upper half.
  • You keep the half that matches the answer and split it again.

then divide again. The amount of information gained per request becomes much larger. Whenever you have an ordered oracle, think binary search. Ordered means the values have a natural sequence, like numbers or dictionary order, so "greater than" makes sense.

The token itself was deliberately omitted from the published report because it was a live credential. A credential is anything that proves identity or permission, like a key. The methodology is the point: for every position, determine the character, from position 1 through position 40.

Step 5: Verify the recovered value exactly

After recovering the candidate value, an exact-match verification was performed. The complete candidate returned 17 records. Changing one character caused 0 records. Removing one character also caused 0 records. That demonstrates that the oracle recovered the exact value, rather than producing an ambiguous partial result.

Why this matters: if you only ever ask "greater than" questions, you might end up with a value that is close but not exact. By testing the full candidate and then deliberately breaking it, you prove the answer is precise. It is like checking a copied phone number by dialling it, then changing one digit and confirming it no longer connects.

Step 6: Exchange the token for a super-admin JWT

At this point the security meaning of the recovered value had to be understood. The field was resetPasswordToken, which immediately changed the severity of the finding: a reset token is not merely information, it is potentially an authentication credential. The chain changed from information disclosure to information disclosure plus authentication material. The next question was whether the password-reset endpoint would accept the recovered token.

The administrator reset endpoint was:

HTTP
POST /admin/reset-password

Line by line:

  • POST means "here is some data, please act on it".
  • /admin/reset-password is the address of the password-reset feature for administrators.
  • An endpoint is simply a specific address on a server that does a specific job, like a counter in a bank.

The request supplied:

JSON
{  "resetPasswordToken": "<RECOVERED_TOKEN>",  "password": "<TEMPORARY_VERIFICATION_PASSWORD>"}

Line by line:

  • { } marks a JSON object, a bundle of named values.
  • "resetPasswordToken" is the name of the first field, and "<RECOVERED_TOKEN>" is the secret code recovered earlier. The angle brackets are placeholders, not literal text.
  • "password" is the name of the second field, and "<TEMPORARY_VERIFICATION_PASSWORD>" is the new password the researcher wanted to set.
  • So the request says: "here is a valid reset token and here is the new password I want; please change it".

The server returned HTTP 200 along with a valid administrator JWT. HTTP 200 is the standard status code for "OK, it worked". A JWT (JSON Web Token) is a signed piece of text that a server gives you after you log in, so that later requests can prove who you are without sending your password again. Think of it as a wristband at a festival: you show it at the gate instead of your ticket every time.

The resulting identity was confirmed as:

Text
isActive: true
role: strapi-super-admin

Line by line:

  • isActive: true means the account is enabled.
  • role: strapi-super-admin means the account has the highest level of permission in Strapi. A role is a bundle of permissions, like "manager" versus "cashier".

The JWT successfully authenticated to:

HTTP
GET /admin/users/me

Line by line:

  • GET asks for data.
  • /admin/users/me is an endpoint that returns information about the currently logged-in user.
  • Sending the JWT with this request is a way of asking: "who am I, according to you?".

and returned 200 OK. At this point the account-takeover portion of the chain was proven. Account takeover means logging in as someone else without their permission.

Step 7: Confirm the password change is persistent

The researcher did not stop after receiving the JWT. The newly assigned administrator password was also verified through the normal administrator login endpoint. The login request returned another valid administrator JWT. That eliminated the possibility that the reset endpoint had generated a temporary or unusual token: the password change produced a functioning administrator credential.

Why this extra step: a JWT could in theory be a one-off fluke. Logging in normally with the new password proves the change is real and lasting. Persistent means it stays, rather than disappearing after one use.

Step 8: Map the administrative attack surface

With administrator access, the next phase was to determine what a Strapi super-admin can actually control. Attack surface means all the places where an attacker could potentially interact with the system, like counting all the doors and windows of a building.

Rather than immediately modifying application code, the researcher looked for administrative functionality involving users, settings, email templates, content, plugins, configuration and templates. A plugin is an add-on that extends what the software can do, like an app on a phone.

One particularly interesting area was:

Text
/users-permissions/email-templates

Line by line:

  • users-permissions is the name of a Strapi plugin that handles user accounts and permissions.
  • email-templates is the part that stores the text of automated emails, such as the password-reset email.
  • Together, this is the address of the feature that lets administrators edit those emails.

The application allowed authenticated administrators to retrieve and modify these templates. This became the second major pivot. A pivot is using one foothold to reach somewhere new, like climbing from a chair onto a table.

Step 9: Reach server-side evaluation through the template engine

The email template functionality accepted dynamic Lodash template expressions. Lodash is a popular JavaScript helper library, and its template feature lets you put small pieces of code inside text, which get filled in or run when the text is rendered. Dynamic means the code is worked out at the moment it runs, rather than being fixed in advance.

This created a dangerous situation:

Text
Administrator-controlled template
        ↓
Template renderer
        ↓
JavaScript evaluation
        ↓
Node.js server process

Line by line:

  • Administrator-controlled template is the email text an admin can edit.
  • Template renderer is the part of the software that turns the template into a finished email.
  • JavaScript evaluation means the renderer actually runs the code inside the template.
  • Node.js server process is the program on the server that does the work. Node.js is a way of running JavaScript outside a browser, on a server.

If arbitrary expressions can execute rather than merely substitute inert variables, the template system is no longer just formatting email; it becomes a potential code-execution primitive. Inert means it just sits there as plain data and does nothing. A primitive in security is a basic building block you can use to do bigger things, like a single Lego brick.

The report confirmed that the crafted template expression was evaluated during password-reset template rendering. In other words, when the site sent a password-reset email, it ran the code hidden in the template.

Step 10: Prove execution safely

Responsible testing matters here. No destructive actions were attempted. Instead, the proof was designed around a controlled filesystem marker. A filesystem is how a computer organises files and folders. A marker is a harmless, recognisable value you leave behind so you can prove you were there, like a signed guestbook entry.

The server-side execution did three things:

  1. Write a known marker to /tmp
  2. Read the marker back
  3. Use that value against a researcher-owned test account

Line by line:

  • Write a known marker to /tmp: /tmp is the temporary folder where the marker was written.
  • Read the marker back: this proves the server can also read files, not just write them.
  • Use that value against a researcher-owned test account: the researcher's own account is renamed using the marker, proving the code can affect the application, not just the disk.

The marker was:

Text
strapi_e2e_rce_20260619

Line by line:

  • This is a unique, recognisable string.
  • This is a unique, recognisable string.
  • Because it is unique, finding it later proves it came from this test and nowhere else.

and was written to a temporary file. The server then read the file and used the value to rename an account controlled by the researcher. The pattern is:

Text
Controlled input
      ↓
Server-side evaluation
      ↓
Known filesystem operation
      ↓
Read result
      ↓
Controlled application-side effect

Line by line:

  • Controlled input is the template the researcher wrote.
  • Server-side evaluation is the server running it.
  • Known filesystem operation is the file write and read.
  • Read result is the marker coming back.
  • Controlled application-side effect is the renamed test account.

This establishes execution without requiring destructive exploitation. Simply saying "I think I have RCE" is weak; a stronger proof demonstrates an observable server-side side effect. RCE stands for remote code execution: running your own code on someone else's server. A side effect is a change you can see, like a footprint in snow.

Text
Attacker-controlled template
        ↓
Node.js filesystem API
        ↓
/tmp/test-marker
        ↓
Read marker
        ↓
Modify researcher-owned object

Line by line:

  • Attacker-controlled template is the email text under the researcher's control.
  • Node.js filesystem API is the built-in set of functions Node.js offers for working with files.
  • /tmp/test-marker is the file path used.
  • Read marker is reading the file back.
  • Modify researcher-owned object is renaming the researcher's own account.

Now there are multiple independent signals: a filesystem write, a filesystem read, and an application-side effect. That makes the RCE claim extremely difficult to dispute. Independent here means each signal would be meaningful on its own, so together they are very hard to explain away.

The complete chain

Text
UNAUTHENTICATED
                      │
                      ▼
               Public Strapi API
                      │
                      ▼
              Relational filter
                      │
                      ▼
           Private admin-field oracle
                      │
                      ▼
         resetPasswordToken recovered
                      │
                      ▼
           /admin/reset-password
                      │
                      ▼
              Super-admin JWT
                      │
                      ▼
           Administrator privileges
                      │
                      ▼
         Editable email templates
                      │
                      ▼
          Dynamic template evaluation
                      │
                      ▼
        JavaScript in Node.js process
                      │
               ┌──────┴──────┐
               ▼             ▼
        Filesystem write  Filesystem read
               │             │
               └──────┬──────┘
                      ▼
              Confirmed server RCE

Line by line:

  • UNAUTHENTICATED is the starting point: no login needed.
  • Public Strapi API is the open blog endpoint.
  • Relational filter is the ability to filter through relationships.
  • Private admin-field oracle is the yes/no channel about admin data.
  • resetPasswordToken recovered is the secret being worked out.
  • /admin/reset-password is the endpoint that accepts the token.
  • Super-admin JWT is the login wristband for the highest role.
  • Administrator privileges is what that role can do.
  • Editable email templates is the feature that lets admins change emails.
  • Dynamic template evaluation is the code being run.
  • JavaScript in Node.js process is code running on the server.
  • Filesystem write and Filesystem read are the two file operations.
  • Confirmed server RCE is the final proven result.

Root cause

The chain had multiple underlying security failures. A root cause is the underlying reason something is possible, not just the symptom.

  1. Relational authorisation failure. Public filters could traverse into private administrator fields.
  2. Private-field filtering was not restricted. Sensitive properties could participate in _gt, _lt, _eq, _contains, _null and related query operations.
  3. Reset tokens were indirectly exposed. A security-sensitive credential became recoverable through the public query oracle.
  4. Reset tokens were sufficient for administrator password reset. The token could be exchanged for a new administrator password and JWT.
  5. Dynamic server-side template evaluation. Administrator-editable email templates allowed executable expressions.

Together, an authorisation failure, credential disclosure, a weak reset boundary and template execution created the full compromise chain.

The underlying design mistake is a mismatch between output protection and query capability. The application protected the output field but not the query capability. Framework metadata often contains concepts such as private, hidden, protected or admin-only, but these controls may only affect serialisation. Serialisation is turning internal data into the text format sent back to the browser. A field can be hidden from JSON while remaining queryable, sortable, filterable or searchable. The security policy must apply to all ways of interacting with the data, not only the final response.

Impact

An unauthenticated attacker could recover a live administrator password-reset token character by character through the public blog endpoint, exchange it at the administrator reset endpoint for a super-admin JWT, and then use administrator privileges to edit email templates whose dynamic Lodash expressions were evaluated inside the Strapi server process. That evaluation allowed confirmed JavaScript execution in the Node.js process, with filesystem write and read demonstrated through a harmless marker file.

The difference in impact between the individual findings is the point. Finding A, an attacker can determine whether a reset token exists, is interesting but limited. Finding B, an attacker can recover the complete reset token, submit it to the password-reset endpoint, change the administrator password and receive an administrator JWT, is a fundamentally different impact: the attacker has crossed from information disclosure to account takeover. The report notes that the recovered token was accepted directly by the administrator reset endpoint, which transformed the disclosure into account takeover.

The report was accepted as an incident, the severity was ultimately assessed as critical, and the organisation chose immediate remediation and decommissioning of the affected product. Decommissioning means shutting the product down.

Fix

The remediation should happen at multiple layers. Remediation means the fix.

Immediately:

Text
Rotate administrator credentials
Invalidate administrator sessions
Invalidate existing reset tokens

Line by line:

  • Rotate administrator credentials means change the passwords and keys, so old ones stop working. Rotate is the standard word for replacing a secret.
  • Invalidate administrator sessions means log out anyone currently logged in. A session is a period of being logged in.
  • Invalidate existing reset tokens means make all outstanding reset codes useless.

Secrets to rotate:

Text
Database credentials
Email credentials
API keys
Cloud credentials
JWT/session secrets

Line by line:

  • Database credentials are the username and password for the database.
  • Email credentials are the login details for the email service.
  • API keys are passwords for programs.
  • Cloud credentials are login details for cloud hosting.
  • JWT/session secrets are the secret values used to sign login tokens. If these leak, an attacker can forge tokens.

Framework: upgrade the EOL Strapi v3 deployment to a supported version. EOL means end of life: the software no longer receives security updates.

API authorisation: prevent public relational filters from traversing private relationships such as:

Text
created_by
updated_by
admin_users

Line by line:

  • created_by is the link to the creator.
  • updated_by is the link to the last editor.
  • admin_users is the administrator table.
  • The fix is to stop public filters from following these links.

Query allowlisting: explicitly allow only safe fields, operators and relationships, rather than allowing arbitrary relational queries. An allowlist is a list of things that are permitted, with everything else refused by default.

Template security: remove dynamic template evaluation and only permit predefined inert variables. The report's remediation specifically recommends removing dynamic Lodash template evaluation and allowing only inert, explicitly approved variables. The security boundary needs to be explicit allowed variables plus no arbitrary evaluation.

Cleanup was part of the workflow. The investigation restored the original email templates, the temporary filesystem marker, the researcher-owned test user and the registration configuration, and confirmed that the old reset token had been consumed. Responsible research is not exploit, screenshot, report; it is discover, validate, demonstrate, minimise impact, restore state, document, report.

Variants to test

When testing APIs built on frameworks such as Strapi, do not only inspect the JSON response. Study the query language exposed by the API. Look for operators such as:

Text
_where
_eq
_ne
_gt
_gte
_lt
_lte
_contains
_null
_sort

Line by line:

  • _where starts a filter.
  • _eq means equals.
  • _ne means not equals.
  • _gt means greater than.
  • _gte means greater than or equal.
  • _lt means less than.
  • _lte means less than or equal.
  • _contains means the text contains a given piece.
  • _null means is empty.
  • _sort orders the results.

Then investigate relationships:

Line by line:

  • Each of these is a common name for a link from one record to a person or group.
  • They are worth testing because they may lead to more privileged data.

The important question is whether a public object can query properties belonging to a private related object. A positive result is a response whose record count changes when you vary a condition on a field that is never present in the JSON.

Concrete things to try:

  1. Private-field equality. Send _where[created_by.resetPasswordToken_eq]=<guess> and compare the count with a deliberately wrong guess. A positive result is a count difference between the two requests.
  2. Private-field comparison. Send _where[created_by.resetPasswordToken_gt]=<probe> with probes across the alphabet. A positive result is a stable split in record counts, which turns into a binary search.
  3. Null checks. Send resetPasswordToken_null=false and resetPasswordToken_null=true. A positive result is a count difference between the two requests, proving the field participates in filtering.
  4. Other sensitive fields. Once a private field is queryable, prioritise fields with security significance: resetPasswordToken, apiKey, secret, token, verificationCode, passwordResetToken, session, oauthToken. A positive result is any of these producing a count-based signal.
  5. Authorisation at the query layer. Check whether the application blocks admin_users.password_gt, admin_users.resetPasswordToken_eq, admin_users.email_contains and admin_users.role_eq even though it correctly refuses to return admin_users.password. A positive result is a count-based signal from a field that is never returned.
  6. Reset-token behaviour. If you discover a resetPasswordToken, ask whether it is expired, single-use, bound to the correct account, whether it invalidates old sessions, whether it requires another verification factor, and whether it can reset an administrator. A positive result is a reset token that the administrator reset endpoint accepts.
  7. Template engines after takeover. Once administrator access is obtained, first map privileges and look for templates, plugins, configuration, webhooks, scripts, uploads, integrations, email templates and content. Whenever you find Lodash templates, Handlebars, Mustache, Jinja, Twig, EJS, Pug or custom expression languages, ask whether the input is merely interpolated or actually evaluated. A positive result is a controlled side effect, such as a harmless marker written and read back, rather than a destructive command.

Every vulnerability should lead to a new question: what can this public endpoint filter, which related objects can it reach, can I turn this into a boolean oracle, is this token actually usable, what administrative features process attacker-controlled input, is this template engine performing evaluation or just interpolation, and can I prove execution safely with a controlled side effect.

Glossary

  • API: a way for one program to ask another for data or actions, like a waiter taking your order.
  • Account takeover: logging in as someone else without their permission.
  • Allowlist: a list of things that are permitted, with everything else refused.
  • Attack surface: all the places where an attacker could interact with a system.
  • Authentication: proving who you are.
  • Authorisation: what you are allowed to do once you are known.
  • Baseline: a known normal result used for comparison.
  • Binary: having only two states, like on and off.
  • Binary search: repeatedly halving the possibilities to find a value quickly.
  • Blind SQL injection: sneaking database instructions into input, where you cannot see the output directly and rely on side effects.
  • Boolean: true or false.
  • CMS: content management system, software for storing and serving content.
  • Comparison operator: a query operator that asks how two values relate, such as greater than or less than.
  • Credential: anything that proves identity or permission, like a password or key.
  • Decommissioning: shutting a product down.
  • Dynamic: worked out at the moment it runs, rather than fixed in advance.
  • Endpoint: a specific address on a server that does a specific job.
  • EOL: end of life, meaning software no longer receives security updates.
  • Filesystem: how a computer organises files and folders.
  • GET: a request type meaning "give me something".
  • Header: extra information attached to a request, such as an identity badge.
  • Hexadecimal: a way of writing values using the characters 0-9 and a-f.
  • HTTP 200: the standard status code meaning the request succeeded.
  • Inert: present as plain data that does nothing.
  • JSON: a structured text format for data, using braces and names.
  • JWT: a signed piece of text given after login, used to prove identity on later requests.
  • Lexicographic: in dictionary order, comparing text character by character.
  • Lodash: a JavaScript helper library whose template feature can run small pieces of code inside text.
  • Marker: a harmless, recognisable value left behind to prove something happened.
  • Node.js: a way of running JavaScript on a server rather than in a browser.
  • Oracle: anything that answers questions about a secret without revealing it directly.
  • Persistent: lasting, rather than disappearing after one use.
  • Pivot: using one foothold to reach somewhere new.
  • Plugin: an add-on that extends what software can do.
  • POST: a request type meaning "here is some data, please act on it".
  • Primitive: a basic building block used to do bigger things.
  • Probe: a test value sent to see how a system reacts.
  • Query parameters: extra instructions added to a web address after a ?.
  • RCE: remote code execution, running your own code on someone else's server.
  • Record: one row of data, such as one blog post.
  • Relationship: a link between two records in a database.
  • Remediation: the fix for a vulnerability.
  • Request: a message sent to a server asking for something.
  • Response: the message a server sends back.
  • Role: a bundle of permissions, such as manager or cashier.
  • Root cause: the underlying reason something is possible.
  • Rotate: replace a secret so the old one stops working.
  • Serialisation: turning internal data into the text format sent back to the browser.
  • Session: a period of being logged in.
  • Side effect: an observable change caused by an action.
  • Signal: an observable difference you can rely on.
  • SQL injection: sneaking database instructions into input the application trusts.
  • Strapi: a headless CMS that serves content over an API.
  • Unauthenticated: without logging in or proving identity.

More by redhunter01

View all

24 more disclosed reports, best first.

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.