Skip to content
Access control Write-up Beginner

BAC: Unauthorized Email Sending.

A low-privileged team member without access to the messaging feature could still call the email-sending endpoint directly and have the server send branded emails with attacker-controlled content and links to arbitrary addresses. The server did not check the caller's permissions on that endpoint.

medium.com

Published on medium.com

Bug Bounty

Saad, 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. 3 min read.

Context

The target was a single SaaS product tested through a public VDP programme on Bugcrowd. The programme was public and old, dating from around 2017, and had 713 reports at the time of testing. The feature involved is a messaging feature that sends emails; the email received in testing carried the application's branding and attacker-controlled content.

The bug class is broken access control (BAC): a lower-privileged user who had no access to the messaging feature in the UI was still able to send emails through the underlying API endpoint.

Setup

The researcher spent three weeks testing the programme, working through each permission level. Two accounts were created:

  1. User a, an admin, who invited User b to the team.
  2. User b, given the lowest permission possible, explicitly without access to the messaging feature.

With that configuration, the messaging feature was unavailable through the User b UI. The admin's browser session was used to capture the request that the feature issues.

Finding it

The starting observation was simple: the feature is hidden from User b in the interface, but hiding a feature in the UI says nothing about whether the server enforces the permission. The researcher captured the request as the admin and then sent it again with the low-privileged user's cookie.

Exploitation

Step 1: Capture the request as the admin

With User a's session, the email-sending action produced this request:

HTTP
POST /api/groups/[REDACTED]/messages/email/

The group identifier in the path is redacted in the write-up. The endpoint is a group-scoped messages resource with an email sub-resource, and it is reached with a POST.

Step 2: Swap the session to the low-privileged user

The cookies in the captured request were replaced with User b's cookie, and the request was sent again:

The body has two fields: comment, here a link to an attacker-controlled domain, and email_addresses, an array of recipients. email_addresses is an array of recipients, here a single victim address. The host is redacted in the write-up.

Step 3: Observe the result

The server responded with:

HTTP
HTTP/2 200 OK

and the email was sent to the victim. The received email contained:

  • attacker-controlled content;
  • a clickable URL;
  • the application's branding.

The received email contained attacker-controlled content, a clickable URL and the application's branding.

Root cause

The endpoint did not enforce authorisation on the server side. The feature was unavailable through User b's UI, but the API accepted the request from User b's session. The write-up states this directly: authorisation was not properly enforced at the server-side endpoint. Whether the check was missing entirely or applied to the wrong object or role is not described.

Impact

A user with the lowest permission in a team, and no access to the messaging feature, could send emails to arbitrary addresses through the application. The received email carried the application's branding and a clickable attacker-controlled URL. The write-up does not describe any further consequences, such as access to other groups' data or limits on volume.

Fix

The write-up does not say what was changed.

Variants to test

  1. Replay privileged requests with a low-privileged session. Capture every state-changing request as an admin, swap in the lowest-privilege account's cookie, and resend. A positive result is a success response and a visible side effect, such as a delivered email.
  2. Look for hidden features. Any feature absent from the low-privilege UI is a candidate; the UI hiding it is not evidence of a server-side check.
  3. Try other sub-resources of the same endpoint.
  4. Vary the recipient list.
  5. Check content control.

Conclusion

The bug was found after three weeks of testing the programme and understanding each permission level. The report was rated p3 and closed as a duplicate.

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

What happened, in plain words

A security researcher spent three weeks testing a software-as-a-service (SaaS) product through a public vulnerability disclosure programme (VDP) on Bugcrowd. The programme was public and old, dating from around 2017, and had 713 reports at the time of testing. The researcher found that a user with the lowest possible permissions, who could not see or use a particular messaging feature in the web interface, could still send emails to anyone by talking directly to the server that powers that feature. The emails carried the application's branding and attacker-controlled content, including a clickable link. The report was rated p3 and closed as a duplicate.

This is a beginner's version of that write-up. It explains every term from scratch, walks through the same steps, and shows the same requests and payloads exactly as they appeared.

Background: what the product and feature do

The target is a SaaS product: software that runs on the vendor's servers and is used through a browser, like an online team workspace. It has teams, users and permission levels. An admin can invite people to a team and decide what each person is allowed to do.

The feature involved is a messaging feature that sends emails. The email carries the application's branding, so it looks like a legitimate notification from the product.

The bug class: broken access control

Broken access control (BAC) means the application does not properly check whether the person making a request is allowed to do what they are asking. In everyday terms: a building might hide the door to a storage room from most staff, but if the lock on the door is not actually engaged, anyone who knows where the door is can walk in. Hiding the door is not the same as locking it.

Here, the messaging feature was hidden from the low-privileged user in the interface, but the server behind the interface did not enforce the permission. The researcher could send the request directly and the server accepted it.

Setup: two accounts and three weeks of testing

The researcher spent three weeks testing the programme, working through each permission level. Two accounts were created:

  1. User a, an admin, who invited User b to the team.
  2. User b, given the lowest permission possible, explicitly without access to the messaging feature.

With that configuration, the messaging feature was unavailable through the User b interface. The admin's browser session was used to capture the request that the feature issues.

A session is what keeps you logged in as you move around a website. When you log in, the server gives your browser a small piece of data, usually stored in a cookie, and the browser sends it back with every request so the server knows who you are. Think of it as a wristband at an event: it proves you paid, and you show it at every door. If someone else's wristband is accepted at a door it should not open, that is the problem here.

Finding it

The starting observation was simple: the feature is hidden from User b in the interface, but hiding a feature in the interface says nothing about whether the server enforces the permission. Many applications draw their screens based on what the server tells them, but the server is the thing that actually does the work. If the server does not check, the interface is just a curtain.

The researcher captured the request as the admin and then sent it again with the low-privileged user's cookie. Replaying means sending the same request again, possibly with small changes, to see how the server responds.

Exploitation

Step 1: Capture the request as the admin

With User a's session, the email-sending action produced this request:

HTTP
POST /api/groups/[REDACTED]/messages/email/

Line by line:

  • POST is the HTTP method. Methods are verbs that tell the server what kind of action you want. GET usually means "give me something", POST usually means "create or submit something". Here it means "send an email".
  • /api/groups/[REDACTED]/messages/email/ is the path. An API (application programming interface) is the set of URLs a program exposes so that other programs, including the JavaScript running in your browser, can ask it to do things. The path is like a postal address: it points to a specific resource. groups suggests the resource belongs to a group, [REDACTED] is a placeholder for the group's identifier, which the write-up hides, messages is the messages collection, and email is a sub-resource that sends an email.
  • The group identifier in the path is redacted in the write-up. The endpoint is a group-scoped messages resource with an email sub-resource, and it is reached with a POST.

When the admin used the messaging feature, the browser sent this request, and the researcher could see it, including the cookie that identified the admin's session.

Step 2: Swap the session to the low-privileged user

The cookies in the captured request were replaced with User b's cookie, and the request was sent again:

Line by line:

  • The first line is the same method and path as before, plus HTTP/2, which is the version of the HTTP protocol used for the request. HTTP is the language browsers and servers use to talk to each other. Version 2 is a newer version than the original HTTP/1.1, and it is common on modern sites.
  • Host: [REDACTED] tells the server which website the request is for. One server can host many sites, so the host header says which one you want. The write-up hides the actual host.
  • The blank line separates the headers (the metadata) from the body (the content).
  • The body is JSON, a text format for structured data. It is written as a set of names and values.
  • "comment": "https://evil.com" is a field in the body, here a link to a domain the attacker controls. Here it is a link to a domain the attacker controls. evil.com is a placeholder-style example domain used in security writing; the point is that the attacker chooses the link.
  • "email_addresses": [ ... ] is an array, which is a list. It holds the recipients. Here there is one: "[redacted]". The write-up uses this address as the example victim.
  • The host is redacted in the write-up.

Why swap the cookie? Because the cookie is what identifies the session. If the server checks permissions, it should look at the cookie, see that it belongs to User b, and refuse. If it does not check, it will treat the request as valid and do the work. The researcher is testing exactly that.

Step 3: Observe the result

The server responded with:

HTTP
HTTP/2 200 OK

Line by line:

  • HTTP/2 is the protocol version of the response.
  • 200 is the status code. Status codes are three-digit numbers that summarise what happened. Codes starting with 2 mean success, 3 mean redirection, 4 mean the client did something wrong (for example, 403 means forbidden), and 5 mean the server had a problem. 200 OK means the server accepted the request and did what was asked.
  • OK is the reason phrase, a short human-readable label for the code.

And the email was sent to the victim. The received email contained:

  • attacker-controlled content;
  • a clickable URL;
  • the application's branding.

The received email contained attacker-controlled content, a clickable URL and the application's branding.

Root cause

The endpoint did not enforce authorisation on the server side. Authorisation is the process of deciding whether an authenticated user is allowed to do a particular thing. Authentication is proving who you are; authorisation is what you are allowed to do once you have proved it. The feature was unavailable through User b's interface, but the API accepted the request from User b's session. The write-up states this directly: authorisation was not properly enforced at the server-side endpoint. Whether the check was missing entirely or applied to the wrong object or role is not described.

Impact

A user with the lowest permission in a team, and no access to the messaging feature, could send emails to arbitrary addresses through the application. The received email carried the application's branding and a clickable attacker-controlled URL. The write-up does not describe any further consequences, such as access to other groups' data or limits on volume.

Fix

The write-up does not say what was changed. In the building comparison: put a real lock on the door, not just a curtain.

Variants to test

  1. Replay privileged requests with a low-privileged session. Capture every state-changing request as an admin, swap in the lowest-privilege account's cookie, and resend. A positive result is a success response and a visible side effect, such as a delivered email.
  2. Look for hidden features. Any feature absent from the low-privilege interface is a candidate; the interface hiding it is not evidence of a server-side check.
  3. Try other sub-resources of the same endpoint.
  4. Vary the recipient list.
  5. Check content control.

Conclusion

The bug was found after three weeks of testing the programme and understanding each permission level. A duplicate means someone else had already reported the same issue. p3 is a priority rating used by the programme, lower than p1 and p2.

Glossary

  • API: the set of URLs and rules a program exposes so other programs, including the JavaScript in your browser, can ask it to do things.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: deciding what an authenticated user is allowed to do.
  • Broken access control (BAC): a vulnerability where the application does not properly check whether the person making a request is allowed to do it.
  • Cookie: a small piece of data a website stores in your browser and your browser sends back with each request, often used to keep you logged in.
  • Duplicate: a report of an issue that has already been reported by someone else.
  • Endpoint: a specific URL that an application exposes for a particular action.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • HTTP/2: a newer version of HTTP, common on modern sites.
  • JSON: a text format for structured data, written as names and values.
  • p3: a priority rating used by the programme, lower than p1 and p2.
  • Phishing: tricking someone into clicking a link or handing over information by making a message look trustworthy.
  • POST: an HTTP method usually used to create or submit something.
  • Replay: sending the same request again, possibly with small changes, to see how the server responds.
  • SaaS: software that runs on the vendor's servers and is used through a browser.
  • Session: the state of being logged in, maintained across requests, usually with a cookie.
  • Status code: a three-digit number in an HTTP response that summarises what happened, such as 200 for success or 403 for forbidden.
  • VDP: vulnerability disclosure programme, a scheme for reporting security issues to an organisation.

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.