Skip to content
Misconfiguration Disclosed report Beginner

Sending trusted ████ and ██████████ emails through public API endpoint in ███████ site

A public API endpoint accepted arbitrary sender, recipient, subject and body without validation, letting an unauthenticated attacker send email through the organisation's mail servers. Because the messages passed DKIM and SPF checks, they could be used for convincing phishing.

skarsom Follow

Originally disclosed on HackerOne

  • Triaged in 7 hours
  • Fixed in 38 days
  • Disclosed after 3 months

Summary: A publicly accessible endpoint at PUT https://████████does not validate any of its four parameters: to, from, subject, text. This enables sending email to any address, with any content, with any from address, on a server that is in ██████whitelist. Such services include, but are not limited to, all ██████ email (██████.

Description: The ███'s (████████) ███████ (███) public portal, including login to the private portal, exists at https://███████████/welcome/ with a staging environment at https://███/welcome/. This vulnerability affects both staging and production.

Whenever a request for a new account or a password reset is created, the AngularJS frontend formats this request with a client-side email template (relevant code in https://██████/█████) and sends a JSON-encoded PUT request to /███████.

There are four parameters:

  1. to -- this should always be █████ per https://████████/████████
  2. from -- this should always be █████ per https://████████/█████
  3. subject -- the email subject
  4. text -- the email body

Because the client-side AngularJS code is trusted to generate legitimate emails, an unauthorized attacker can use this API to mass-send legitimate ███████ or ██████ emails with arbitrary content. These emails go through the ███ system, so they explicitly pass DKIM and SPF.

Step-by-step Reproduction Instructions

  1. Execute the following cURL request, changing the text YOUREMAIL in the JSON-encoded to parameter to an email address of your choosing:

curl -X PUT --data '{"from":"Email POC <skarsomh1vdp@████>","to":"YOUREMAIL","subject":"Test under DC3 VDP at HackerOne","text":"This is a test. For more info see hackerone.com/deptofdefense."}' -k https://████████-H 'Content-type: application/json' ``` 2. Success. Check the email address specified in the to parameter. Notice that this email passes all spam checks such as DKIM and SPF.

Suggested Mitigation/Remediation Actions

  • Completely remove the /████ endpoint.
  • Add a new endpoint for requesting a new account that composes the proper email on the backend.
  • Add a new endpoint for requesting help with logging in that composes the proper email on the backend.
  • Evaluate whether the ██████████ needs to continue including ████████SPF records, as it increases attack surface.

Impact

An unauthorized attacker can send arbitrary email from ██████-controlled email servers.

An adversary could create a spear phishing attack against high-value targets by forging ████ or IC correspondence. For example, sending an email from ██████████ requesting personnel to click on a link to verify their CAC info.

The original report as published on HackerOne, by skarsom. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The server exposed an email-sending endpoint that trusted client-supplied sender, recipient and content instead of composing messages itself.

Impact

An unauthenticated attacker could send arbitrary email from organisation-controlled servers, enabling spear phishing that forges official correspondence.

What the attacker needed

No authentication; network access to the endpoint

The fix

The endpoint should be removed and replaced with backend endpoints that compose the proper emails server-side.

How it was found

  1. Send a PUT request to the endpoint with a JSON body containing from, to, subject and text.
  2. Check the recipient inbox and observe the message passes DKIM and SPF.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Email systems use checks called DKIM and SPF to prove a message really came from the domain it claims. Here the website had a public endpoint that built and sent emails, and it trusted whatever the browser sent it. Anyone could call it directly and make the organisation's own servers send fake but technically valid messages.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by skarsom

View all

5 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.