Hunting for SFMC on Attack Surfaces
Salesforce Marketing Cloud (SFMC) email templates were vulnerable to template injection through user-supplied data in email subjects (due to double evaluation) and through the TreatAsContent function, allowing attackers to read all subscriber data. Additionally, the encrypted query strings used in view-email and cloud-page URLs used unauthenticated CBC encryption with a static key, enabling padding oracle attacks to decrypt and forge parameters, and a MicrositeURL function bypass allowed arbitrary parameter encryption.
slcyber.io
Published on slcyber.io
Have you noticed that almost every marketing email you receive looks somewhat similar, or has functionality that seems centralised? This is because most corporations have moved to some form of marketing cloud to facilitate sending mass email campaigns.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the root causes were: (1) SFMC double-evaluated email subject lines by default and provided a dangerous TreatAsContent function without warnings, enabling template injection; and (2) the 'classic' encrypted query string used unauthenticated CBC encryption with a single static key shared across all tenants, allowing padding oracle attacks and forgery.
What the attacker needed
A free account on a site using SFMC; victim receives marketing email; ability to sign up with crafted name
The fix
Salesforce disabled double evaluation of email subject line AMPscript after disclosure, but the report does not state a fix for the CBC encryption or TreatAsContent issues.
How it was found
- Sign up for an account on a target site that uses SFMC, entering a template injection payload (e.g., an AMPScript expression) in the name field.
- Receive the marketing email and observe whether the payload is evaluated in the subject or body.
- Use the HttpGet function as a canary to confirm template injection by triggering a DNS lookup.
- Use the LookupRows function to query the _Subscribers data view and extract subscriber information.
- For the encrypted query string, identify a padding oracle by modifying bytes and observing error behaviour.
- Use a padding oracle tool to decrypt the query string and forge new values for parameters like ls to enumerate emails.
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 write-up has not been written yet. The Original tab links to the source.
This report describes two main problems in Salesforce Marketing Cloud, a service many companies use to send marketing emails. First, if a company put user-supplied text (like a first name) into an email subject or used a certain function, an attacker could inject code that runs on the server and read all the company's stored email data. Second, the links in those emails contained encrypted data that was protected with a weak, shared encryption method, so an attacker could decrypt it and change it to view other people's emails.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.