How I Hacked A Fake Dmart Website And Took It Down
A fake DMart giveaway website used a Node.js templating engine that evaluated user input, allowing server-side template injection. The author exploited this to run commands and delete the site's files.
Published on infosecwriteups.com
During a routine check, I came across a WhatsApp forward promoting a fake DMart giveaway. The link was hosted on servio.io, and at first glance, it looked legitimate.
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
Impact
The author gained full control over the server and could access stolen user data, then deleted the site's files.
What the attacker needed
Access to the fake website; ability to intercept HTTP requests
How it was found
- The author inspected the JavaScript and modified it in the browser to bypass the sharing requirement.
- The author intercepted the POST request containing their details using Burp Suite.
- The author tested for SSTI by submitting a name containing a template expression.
- The server evaluated the expression and returned the result, confirming SSTI.
- The author crafted a payload to execute a reverse shell command.
- The author started a listener on their VPS and sent the request, gaining a shell.
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.
The website took text from a form and inserted it into a template without cleaning it. Because the template engine could run code, the author could make the server run their own commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.