<?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 Mohamed Salah on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Salah on Medium]]></description>
        <link>https://medium.com/@0xmo?source=rss-e69f191ef054------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UFJU8MJ44ry17Y_l</url>
            <title>Stories by Mohamed Salah on Medium</title>
            <link>https://medium.com/@0xmo?source=rss-e69f191ef054------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 22:30:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xmo/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[JWT authentication bypass via weak signing key]]></title>
            <link>https://medium.com/@0xmo/jwt-authentication-bypass-via-weak-signing-key-2fc19caf3834?source=rss-e69f191ef054------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fc19caf3834</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[jwt]]></category>
            <dc:creator><![CDATA[Mohamed Salah]]></dc:creator>
            <pubDate>Sat, 31 Aug 2024 19:18:36 GMT</pubDate>
            <atom:updated>2024-08-31T19:20:06.981Z</atom:updated>
            <content:encoded><![CDATA[<h3>JWT authentication bypass via weak signing key-PortSwigger</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79oDJZZILE2nI7GXjayKwQ.png" /></figure><h4>Lab Description:</h4><p>This lab uses a JWT-based mechanism for handling sessions. It uses an extremely weak secret key to both sign and verify tokens. This can be easily brute-forced using a <a href="https://github.com/wallarm/jwt-secrets/blob/master/jwt.secrets.list">wordlist of common secrets</a>.</p><p>To solve the lab, first brute-force the website’s secret key. Once you’ve obtained this, use it to sign a modified session token that gives you access to the admin panel at /admin, then delete the user carlos.</p><p>You can log in to your own account using the following credentials: wiener:peter</p><h4>Getting Start:</h4><p>Firstly, we sign in using wiener:peter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBxGxETk8plcPkJ_FilU_A.png" /></figure><p>Then we try to go to /admin path</p><p>Unfortunately, we got this message</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGhJ-yV47PckYcwlJk_R4g.png" /></figure><p>intercept the request with Burb Suite to see what it has, then send it to repeater</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DWzAUygV6K68GpVklWdnBA.png" /></figure><p>Now we will use hashcat tool to brute-force the secret key</p><blockquote>we will use this list: <a href="https://github.com/wallarm/jwt-secrets/blob/master/jwt.secrets.list"><em>https://github.com/wallarm/jwt-secrets/blob/master/jwt.secrets.list</em></a></blockquote><p>and that’s the command we will use:</p><pre>hashcat -a 0 -m 16500 &lt;YOUR-JWT&gt; /path/to/jwt.secrets.list</pre><p>We get this result:</p><pre>eyJraWQiOiJiNmJmNmFmOS02MzdjLTRkOTYtOTNkZC1iODRjNzBlMTNkMjciLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwb3J0c3dpZ2dlciIsImV4cCI6MTcyNTA5MzY1NCwic3ViIjoid2llbmVyIn0.3D0OEBPLsRux66YlCV6yvQJAtx7xydHl9EW9V7qD1WE:secret1</pre><p>the secret key is (secret1)</p><p>From burb Decoder, we will encode <strong>secret1</strong> as Base64</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70OhW5MkCt2Z4yCNT0uV9g.png" /></figure><p>Using Burb Extension (JWT Editor), Do that:</p><p>1- New Symmetric Key</p><p>2- Generate</p><p>3- Replace k value with the Base64-encoded secret key</p><p>4- OK</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGi6nbJXqLypDrkrh-zd5Q.png" /></figure><p>From Repeater tab:</p><p>1- open JSON Web Token tab</p><p>2- Replace sub value with administrator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hkPyBhHjzKgmtxWvenAxw.png" /></figure><p>3- Click sign and select the signing key we generate it before and check (Don’t Modify Header), Then click OK</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ucI7RMT5UmEvW8mLtzJE4A.png" /></figure><p>Back to Raw tab, click Send And we get 200 ok</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ufMdbIN52PsS6awN10XlQ.png" /></figure><p>Replace /admin with /admin/delete?username=carlos</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FYVH2VK6C030A0rbFXEaA.png" /></figure><p>And Finally, The Lab is Solved</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNiQQS4iLBqdkYL6lvI-3A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fc19caf3834" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>