Skip to content
Business logic Write-up Intermediate

Unauthenticated Email Injection: Turning a Transactional Email Endpoint into a Phishing Delivery…

An unauthenticated trade-in confirmation endpoint accepted a client-supplied recipient address and reflected client-controlled fields into an email sent from the organisation's legitimate, DKIM/SPF-authenticated sender. By encoding URL characters as JSON Unicode escapes, the attacker bypassed the WAF's URL filter and delivered a phishing link to an arbitrary mailbox.

redhunter01 Follow

Published on medium.com

Cybersecurity

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. 10 min read.

Context

The target was REI's trade-in confirmation email functionality, exposed through an API endpoint that sends a transactional message associated with a trade-in. The endpoint is:

HTTP
POST /used/emails/v1/confirmation

Normally this feature sends a confirmation email tied to a trade-in transaction. Transactional email endpoints sit at the intersection of authentication, authorisation, user-controlled data and trusted infrastructure, which is why they are worth attention during a bug bounty assessment. An endpoint that appears to simply send a confirmation email becomes more dangerous when it is reachable without authentication, when the recipient address is controlled by the request, when the email content is populated from client-controlled parameters, when the message is sent from the organisation's legitimate domain, and when security controls such as WAF URL filtering can be bypassed through parser inconsistencies.

The research started from a simple question: what happens if a supposedly transactional email endpoint is called directly, without going through the normal application workflow? That question led to a chain of weaknesses allowing an unauthenticated request to trigger a legitimate, sender-authenticated email containing attacker-controlled content and a deceptive external URL.

From the original on medium.com

Setup

The report does not describe any accounts, roles, tooling versions or special preconditions. The testing was done against the application's API surface. and the only infrastructure mentioned for validation is a mailbox controlled by the tester, used to receive the generated messages.

Finding it

While testing the application's API surface, the researcher identified the trade-in confirmation endpoint. At first glance it looked like a normal transactional API. Transactional endpoints deserve special attention because they frequently contain parameters such as:

JSON
{  "memberEmail": "...",  "memberName": "...",  "orderId": "...",  "items": [...]}

Whenever an endpoint accepts a recipient address directly from the client, the first question to ask is what prevents an unauthenticated user from turning it into an email-sending primitive.

Exploitation

Step 1: Test authentication before testing payloads

Rather than immediately attempting injection, the researcher first removed all authentication material from the request. The request contained:

HTTP
POST /used/emails/v1/confirmation HTTP/2Host: www.rei.comContent-Type: application/json

The server responded with a successful queue response:

HTTP
202 Accepted

with a response indicating that the email had been queued. There were no cookies, no Authorization header, no authenticated session and no CSRF token. This established the first important property: the email-generation functionality was reachable without authentication.

The general habit worth taking from this: when discovering an API endpoint, do not assume the authentication requirements enforced by the normal frontend workflow are also enforced by the backend API. Always test the endpoint directly.

Step 2: Determine which parameters are trusted

The next step was identifying which fields actually influenced the resulting email. The request contained fields representing things such as:

JSON
{  "orderId": "...",  "memberEmail": "...",  "memberName": "...",  "memberId": "...",  "store": "...",  "items": [    {      "itemId": "...",      "description": "...",      "tradeInPrice": 99999.00,      "quantity": 1,      "conditionGrade": "EXCELLENT"    }  ]}

The values were changed individually and the resulting email observed. The methodology matters: do not modify everything simultaneously. Instead:

  1. Change recipient.
  2. Change order identifier.
  3. Change display name.
  4. Change item description.
  5. Change price.
  6. Observe which values reach the email.

This creates a simple input to processing to output map. In this case, several client-controlled values were reflected into the resulting transactional email.

Step 3: Confirm the recipient is client controlled

The most important discovery was that the recipient was supplied directly through:

JSON
"memberEmail": "[redacted]"

No authenticated account was required to specify the recipient. The server accepted the request and queued the email, and the message subsequently arrived in a mailbox controlled by the tester. This transformed the endpoint from merely an unauthenticated email endpoint into an unauthenticated arbitrary-recipient transactional email sender.

That distinction matters when assessing impact. The server is not merely returning attacker-controlled text; it is causing the organisation's infrastructure to perform an external action:

Text
Attacker   |   | unauthenticated HTTP request   vREI API   |   | queues email   vREI mail infrastructure   |   | legitimate sender identity   vAttacker-selected recipient

Step 4: Check how the receiving mail server authenticates the message

The next thing checked was not just whether the email arrived, but how the receiving mail server authenticated it. The message came from the legitimate REI transactional sender:

Text
[redacted]

The received message also passed the relevant sender-authentication checks, including:

Text
DKIM: PASSSPF: PASS

This significantly changes the security implications. An attacker is not simply sending from [redacted]; the attacker is causing the organisation's own infrastructure to generate the message:

Text
Attacker   ↓Unauthenticated API   ↓REI email infrastructure   ↓DKIM/SPF authenticated message   ↓Victim mailbox

This creates a trusted-channel abuse primitive. The attacker does not need to spoof REI's domain, because REI's infrastructure sends the message legitimately.

Step 5: Establish attacker-controlled content

The next question was how much control the attacker has over the email. The item description was reflected into the email body. For example, a controlled value such as:

Text
TEST-CONTROLLED-DESCRIPTION

appeared in the resulting message. The trade-in amount was also influenced by the request:

JSON
"tradeInPrice": 99999.00

which resulted in a corresponding amount being rendered in the email. This provides a social-engineering primitive: an attacker can construct a message that looks like a legitimate transactional notification while controlling elements such as the recipient, item description, order number, payout amount and other transaction-related values. At this stage the finding was already more interesting than a generic spam issue because the message had the organisation's legitimate sender identity.

Step 6: Investigate the existing WAF control

During testing, direct URL payloads were being filtered. Attempting to place a normal external URL inside the controlled description triggered the application's edge security controls. This suggested that REI had an existing defence intended to prevent malicious URLs from reaching the email template.

Rather than stopping there, the researcher asked where the URL filtering was happening and whether it parses the request the same way the application does. This is where understanding parser differentials becomes useful.

Step 7: Exploit the parser differential between WAF and application

The HTTP request passes through multiple processing layers. A simplified model looks like:

Text
Raw HTTP body      |      v   WAF      |      vJSON parser      |      vApplication      |      vEmail template      |      vMail client

The critical question is whether every layer interprets the JSON identically. A JSON string can represent characters using Unicode escapes. For example:

can be represented as:

Text
\u002e

Similarly, other URL characters can be represented using their Unicode escape sequences. If the WAF examines the raw request body, it may see:

Text
\u002e

while the JSON parser later transforms it into:

So the WAF view is \u002e and the application view is .. The two components are effectively processing different representations of the same logical input. This is a classic parser differential.

The same conceptual problem can appear anywhere there is a processing chain:

Text
Proxy → WAF → API Gateway → JSON Parser → Application

or:

Text
WAF → XML Parser → Backend

or:

Text
Firewall → URL Parser → Redirect Handler

Whenever security validation happens before normalisation, the question to ask is whether the security layer validates the same representation that the application eventually consumes. If the answer is no, an attacker may be able to construct two representations:

Text
Representation A    ↓Security control    ↓Allowed
Text
Representation B    ↓Application parser    ↓Dangerous value

That is the fundamental idea behind many parser-differential vulnerabilities.

Step 8: Validate the URL filtering bypass

Using JSON Unicode escaping, the URL characters could be represented in encoded form. The edge security layer therefore did not recognise the same URL representation that the application ultimately reconstructed. After JSON parsing, the backend received the normal URL characters, and the resulting email contained the reconstructed URL. The important observation was:

Text
Raw request    ↓Encoded characters    ↓WAF does not identify URL    ↓JSON parser decodes value    ↓Application receives URL    ↓Email template renders URL

This demonstrated that the URL filtering control was occurring at the wrong normalisation stage.

Step 9: Use the user@host URL trick for a deceptive link

The next part was understanding how a deceptive URL could be presented. A URL such as:

Text
https://[redacted]/account

does not mean that the request is going to www.rei.com. The actual hostname is attacker-domain.example, while www.rei.com is the URL's user-information component:

Text
https://USERINFO@HOST/PATH        |       |        |       +        |        +

Therefore the URL visually contains www.rei.com but resolves to attacker-domain.example. This is a useful phishing-awareness concept for security researchers to understand.

Step 10: End-to-end validation

At this point each component had been independently validated:

  • Component 1, authentication: no authentication required.
  • Component 2, recipient control: memberEmail leads to an attacker-selected recipient.
  • Component 3, content control: description leads to attacker-controlled email content, tradeInPrice to an attacker-controlled displayed amount, and orderId to an attacker-controlled transaction identifier.
  • Component 4, trusted sender: [redacted] with DKIM: PASS and SPF: PASS.
  • Component 5, WAF bypass: Unicode-escaped URL passes WAF inspection, is allowed, is decoded by the JSON parser, the URL is reconstructed and the email is delivered.
  • Component 6, phishing primitive: an authenticated REI email plus attacker-controlled content plus an attacker-controlled external URL.

The complete attack chain therefore became:

Text
Unauthenticated attacker        |        vPOST /used/emails/v1/confirmation        |        +---- arbitrary recipient        |        +---- arbitrary transaction data        |        +---- encoded malicious URL        |        vAkamai WAF        |        | URL not recognized        vJSON parser        |        | Unicode escapes decoded        vEmail service        |        | legitimate REI sender        vVictim mailbox        |        vTrusted-looking phishing message

Root cause

The individual weaknesses are relatively straightforward: missing authentication, a client-controlled recipient, client-controlled transactional data, insufficient output validation and a parser differential. The security impact comes from combining them. A weakness that only allowed attacker-controlled text would have limited impact, and a weakness that only allowed unauthenticated email triggering would also need careful contextual assessment. Together, unauthenticated access, an arbitrary recipient, a trusted organisational sender, attacker-controlled content and a clickable external URL create a substantially different capability.

The boundary crossed here is the organisation's trusted email infrastructure, reached from an internet attacker and delivering to an arbitrary external mailbox. The WAF did not stop it because the filtering happened at the wrong normalisation stage: the edge inspected the raw request body while the JSON parser later decoded Unicode escapes into the characters the application consumed. The report does not describe the application code itself, so the precise implementation mistake is not stated.

Impact

An unauthenticated attacker could cause REI's own mail infrastructure to send a message to an arbitrary recipient, from the legitimate transactional sender [redacted], passing DKIM and SPF. The attacker controls the recipient, the item description, the order number, the payout amount and other transaction-related values, and can include a clickable external URL that survives the WAF through Unicode escaping. The result is a trusted-looking phishing message delivered through a trusted channel. The report does not quantify how many messages could be sent or describe any rate limiting.

Fix

The strongest fix is not simply adding another WAF rule; the application should enforce authorisation at the endpoint itself. The report recommends:

  1. Authenticate the endpoint: require an authenticated user or session before allowing a trade-in confirmation to be generated.
  2. Authorise the transaction: do not trust "memberEmail": "..." from the client; derive the recipient from the authenticated account and the server-side transaction record.
  3. Validate transaction ownership: the supplied order or trade-in identifier should correspond to a transaction owned by the authenticated user.
  4. Normalise before security inspection: if WAF filtering is retained, the security layer should inspect a canonical representation, and the application and security layer must agree about the meaning of the request.
  5. Encode email output: every user-controlled value rendered into an email should be safely encoded according to the output context.
  6. Avoid trusting WAF filtering for application security: a WAF rule should be defence in depth and should not replace authentication, authorisation, input validation and output encoding.
  7. Add abuse monitoring: watch for many recipients, many different email addresses, unusual transaction values, repeated requests without authenticated sessions and large volumes from a single source.

Variants to test

The report closes with a reusable workflow for testing transactional email functionality on other targets:

  1. Find email-related endpoints. Search API traffic for keywords such as email, mail, notification, confirmation, verify, invite, receipt, reset, trade, order, shipment, and inspect paths such as POST /.../confirmation, POST /.../notification and POST /.../send.
  2. Remove authentication. Replay the request with Cookie: removed, Authorization: removed and CSRF token: removed, then determine whether the server still performs the action.
  3. Identify the recipient parameter. Look for email, recipient, to, memberEmail, customerEmail and address, and determine whether the backend takes the recipient from the authenticated session or from a client-supplied parameter.
  4. Map reflected fields. Change one parameter at a time among orderId, memberName, description, price, store and itemId, then inspect the delivered email and build an input/output map.
  5. Inspect email authentication. Do not stop after confirming delivery; inspect From, Return-Path, DKIM, SPF, DMARC and Message-ID.
  6. Test content controls. If URLs or HTML are blocked, determine where the filtering is performed, what representation it inspects and what representation the application consumes.
  7. Test normalisation boundaries. For structured formats, investigate whether security controls normalise before inspection, including JSON Unicode escapes, URL encoding, double URL encoding, HTML entities, case normalisation, path normalisation and Unicode normalisation.
  8. Validate safely. Use infrastructure you control: a test mailbox, a controlled email, then inspect headers, inspect the body and verify rendering. Avoid sending test messages to unrelated users.

The broader lesson is to follow the data all the way from attacker input to the final security boundary, and to model the complete pipeline: client, CDN, WAF, load balancer, API gateway, parser, application, template engine, email provider and mail client. Every transition is a potential interpretation boundary.

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. 28 min read.

What happened, in plain words

A security researcher found a way to make REI, a large outdoor-gear retailer, send real emails to any address a stranger chose, with text and links that stranger also chose. The emails came from REI's own mail system, so they passed the checks that mail providers use to decide whether a message is genuine. That means a criminal could use REI's good name to deliver a convincing phishing email: a message that looks like a real REI notification but carries an attacker-chosen link.

The researcher did not break into anything. They found an API endpoint used to send trade-in confirmation emails, and discovered that it would do its job for anyone who asked, with no login required. They then found that the text of the email could be shaped by the person making the request, and that a security filter meant to block links could be slipped past by writing the link in a slightly different way.

This article walks through the whole investigation from the beginning, explaining each idea as it appears. It is written for someone who uses a browser and a computer but has never studied security.

Some background before we start

A few everyday ideas come up constantly below, so here they are first.

A website is really two things. There is the part you see in the browser, with buttons and pages, and there is a part behind the scenes that stores data and does work. The behind-the-scenes part is often called the backend or the server. When you click a button, your browser sends a short message to the server and the server replies.

An API is a doorway for those messages. Think of a restaurant. The dining room is the website you see; the kitchen is the server. The API is the serving hatch where waiters pass orders to the kitchen. The kitchen does not care whether the person at the hatch is a customer, a waiter or someone who wandered in through the back door. It just cooks whatever order is handed through. That is exactly the weakness in this story: the hatch was open to the street.

A request is one of those messages. It has a method (a verb such as POST, meaning "please create or send something"), a path (which part of the system you are talking to), headers (small labels with extra details) and often a body (the actual data).

JSON is a common way of writing data in a request body. It looks like a shopping list with labels:

Curly braces hold a group, each entry has a label in quotes, a colon, then a value. Square brackets hold a list.

A cookie is a small note your browser keeps and shows to a website on every visit, so the site remembers who you are. A login session usually depends on a cookie. An Authorization header is a different way of proving who you are, a line in the request carrying a pass. A CSRF token is a secret value a website puts in a form to prove the request really came from its own pages and not from a malicious site. All three are forms of proof of identity. Removing all three is like walking into the kitchen with no uniform and no badge.

A transactional email is an automatic message triggered by an action, such as "your order shipped" or "your password was reset". It is not a newsletter; it is a receipt-style note tied to one event.

A trade-in is when a customer sends old gear back to the shop in exchange for credit or money. REI has a trade-in programme, and this feature sends the confirmation email for it.

A WAF (web application firewall) is a security guard standing at the door of a website. It reads incoming requests and blocks ones that look dangerous, for example requests containing suspicious web links. It is a filter, not a lock.

Phishing is a con where an attacker sends a message that looks like it comes from a trusted company, hoping the reader clicks a link and types a password into a fake page.

DKIM and SPF are two checks that receiving mail servers run to decide whether an email genuinely came from the domain it claims. DKIM is a cryptographic signature attached to the message; SPF checks that the sending mail server is allowed to send for that domain. When both say PASS, the message is treated as genuine.

A parser is a program that reads a piece of text and works out what it means. Different parsers can read the same text differently, and that gap is the heart of the second half of this story.

From the original on medium.com

1. Starting with the email feature

While exploring the application's API, the researcher found an endpoint for trade-in confirmations:

HTTP
POST /used/emails/v1/confirmation

Line by line:

  • POST is the verb. It means "create or send something".
  • /used/emails/v1/confirmation is the path, like a street address inside the site. used suggests the used-gear side of the business, emails says this is about email, v1 is a version number, and confirmation says it sends a confirmation.

At first glance this looked like an ordinary transactional API. But transactional endpoints deserve extra attention, because they often carry parameters like these:

JSON
{  "memberEmail": "...",  "memberName": "...",  "orderId": "...",  "items": [...]}

Line by line:

  • The outer curly braces group the whole order.
  • "memberEmail" is the address the email should go to.
  • "memberName" is the name to show in the message.
  • "orderId" is the identifier of the trade-in.
  • "items" is a list (the square brackets) of the things being traded in. The ... means "some content goes here".

Why this matters: whenever a web endpoint lets the person making the request type in the recipient's email address, the natural question is what stops a stranger from using it as a free email-sending machine. That question is the seed of the whole investigation.

2. Testing login before testing tricks

A tempting first move would be to start injecting strange values. The researcher did the opposite: first, remove every piece of proof of identity and see whether the endpoint still works.

The request was:

HTTP
POST /used/emails/v1/confirmation HTTP/2Host: www.rei.comContent-Type: application/json

Line by line:

  • POST /used/emails/v1/confirmation is the same verb and path as before.
  • HTTP/2 is the version of the web protocol being spoken. It is just the language version, like saying "English" rather than "French".
  • Host: www.rei.com tells the server which website name the request is for. One server can host many sites, so it needs to know which one you mean.
  • Content-Type: application/json tells the server that the body is written in JSON, so it knows how to read it.

The body sent was:

That is an empty JSON object: a pair of curly braces with nothing inside. It is the smallest possible request body, sent deliberately to see what the server does with almost no information.

The server replied:

HTTP
202 Accepted

Line by line:

  • 202 is a status code, a number the server sends back to say how things went. 200 means "here is your page", 404 means "not found", and 202 means "I have accepted your request and will deal with it later".
  • Accepted is just the human-readable name for that number.

The response also said the email had been queued, meaning placed in a line waiting to be sent.

Crucially, the request contained no cookie, no Authorization header, no logged-in session and no CSRF token. In everyday terms: no badge, no password, no proof of identity at all, and the kitchen still cooked the order.

That established the first property of the finding: the email-sending feature could be reached without logging in.

The wider habit here is worth remembering. A website's visible pages might force you to log in before you can click a button, but the API behind that button may not check anything at all. The front door has a lock; the serving hatch does not. So always test the endpoint directly.

3. Working out which fields the email actually uses

The next question was which of the fields in the request actually end up in the email. The request carried fields like these:

JSON
{  "orderId": "...",  "memberEmail": "...",  "memberName": "...",  "memberId": "...",  "store": "...",  "items": [    {      "itemId": "...",      "description": "...",      "tradeInPrice": 99999.00,      "quantity": 1,      "conditionGrade": "EXCELLENT"    }  ]}

Line by line:

  • "orderId" identifies the trade-in order.
  • "memberEmail" is the recipient address.
  • "memberName" is the customer's display name.
  • "memberId" is the customer's account number.
  • "store" is the shop involved.
  • "items" is a list of the traded-in products. Each product is its own group of curly braces inside the square brackets.
  • "itemId" identifies the product.
  • "description" is the product's text description.
  • "tradeInPrice" is the amount offered, here 99999.00.
  • "quantity" is how many, here 1.
  • "conditionGrade" is the condition, here "EXCELLENT".

The researcher changed these values one at a time and looked at the email that arrived. The method matters: change one thing, look, change the next. If you change everything at once and the email looks different, you have no idea which change caused it. It is like seasoning a soup: add one ingredient, taste, then add the next.

The steps were:

  1. Change the recipient.
  2. Change the order identifier.
  3. Change the display name.
  4. Change the item description.
  5. Change the price.
  6. Observe which values reach the email.

The result is a simple map from input to processing to output: which field you type in, and where it shows up in the finished message. In this case, several values that the requester controls were reflected into the email.

4. The recipient was chosen by the requester

The most important discovery was that the recipient came straight from this field:

JSON
"memberEmail": "[redacted]"

Line by line:

  • "memberEmail" is the label for the recipient address.
  • "[redacted]" is a placeholder address standing for any mailbox the requester wants. example.com is a reserved domain used in documentation precisely so nobody's real inbox is involved.

No logged-in account was needed to say where the email should go. The server accepted the request, queued the email, and the message arrived in a mailbox the tester controlled.

That changed the endpoint from "an email endpoint that does not require login" into "an email sender that does not require login and will send to any address". The difference matters when judging harm. The server is not merely echoing text back to the person who sent it. It is making the company's own machinery perform an action in the outside world:

Text
Attacker   |   | unauthenticated HTTP request   vREI API   |   | queues email   vREI mail infrastructure   |   | legitimate sender identity   vAttacker-selected recipient

Reading the diagram from top to bottom:

  • Attacker is the person sending the request.
  • The arrow labelled unauthenticated HTTP request means the request carries no proof of identity.
  • REI API is the endpoint receiving it.
  • queues email means the API places a message in the sending line.
  • REI mail infrastructure is the company's own mail system.
  • legitimate sender identity means the message goes out as REI, not as the attacker.
  • Attacker-selected recipient is the inbox the attacker chose.

5. Why it matters that the sender is genuine

The researcher then checked not only whether the email arrived, but how the receiving mail server judged its authenticity. The message came from REI's real transactional sender:

Text
[redacted]

Line by line:

  • rei is the local part, the name before the @.
  • alerts.rei.com is the domain, a subdomain of rei.com used for notifications.

The message also passed the sender-authentication checks:

Line by line:

  • DKIM: PASS means the cryptographic signature on the message checked out, so the message was not altered in transit and really was signed by the domain.
  • SPF: PASS means the server that sent it is on the list of servers allowed to send mail for that domain.

This changes the picture a lot. An attacker is not sending from [redacted] and hoping nobody looks. The attacker is making the company's own systems produce the message:

Text
Attacker   ↓Unauthenticated API   ↓REI email infrastructure   ↓DKIM/SPF authenticated message   ↓Victim mailbox

Reading it as a chain:

  • Attacker starts the process.
  • Unauthenticated API is the endpoint that asks for no login.
  • REI email infrastructure is the company's mail system doing the sending.
  • DKIM/SPF authenticated message means the result passes the genuineness checks.
  • Victim mailbox is where it lands.

The report calls this a trusted-channel abuse primitive. In plain words: the attacker borrows a channel that people already trust, instead of faking it. No spoofing of REI's domain is needed, because REI's own infrastructure sends the message legitimately.

6. Proving the attacker controls the content

The next question was how much of the email's text the attacker can shape. The item description was reflected into the email body. A test value such as:

Text
TEST-CONTROLLED-DESCRIPTION

appeared in the message that arrived. Line by line, that is simply a made-up label the researcher typed into the description field to see whether it would show up. It did.

The trade-in amount was also taken from the request:

JSON
"tradeInPrice": 99999.00

Line by line:

  • "tradeInPrice" is the label for the payout amount.
  • 99999.00 is the value.

That amount was rendered in the message. This gives an attacker a social-engineering toolkit: they can build a message that looks exactly like a real transactional notification while choosing the recipient, the item description, the order number, the payout amount and other transaction details. Even at this stage the finding was more serious than ordinary spam, because the message carried the company's genuine sender identity.

7. Finding the existing link filter

During testing, the researcher noticed that plain web links were being blocked. Putting an ordinary external URL into the description field triggered the site's edge security controls. In plain terms, the guard at the door recognised a link and refused it. This suggested REI already had a defence meant to stop malicious links reaching the email template.

Rather than stopping there, the researcher asked two sharper questions: where exactly is the link filtering happening, and does that filter read the request the same way the application does? That second question is where the idea of a parser differential comes in.

8. Two readers, one piece of text

A request passes through several layers before it becomes an email. A simplified picture:

Text
Raw HTTP body      |      v   WAF      |      vJSON parser      |      vApplication      |      vEmail template      |      vMail client

Reading from top to bottom:

  • Raw HTTP body is the request exactly as it arrives, character for character.
  • WAF is the security guard that inspects it.
  • JSON parser is the component that turns the JSON text into usable data.
  • Application is the site's own code.
  • Email template is the mould that shapes the final message.
  • Mail client is the program the recipient uses to read it.

The critical question is whether every layer reads the JSON the same way. JSON has a feature called a Unicode escape: a character can be written as a code rather than as itself. A full stop, for example:

can be written as:

Text
\u002e

Line by line:

  • . is an ordinary full stop.
  • \u002e is the same full stop written as a four-digit code. The \u says "a Unicode character follows" and 002e is the number for a full stop.

Other characters in a web address can be written the same way. So if the WAF looks at the raw request body, it may see:

Text
\u002e

while the JSON parser later turns that into:

In other words, the WAF's view is \u002e and the application's view is .. The two components are processing different spellings of the same logical input. That is a classic parser differential: two readers disagreeing about what a piece of text means.

9. Why this gap matters beyond email

The same problem can appear anywhere a request passes through a chain of components:

Text
Proxy → WAF → API Gateway → JSON Parser → Application

or:

Text
WAF → XML Parser → Backend

or:

Text
Firewall → URL Parser → Redirect Handler

Line by line for the first chain:

  • Proxy is an intermediary that forwards traffic.
  • WAF is the security guard.
  • API Gateway is a front desk that routes requests to the right service.
  • JSON Parser turns the text into data.
  • Application is the code that acts on it.

The other two chains follow the same shape with different components: an XML parser reads a different data format, a backend is the server-side code, a firewall filters traffic, a URL parser reads web addresses, and a redirect handler sends the browser elsewhere.

Whenever security checking happens before the text is normalised, meaning before it is converted into its standard form, the question to ask is whether the guard checks the same spelling that the application eventually uses. If not, an attacker may be able to build two spellings of one input:

Text
Representation A    ↓Security control    ↓Allowed
Text
Representation B    ↓Application parser    ↓Dangerous value

Line by line:

  • Representation A is the harmless-looking spelling shown to the guard, which lets it through.
  • Representation B is the spelling the application actually ends up with, which is the dangerous one.

That is the basic idea behind many parser-differential vulnerabilities.

10. Confirming the link filter can be bypassed

Using JSON Unicode escaping, the characters of a web address could be written in encoded form. The edge security layer therefore did not recognise the same address that the application later rebuilt. After JSON parsing, the backend received the ordinary characters, and the resulting email contained the rebuilt link. The key observation:

Text
Raw request    ↓Encoded characters    ↓WAF does not identify URL    ↓JSON parser decodes value    ↓Application receives URL    ↓Email template renders URL

Reading the chain:

  • Raw request is what arrives at the door.
  • Encoded characters means the link is written in code form.
  • WAF does not identify URL means the guard does not see a link at all.
  • JSON parser decodes value means the parser turns the code back into ordinary characters.
  • Application receives URL means the site's code now holds a real link.
  • Email template renders URL means the link is placed into the email.

This showed that the link filtering was happening at the wrong stage: it inspected the text before it was converted into its final form, while the application used the text after conversion.

11. The user@host trick for a misleading link

The next piece was how to present a link that looks trustworthy but goes elsewhere. A web address such as:

Text
https://[redacted]/account

does not send the visitor to www.rei.com. The real destination is attacker-domain.example, while www.rei.com is the address's user-information part. The structure is:

Text
https://USERINFO@HOST/PATH        |       |        |       +        |        +

Line by line:

  • https:// is the protocol, the language browsers use for secure web pages.
  • USERINFO is an optional username section, placed before an @ sign.
  • @ separates the user information from the real host.
  • HOST is the actual machine being visited.
  • /PATH is the page on that machine.

So the address visually contains www.rei.com but actually resolves to attacker-domain.example. This is a useful phishing-awareness point: the part before the @ is not the destination. It is like writing "Bank of Trust" on an envelope that is actually addressed to a stranger's house.

12. Checking every piece end to end

By this point each component had been confirmed separately.

Component 1, authentication:

Text
No authentication required

Meaning: the endpoint works without any login.

Component 2, recipient control:

Text
memberEmail → attacker-selected recipient

Meaning: the memberEmail field decides where the email goes, and the requester fills it in.

Component 3, content control:

Text
description → attacker-controlled email contenttradeInPrice → attacker-controlled displayed amountorderId → attacker-controlled transaction identifier

Meaning: the description becomes the email text, the price becomes the amount shown, and the order number becomes the reference shown. All three come from the requester.

Component 4, trusted sender:

Meaning: the message is sent by REI's real mail system and passes both genuineness checks.

Component 5, WAF bypass:

Text
Unicode-escaped URL        ↓WAF inspection        ↓Allowed        ↓JSON decoding        ↓URL reconstructed        ↓Email delivered

Meaning: the link is written in code form, the guard lets it through, the parser turns it back into a link, and the email goes out with it.

Component 6, phishing primitive:

Text
Authenticated REI email        +Attacker-controlled content        +Attacker-controlled external URL

Meaning: a genuine REI email, with text and a link chosen by the attacker. A primitive here just means a basic building block that can be used to do something bigger.

The complete chain:

Text
Unauthenticated attacker        |        vPOST /used/emails/v1/confirmation        |        +---- arbitrary recipient        |        +---- arbitrary transaction data        |        +---- encoded malicious URL        |        vAkamai WAF        |        | URL not recognized        vJSON parser        |        | Unicode escapes decoded        vEmail service        |        | legitimate REI sender        vVictim mailbox        |        vTrusted-looking phishing message

Reading it from top to bottom:

  • Unauthenticated attacker is someone with no account.
  • They send POST /used/emails/v1/confirmation, the endpoint from step 1.
  • arbitrary recipient means any inbox they like.
  • arbitrary transaction data means any order details they like.
  • encoded malicious URL means a harmful link written in code form.
  • Akamai WAF is the security guard, named in the diagram as Akamai.
  • URL not recognized means the guard does not spot the link.
  • JSON parser turns the code back into a link.
  • Unicode escapes decoded is that conversion happening.
  • Email service sends the message.
  • legitimate REI sender means it comes from REI's real address.
  • Victim mailbox is where it lands.
  • Trusted-looking phishing message is the final result.

13. Why the combination is the real finding

The individual weaknesses are simple on their own: no login check, a recipient chosen by the requester, transaction details chosen by the requester, weak checking of what goes into the email, and a parser differential. The harm comes from putting them together.

A weakness that only let someone put their own text into an email would be limited. A weakness that only let someone trigger an email without logging in would need careful thought about how bad it really is. But together:

Text
Unauthenticated        +Arbitrary recipient        +Trusted organizational sender        +Attacker-controlled content        +Clickable external URL

Line by line:

  • Unauthenticated means no login needed.
  • Arbitrary recipient means any inbox.
  • Trusted organizational sender means the company's own genuine address.
  • Attacker-controlled content means the attacker writes the message.
  • Clickable external URL means a link the reader can click, going where the attacker wants.

That is a very different capability from any one of those alone. This is why a bug hunter should not judge a weakness only by what one endpoint does in isolation. The better question is: what security boundary does this endpoint cross? Here the boundary was:

Text
Internet attacker       ↓REI's trusted email infrastructure       ↓arbitrary external mailbox

Meaning: someone on the internet reaches into the company's trusted mail system and uses it to deliver to any outside inbox.

14. A repeatable way to test email features

This finding suggests a workflow anyone can follow when testing transactional email features.

Step 1: Find email-related endpoints

Search the traffic for words such as:

Text
emailmailnotificationconfirmationverifyinvitereceiptresettradeordershipment

These are search keywords: email, mail, notification, confirmation, verify, invite, receipt, reset, trade, order, shipment. Also look at paths such as:

Text
POST /.../confirmationPOST /.../notificationPOST /.../send

Line by line:

  • POST /.../confirmation is a path ending in confirmation, with ... standing for whatever comes before.
  • POST /.../notification is one ending in notification.
  • POST /.../send is one ending in send.

Step 2: Remove authentication

Replay the request with:

Text
Cookie: removedAuthorization: removedCSRF token: removed

Line by line:

  • Cookie: removed means the cookie line is taken out.
  • Authorization: removed means the identity header is taken out.
  • CSRF token: removed means the anti-forgery token is taken out.

Then see whether the server still does the action. If it does, the endpoint does not check who is asking.

Step 3: Find the recipient parameter

Look for fields named:

Text
emailrecipienttomemberEmailcustomerEmailaddress

That is: email, recipient, to, memberEmail, customerEmail, address. Then work out whether the server takes the recipient from the logged-in session or from a value the requester supplies. The second case deserves close attention.

Step 4: Map which fields show up in the email

Change one field at a time:

Text
orderIdmemberNamedescriptionpricestoreitemId

That is: orderId, memberName, description, price, store, itemId. Then read the delivered email and build a table:

Request field Email output
memberEmail Recipient
orderId Order identifier
description Item description
tradeInPrice Displayed amount

This makes the impact easy to show to the people who have to fix it.

Step 5: Check how the email is authenticated

Do not stop once the email arrives. Look at:

Text
FromReturn-PathDKIMSPFDMARCMessage-ID

Line by line:

  • From is the address shown to the reader.
  • Return-Path is where bounces go.
  • DKIM is the signature check.
  • SPF is the allowed-sender check.
  • DMARC is a policy that ties SPF and DKIM together and tells receivers what to do when they fail.
  • Message-ID is a unique identifier for the message.

A message produced by the company's real mail system is a very different matter from an ordinary faked email.

Step 6: Test what content is allowed

If links or HTML are blocked, work out:

Text
Where is the filtering performed?What representation does it inspect?What representation does the application consume?

Line by line:

  • Where is the filtering performed? asks which component does the blocking.
  • What representation does it inspect? asks which spelling of the text it reads.
  • What representation does the application consume? asks which spelling the application ends up using.

This is where parser-differential testing pays off.

Step 7: Test the boundaries where text is converted

For structured formats, check whether the security controls convert text to its standard form before inspecting it. Things worth understanding:

Text
JSON Unicode escapesURL encodingdouble URL encodingHTML entitiescase normalizationpath normalizationUnicode normalization

Line by line:

  • JSON Unicode escapes are characters written as codes, like \u002e.
  • URL encoding writes characters as percent codes, like %2e.
  • double URL encoding encodes an already encoded value, so it is decoded twice.
  • HTML entities write characters as names or numbers, like &.
  • case normalization makes upper and lower case consistent.
  • path normalization tidies up a web path, resolving .. and similar.
  • Unicode normalization makes different ways of writing the same character consistent.

The goal is not simply to slip past the WAF. The deeper question is whether the guard and the backend can disagree about what the input means.

Step 8: Test safely

For email issues, use infrastructure you control. A safe workflow:

Text
Test mailbox      ↓Controlled email      ↓Inspect headers      ↓Inspect body      ↓Verify rendering

Line by line:

  • Test mailbox is an inbox you own.
  • Controlled email is a message you generated yourself.
  • Inspect headers means reading the hidden delivery details.
  • Inspect body means reading the visible content.
  • Verify rendering means checking how it actually displays.

Never send test messages to people who did not agree to receive them.

15. Lessons worth keeping

Lesson 1: Do not trust the front-end workflow

The visible website may demand a login even when the API behind it does not. Test the API directly.

Lesson 2: Email endpoints deserve special attention

An endpoint that can send email crosses a boundary. Ask:

Text
Who can call it?Who chooses the recipient?Who chooses the content?Which domain sends the message?

Line by line:

  • Who can call it? asks whether a login is needed.
  • Who chooses the recipient? asks who picks the inbox.
  • Who chooses the content? asks who writes the message.
  • Which domain sends the message? asks whose name appears as the sender.

Lesson 3: A good sender reputation makes the impact worse

The difference between:

Text
[redacted]

and:

Text
[redacted]

is large. [redacted] is an unknown sender; [redacted] is a sender people already trust. A genuine transactional sender inherits that trust.

Lesson 4: A WAF is not application security

A WAF is an extra layer, not the main way to check data. The application itself should still:

  • authenticate the caller, meaning check who is asking;
  • authorise the action, meaning check whether they are allowed;
  • validate inputs, meaning check the data makes sense;
  • normalise data, meaning convert it to a standard form;
  • safely encode output, meaning make sure text cannot be misread as code when displayed.

Lesson 5: Think in pipelines

Model the whole path a request takes:

Text
Client ↓CDN ↓WAF ↓Load balancer ↓API gateway ↓Parser ↓Application ↓Template engine ↓Email provider ↓Mail client

Line by line:

  • Client is the browser or tool making the request.
  • CDN is a content delivery network, a network of servers that serves content close to users.
  • WAF is the security guard.
  • Load balancer spreads traffic across several servers.
  • API gateway routes requests to the right service.
  • Parser turns text into data.
  • Application is the site's code.
  • Template engine fills in the email template.
  • Email provider sends the message.
  • Mail client is where the recipient reads it.

Every handover is a place where two components might read the same text differently.

Lesson 6: Chain weaknesses carefully

A strong report does not just say "I bypassed the WAF". It explains the chain:

Text
Missing authentication        ↓arbitrary email generation        ↓attacker-controlled content        ↓trusted sender        ↓parser differential        ↓URL reaches email        ↓phishing delivery primitive

Line by line:

  • Missing authentication is the starting weakness.
  • arbitrary email generation is what it allows.
  • attacker-controlled content is what goes into the message.
  • trusted sender is why the message looks genuine.
  • parser differential is how the link filter is slipped past.
  • URL reaches email is the link arriving in the inbox.
  • phishing delivery primitive is the final capability.

The chain shows the security team why the fixes have to be made together.

16. How to fix it

The strongest fix is not another WAF rule. The application should check permissions at the endpoint itself.

  1. Require a login. The endpoint should demand a logged-in user or session before generating a trade-in confirmation.
  2. Check the transaction belongs to that user. Do not trust "memberEmail": "..." from the requester. Take the recipient from the logged-in account and the server-side record of the transaction.
  3. Check ownership of the order. The order or trade-in number supplied should match a transaction owned by the logged-in user.
  4. Convert to a standard form before checking. If WAF filtering stays, the guard should inspect the standard form, and the guard and the application must agree on what the request means.
  5. Encode the email output. Every value the user controls that goes into an email should be safely encoded for the place it appears.
  6. Do not rely on the WAF for application security. A WAF rule is defence in depth, an extra layer behind the main defences. It should not replace:
Text
authenticationauthorizationinput validationoutput encoding

Line by line:

  • authentication checks who is asking.
  • authorization checks whether they are allowed.
  • input validation checks the data is sensible.
  • output encoding makes sure text cannot be misread as code when displayed.
  1. Watch for abuse. Monitor for patterns such as:
Text
many recipientsmany different email addressesunusual transaction valuesrepeated requests without authenticated sessionslarge volumes from a single source

Line by line:

  • many recipients means one request or account reaching lots of inboxes.
  • many different email addresses means a wide spread of destinations.
  • unusual transaction values means odd amounts or order numbers.
  • repeated requests without authenticated sessions means traffic from people who never logged in.
  • large volumes from a single source means a flood from one place.

The report does not say which of these fixes were actually applied.

Conclusion

The most valuable lesson here is not a particular payload. It is the method. A plain-looking transactional endpoint became far more interesting after a sequence of questions:

Text
Is authentication required?        ↓Who controls the recipient?        ↓Who controls the email content?        ↓Which infrastructure sends the message?        ↓Does the message pass sender authentication?        ↓Are URLs filtered?        ↓Where does filtering occur?        ↓Does the WAF parse data the same way as the application?        ↓What happens after the parser transforms the input?

Line by line:

  • Is authentication required? asks whether a login is needed.
  • Who controls the recipient? asks who picks the inbox.
  • Who controls the email content? asks who writes the message.
  • Which infrastructure sends the message? asks whose systems do the sending.
  • Does the message pass sender authentication? asks whether DKIM and SPF pass.
  • Are URLs filtered? asks whether links are blocked.
  • Where does filtering occur? asks which component does the blocking.
  • Does the WAF parse data the same way as the application? asks whether the guard and the app read the text identically.
  • What happens after the parser transforms the input? asks what the text becomes once it is decoded.

That mindset turned a basic API observation into a full analysis of a security chain. For anyone hunting bugs, the pattern to remember is: do not stop when an endpoint behaves unexpectedly. Follow the data all the way from what the attacker types to the final boundary it crosses. Here, that boundary was the company's own trusted email system. The combination of open access, a recipient chosen by the requester, content chosen by the requester, a genuine sender and a parser-differential bypass is what made the story serious.

Glossary

  • API: a doorway through which software sends requests to a server, separate from the website you see.
  • API gateway: a front desk that routes incoming requests to the right internal service.
  • Application: the site's own code that acts on a request.
  • Authentication: checking who is asking.
  • Authorisation: checking whether the person asking is allowed to do the action.
  • Authorization header: a line in a request carrying proof of identity, such as a pass.
  • Backend: the server-side part of a system that stores data and does work.
  • CDN: a content delivery network, servers placed close to users to serve content quickly.
  • Cookie: a small note a browser keeps and shows to a site so the site remembers who you are.
  • CSRF token: a secret value in a form proving the request came from the site's own pages.
  • DKIM: a cryptographic signature on an email proving it came from the claimed domain and was not altered.
  • DMARC: a policy tying SPF and DKIM together and telling receivers what to do when they fail.
  • Endpoint: a specific address inside an API that performs one job.
  • From: the sender address shown to the reader of an email.
  • Header: a small labelled line in a request or email carrying extra details.
  • HTML entities: a way of writing characters as names or numbers, such as &.
  • HTTP/2: a version of the web protocol, the language browsers and servers speak.
  • Input validation: checking that supplied data is sensible and safe.
  • JSON: a common text format for data, using curly braces for groups and square brackets for lists.
  • JSON parser: the component that turns JSON text into usable data.
  • Load balancer: a component that spreads traffic across several servers.
  • Message-ID: a unique identifier attached to an email.
  • Normalisation: converting text into a standard form so different spellings compare equal.
  • Output encoding: making sure text cannot be misread as code when it is displayed.
  • Parameter: a named field in a request, such as memberEmail.
  • Parser: a program that reads text and works out what it means.
  • Parser differential: two components reading the same input differently, so a guard checks one spelling while the application uses another.
  • Phishing: a con where a message pretends to come from a trusted company to trick the reader into clicking or typing secrets.
  • POST: the request method meaning create or send something.
  • Primitive: a basic building block that can be combined into something bigger.
  • Proxy: an intermediary that forwards traffic.
  • Request: one message from a browser or tool to a server.
  • Return-Path: the address where bounced email goes.
  • SPF: a check that the sending mail server is allowed to send for the claimed domain.
  • Status code: a number a server returns to say how a request went, such as 202 for accepted.
  • Template engine: the component that fills values into an email template.
  • Trade-in: sending old gear back to a shop in exchange for credit or money.
  • Transactional email: an automatic message triggered by an action, such as a receipt or confirmation.
  • Unicode escape: writing a character as a code, such as \u002e for a full stop.
  • URL: a web address.
  • URL encoding: writing characters as percent codes, such as %2e.
  • User-information component: the optional username part of a URL before the @ sign, which is not the destination host.
  • WAF: a web application firewall, a security guard that inspects incoming requests and blocks suspicious ones.
  • XML parser: a component that reads the XML data format.

More by redhunter01

View all

24 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.