'Limited' RCE in certain places where Liquid is accepted
Liquid templates in shop notification emails and the checkout thank-you page exposed Ruby object methods and hidden properties to shop administrators. An attacker with admin access could call no-argument methods and dump hidden fields such as hashed passwords, and potentially reach dangerous methods.
- Triaged in 3 days
- Fixed in 4 days
- Paid in 4 days
- Disclosed after 4 days
Summary by the program
This issue allowed calls to ruby methods that were not intended to be available to the Liquid template.
The report
Short
Certain interfaces where a shop owner/administrator is able to utilize Liquid have access to methods and properties of certain Drops. This allows calling all methods of the object and access to all properties. While this sounds bad, it seems to be very limited and seems to be 'only' usable for Information Disclosure.
PoC
-
Go to your shop admin and navigate to the
Notifcationsettings -
Edit the
New Order Templateand place the following text into the textbox (also shown in theMalicious Templatescreenshot:{{ methods | json }} {{ systemu }} {{ class }} {{ to_yaml}}
-
Click the
Preview Buttonto have your code executed, results are shown in theMalicious Template Renderedscreenshot.
Affected parts of the system
Almost all of the Notification Email Templates are affected. It looks like one has access to an OrderDrop and DraftOrderDrop instance (verifyable throigh {{ class }} or similar methods which expose the class name). Please see the attached Affected Mail Templates screenshot, all templates which do have a Revert to default button rendered are affected.
The thank you page of the checkout is also affected, please see the Checkout Template and Checkout Rendering screenshots which are attached.
Limitations
I wasn't able to supply arguments to the methods exposed through this method, but one is still able to call methods which don't accept any. But just because I couldn't find a way doesn't mean there isn't any.
Impact
-
One has (at least) the ability to execute instance methods with no arguments and read access to certain otherwise hidden fields via the
to_yamlmethod. Depending on the actual code which is flawed it might be even possible to execute methods with user supplied arguments which would probably result in a server breach (there are very intersting methods likesystemu,real_call,instance_evalandinstance_exec. -
This bypasses access restrictions to certain hidden/filtered fields, like a hashed user password. For example, a malicious admin can force the delivery of the
Real Order Mail Renderedto an address controlled by him if he does the following: -
Ensure the last user who touched an order is a desired victim (e.g. the shop owner)
-
Edit the customers email to an attacker controlled one via the Customer admin interface
-
Resend an order confirmation mail which is prepared to render like
Real Order Renderingin an Email, by placing{{ to_yaml }}in the template
Final words
Depending on the real flaw in the code this might be something which needs to be addressed by the Liquid library. I would be very pleased if you could disclose what kind of condition exactly led to this flaw. It might be worth chaning Liquid in a way to guard against this kind of flaw as users expect it to be secure by default.
Please let me know if you need any additional information here, I hope I was clear enough with my explainations. I'm still a little disappointed that I didn't manage to achieve 'real' RCE here, but I'm happy on the other side to report this asap even without 'real' RCE so you could fix this asap. I discovered this approx. 18h ago by accident and couldn't spend that much time on developing a PoC.
Attachments






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
Root cause
Likely the Liquid drops exposed their underlying Ruby object and its methods to templates instead of restricting templates to a safe allowlist of properties.
Impact
An administrator could call no-argument instance methods and read hidden fields such as hashed passwords, and the author notes it might be possible to pass arguments and reach a server breach, though this was not demonstrated.
What the attacker needed
Shop administrator access; Liquid-enabled template interface
How it was found
- Open the notification settings in the shop admin.
- Edit the new order email template and insert template expressions that call object methods.
- Click preview to render the template and see the results.
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.
Liquid is a template language used to build text like emails from placeholders. Here the template engine let a shop administrator reach the underlying Ruby objects and call their methods, which should have been hidden. That leaked private data and could have led to running code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.