Skip to content
SSRF Disclosed report Intermediate

Bypassing HTML filter in "Packing Slip Template" Lead to SSRF to Internal Kubernetes Endpoints

The packing slip template editor filtered dangerous HTML such as iframe tags, but a crafted prefix bypassed the sanitiser and let an iframe render inside the generated PDF. Because the PDF renderer fetched the iframe URL, an attacker could make the server request internal HTTPS endpoints such as the Kubernetes API.

cthulhufhtagn Follow

Originally disclosed on HackerOne

  • Triaged in 3 days
  • Fixed in 6 months
  • Paid in 9 days
  • Disclosed after 9 months

Summary by the program

@cthulhufhtagn reported a bypass for Packing Slip HTML sanitization checks, which under certain circumstances could disclose order information to staff members without orders permission. We are no longer accepting this type of sanitization bypass, so please consult our program page before digging into this functionality.

The report

Summary

Shopify has a feature called Print Packing Slip, with this tool, users can easily print a packing slip after customers make an order. The generated packing slip can be downloaded as a PDF file.

Users can edit an Edit packing slip template to adjust with a shop design.

However, there's have a filter in the PDF Generator like <iframe> tag is filtered or sanitize, but we can bypassing HTML filter inject malicious HTML code, and accessing the Internal Kubernetes Endpoints.

The initial test that I do is trying to add an Iframe to the Packing Slip template and expecting those Iframe will generate in the PDF file.

This tag was filtered so the HTML will not added to the PDF:

<iframe src="https://evil.com/" width=1001 height=1001>

But it can be bypassed by adding <svg><style><h1/> in the beginning of tag:

<svg><style><h1/><iframe src="https://evil.com/" width=1001 height=1001>

The Iframe was successfully loaded:

Screen_Shot_2021-03-03_at_05.23.53.png
Screen_Shot_2021-03-03_at_05.23.53.png From the original on HackerOne

Since this only accepting HTTPS protocol, I was unable to extract the Google Cloud Metadata. But I can hit the Kubernetes API which is using HTTPS protocol.

Step to Reproduce

  1. Log in to the Shopify account
  2. Navigate to https://mystore.myshopify.com/admin/settings/packing_slip_template
  3. Add this HTML tag
<svg><style><h1/><iframe src="https://kubernetes.default.svc/info" width=1001 height=1001>
  1. Preview Template and PDF will generated
Screen_Shot_2021-03-03_at_05.27.34.png
Screen_Shot_2021-03-03_at_05.27.34.png From the original on HackerOne
<svg><style><h1/><iframe src="https://kubernetes.default.svc/livez?verbose" width=1001 height=1001>
Screen_Shot_2021-03-03_at_05.28.56.png
Screen_Shot_2021-03-03_at_05.28.56.png From the original on HackerOne

Impact

The attacker can perform an SSRF attack on the internal network.

The original report as published on HackerOne, by cthulhufhtagn. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

The attacker could perform SSRF against internal network services, though only HTTPS targets were reachable and Google Cloud metadata could not be extracted.

What the attacker needed

A Shopify staff account; access to packing slip template settings

The fix

The report does not state a fix; the program said it no longer accepts this class of sanitiser bypass, so the filter and PDF renderer should be hardened so injected markup cannot cause server-side fetches.

How it was found

  1. Log in to the Shopify account.
  2. Open the packing slip template settings page in the admin.
  3. Insert an iframe pointing at an internal HTTPS address, prefixed with the bypass markup.
  4. Preview the template so a PDF is generated and the iframe is fetched.

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.

A packing slip is the paper that goes in a parcel; Shopify lets shops edit its template, and the template is turned into a PDF by a server. The filter meant to strip dangerous HTML could be tricked, so the server's PDF maker loaded a web address chosen by the attacker, including addresses only reachable from inside Shopify's network.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.