While studying advanced template injection techniques, I came across one of the most fascinating bug bounty stories I’ve ever encountered. Researcher Mahmoud’s journey to discover a Handlebars template injection vulnerability in Shopify’s Return Magic app reads like a digital detective novel, complete with international travel, late-night hacking sessions, and a breakthrough at 30,000 feet.
Press enter or click to view image in full size
The story begins at Shopify’s H1–514 bug bounty event in 2018. Mahmoud was testing the Return Magic app, which included an email workflow feature that allowed shop owners to customize return notification emails using template variables like {{order.number}} and {{email}}.
The Initial Clue:
When Mahmoud entered {{this}} in an email template and received [object Object] in the test email, his curiosity was piqued. This simple response indicated that user input was being evaluated in a JavaScript context on the server side.
Mahmoud initially thought the app was using Mustache.js, a “logic-less” template engine that shouldn’t…