<?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 &lt;/Y55F&gt; on Medium]]></title>
        <description><![CDATA[Stories by &lt;/Y55F&gt; on Medium]]></description>
        <link>https://medium.com/@youssef-nini?source=rss-bcbe8132f26c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UsC20uHMeY6V0zdUxo1I7A.png</url>
            <title>Stories by &amp;lt;/Y55F&amp;gt; on Medium</title>
            <link>https://medium.com/@youssef-nini?source=rss-bcbe8132f26c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:37:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@youssef-nini/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[Lab: Exploiting NoSQL operator injection to extract unknown fields (writeup)]]></title>
            <link>https://youssef-nini.medium.com/lab-exploiting-nosql-operator-injection-to-extract-unknown-fields-writeup-889e5d26cffc?source=rss-bcbe8132f26c------2</link>
            <guid isPermaLink="false">https://medium.com/p/889e5d26cffc</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[portswigger]]></category>
            <dc:creator><![CDATA[</Y55F>]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 18:30:18 GMT</pubDate>
            <atom:updated>2026-03-07T18:30:18.959Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This write-up provides a step-by-step solution for “</em>Exploiting NoSQL operator injection to extract unknown fields<strong>” </strong>Lab on PortSwigger.</p><blockquote><strong>What is NoSQL Injection?</strong></blockquote><p>NoSQL injection is a vulnerability where an attacker is able to interfere with the queries that an application makes to a NoSQL database.<br>Unlike SQL databases, where injections are based on SQL queries (such as SELECT or INSERT), NoSQL databases use query languages specific to each type of database.</p><p><strong>NoSQL injection may enable an attacker to:</strong><br> <strong>&gt;</strong> Bypass authentication or protection mechanisms.<br> <strong>&gt;</strong> Extract or edit data.<br> <strong>&gt;</strong> Cause a denial of service.<br> <strong>&gt;</strong> Execute code on the server.</p><p>NoSQL databases do not support one standardized query language, and therefore, the exact queries allowed depend on:</p><p><strong>Database engine</strong> — for example, MongoDB, Cassandra, Redis, or Google<br> Bigtable<br><strong>Programming language</strong> — for example, Python, PHP<br><strong>Development framework</strong> — for example, Angular, Node.js</p><p>A common denominator of most NoSQL databases is that they support the text-based JavaScript Object Notation (<strong>JSON</strong>) format.</p><blockquote><strong>Types of NoSQL injection</strong></blockquote><p>There are two different types of NoSQL injection:</p><ul><li><strong>Syntax injection</strong> — This occurs when you can break the NoSQL query syntax, enabling you to inject your own payload. The methodology is similar to that used in SQL injection.</li><li><strong>Operator injection</strong> — This occurs when you can use NoSQL query operators to manipulate queries.</li></ul><blockquote><strong>What do we have to do to solve the lab?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*ZDRw05E3pSDhD9IPGPAurQ.png" /></figure><p>The goal is to log in as carlos.</p><p>The lookup functionality <strong>refers to</strong> the login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eLd3W4UWTJ5sozd6yoeUNA.png" /></figure><p>I try to insert a query operator as a nested object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BVNw7nuC7IfxSaHtFTshw.png" /></figure><p>The string Account locked: please reset your passwordtells us that the username and the password are correct.<br>This means it works.</p><p>From the name of the lab, we have to extract an unknown field.<br>For that, I will try to inject the operator $where that allows me to run JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pAX1U-eBB_ic_rW-h7pTmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwcrOn73YAfizryQ12ovCw.png" /></figure><p>To verify execution within the $where clause, I sent a pair of requests: one resulting in a <strong>true</strong> condition and another in a <strong>false</strong> condition.</p><p>I read this on PortSwigger, that tell us how we can extracte filed names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*rzXIVvTzGw4I9L2JcR7Z-Q.png" /></figure><blockquote>what this payload mean : Object.keys(this)[0].match(&#39;^a&#39;)</blockquote><p><strong>.keys</strong>: Static method on Object that returns an array of the object&#39;s own enumerable property names (keys) as strings.</p><p><strong>(this)</strong>: this is the current MongoDB document (an object). Object.keys(this) gets an array like [&quot;_id&quot;, &quot;username&quot;, &quot;password&quot;]</p><p><strong>[0] </strong>: Accessing the first element of the array.</p><p><strong>.match</strong>: String method that applies a regular expression; returns a match array or null.</p><p><strong>(&#39;^a&#39;)</strong>: if the string doesn’t start with a It will return null.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAItKZXfE5d-VKRomW7E-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*56mH3E4ecwFoBbBkAOipjQ.png" /></figure><p>The request tells us that the first field is _id</p><p>I will try to find out how many fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oh7Cr95czw1Xn3LWBtn-nw.png" /></figure><p>There are 4 fields.</p><p>I found out that 4 fields are id, username, password, email<br>But wait! Where is the unknown field?</p><p>To add the field to the object, you have to send a forgot password request, then the fields will be 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oB_x7wpET9d5b5bcx2-ZXg.png" /></figure><p>From this We know that the fifth field is the one that has the reset token.</p><p>The next step is to extract the name of the fifth field. We will use Burp Intruder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bp_6-vcYA_xVB8QFgzcuYQ.png" /></figure><p>The name of the field that contains the reset token is forgotPwd</p><p>We will do the same thing to extract the value of fogotPWd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYqcyAfeuvu4CyRjVIF8fA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8r08kDCYfT7sUZO8PSapA.png" /></figure><p>Now we&#39;ve got the reset token value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*pefMYxJUpUmhYzG4dHPiYQ.png" /></figure><p>We created a new password, and we logged in as Carlos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=889e5d26cffc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab: Exploiting XXE to retrieve data by repurposing a local DTD (writeup)]]></title>
            <link>https://youssef-nini.medium.com/lab-exploiting-xxe-to-retrieve-data-by-repurposing-a-local-dtd-70f22d75d0fe?source=rss-bcbe8132f26c------2</link>
            <guid isPermaLink="false">https://medium.com/p/70f22d75d0fe</guid>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[</Y55F>]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 15:25:14 GMT</pubDate>
            <atom:updated>2026-03-05T16:16:23.467Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This write-up provides a step-by-step solution for “</em> Exploiting XXE to retrieve data by repurposing a local DTD<strong>” </strong>Lab on PortSwigger.</p><blockquote><strong><em>What is XXE(XML External Entity)?</em></strong></blockquote><p>XML external entity injection (XXE) is a web security vulnerability that allows a threat actor to inject unsafe XML entities into a web application that processes XML data. It often allows an attacker to view files on the application server filesystem, and to interact with any back-end or external systems that the application itself can access.</p><blockquote><strong>What do we have to do to solve the lab?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*7mzJdcjbXRakJxMAydU5WA.png" /></figure><p>The goal is to read the content of the /etc/passwd file.</p><p>Also, we know that the vulnerabilty exist on the “check stock” feature, and we have to reference an existing DTD file on the server and redefine an entity from it, from the Hint. We know that the DTD file exists in /usr/share/yelp/dtd/docbookx.dtd and he contains an entity called ISOamso</p><p>I intercept the request from the Check stock feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZgLj1yrANPZJ9fj1vnIS2g.png" /></figure><p>Now, I will load the DTD file to override the ISOamso entity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0pOchtcnWpGDVYl_I47uow.png" /></figure><p>We see no errors, so the file exists.</p><blockquote>Ok, what does this code mean?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*fWIUz0b1212WprJTbInDIw.png" /></figure><p><strong>First, we have to understand what a DTD is.<br></strong>DTD is a document-type definition. DTD contains a set of rules that control the structure and elements of XML files.<br>The DTD is declared within the optional DOCTYPE element at the start of the XML document. The DTD can be fully self-contained within the document itself (known as an &quot;internal DTD&quot;), or can be loaded from elsewhere (known as an &quot;external DTD&quot;), or can be a hybrid of the two.</p><p>Inside the DTD, we declare a <em>Parametric entity</em>.<br><strong>What is an xml entity?<br></strong>An entity in XML is like a placeholder for text or data. It’s a way to store information that you can reuse in your XML document.<br><strong>There are generally three types of entities in XML<br> - </strong>Internal entities.<br> - External entities.<br> - Parametric entities.</p><p><strong>Internal entities</strong> are like sticky notes that you write and keep within a book.</p><pre>&lt;!DOCTYPE foo [<br>     &lt;!ENTITY name &quot;Example Corp&quot;&gt;<br>]&gt;</pre><p><strong>External entities</strong> are like bookmarks that point to information outside of your XML document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*t-f1-rrdiO8sWOtYuuCHEQ.png" /></figure><p><strong>Parameter entities</strong> are a special kind of XML entity that can only be referenced elsewhere within the DTD.<br>They are like variables that you can use to define parts of your document type definition (DTD) in XML.</p><blockquote><strong>Why did we use a parametric entity?</strong></blockquote><p>In this challenge, I think that external entities may be blocked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdoVanb1pmZw-pywrpp9Hw.png" /><figcaption>We didn’t get any error, because the load_dtd entity is ignored.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8LmfPnno674p7NcibdgPhA.png" /><figcaption>But here, we see that we get an error message.</figcaption></figure><p>Also, we are doing something more subtle than just reading a file.<br>We are redefining an existing entity.</p><p>Now, we have to read the content of /etc/passwd file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q16Gu8QKWLcEGZjMDI90JQ.png" /></figure><p>Now, we will explain the payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*6y-NM1rdPo_CQIIjXml9jQ.png" /></figure><ul><li>Defines an XML parameter entity called local_dtd, containing the contents of the external DTD file that exists on the server filesystem.</li><li>Redefines the XML parameter entity called ISOamso, which is already defined in the external DTD file. The entity is redefined as containing the error-based XXE exploit, for triggering an error message containing the contents of the /etc/passwd file.</li></ul><p>I think that you have many questions about the payload. <br>What is this &amp;#x25?<br>Why didn’t you use % instead of &amp;#x25?<br>Why do you define an entity evalWhy just create error entity only?<br>These are good questions.</p><blockquote><strong>What is this </strong><strong>&amp;#x25?</strong></blockquote><p>That is called a <strong>character reference</strong> (specifically a hexadecimal numeric character reference) in XML (and HTML).<br>So when an XML parser sees&amp;#x25; it replaces it with %.</p><blockquote><strong>Why didn’t you use </strong><strong>% instead of </strong><strong>&amp;#x25?</strong></blockquote><p>Because when you declare an internal parametric entity, the xml parser finds % character Inside the quotes, he says that this has to be a parametric entity that has to be referenced, but when he reads the next character to % He finds space, but this is against the specification of xml he has to find “name” after it, and has to end with ; .<br>But we don’t wanna expand the entity, we wanna declarean entity inside another entity, that’s why we put &amp;#x25; instead of % and after expanding the &amp;#x25; will be %.<br>And this is also the reason why we write &amp;#x26;#x25; It’s just a double encoding of % character.</p><blockquote><strong>Why do you define an entity evalWhy just create error entity only?</strong></blockquote><p>If you understand the previous answer, you may know why.<br>When you are declaring an external parameter entity, <br>for example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*7-zxTFxsUNXe-YnEX6r9NA.png" /></figure><p>The entity inside the quote will not be referenced.<br>But when we declare an internal parameter entity, it will be referenced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*ooW9MAd4xzEkh3vIhTYt4Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70f22d75d0fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab: SSRF with whitelist-based input filter (writeups)]]></title>
            <link>https://youssef-nini.medium.com/lab-ssrf-with-whitelist-based-input-filter-writeups-5de4f8b79ee6?source=rss-bcbe8132f26c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de4f8b79ee6</guid>
            <category><![CDATA[ssrf]]></category>
            <category><![CDATA[info-sec-writeups]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[portswigger-lab]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[</Y55F>]]></dc:creator>
            <pubDate>Mon, 19 Jan 2026 10:52:27 GMT</pubDate>
            <atom:updated>2026-03-05T16:31:45.184Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This write-up provides a step-by-step solution for “</em><strong><em>the </em>SSRF with whitelist-based input filter” </strong>Lab.</p><blockquote><strong>What is SSRF <em>(server-side request forgery)?</em></strong></blockquote><p>SSRF is a web security vulnerability that exists on the server-side, allowing an attacker to cause the application to request data from an unintended location, potentially leading to unauthorized access, data exposure, system compromise, and remote code execution.</p><blockquote><strong>What do we have to do to solve the lab?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*HU1srEKatU8_XpTYCOhZ8w.png" /></figure><blockquote>To solve the lab, change the stock check URL to access the admin interface at http://localhost/admin and delete the user carlos.</blockquote><p><strong>&gt; They told us where the vulnerability exists:</strong></p><p><em>“This lab has a stock check feature which fetches data from an internal system.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*TSGXiz1pqBfySzJkjEpOog.jpeg" /></figure><p><strong>I intercept the request of the Check Stock button.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*ABcMLZZQJJJgw_5lACr5mw.png" /></figure><blockquote>URL decode of <strong>stockApi</strong>:</blockquote><pre>stockApi=<br>http://stock.weliketoshop.net:8080/product/stock/check?productId=2&amp;storeId=1</pre><p><strong>I try to change the </strong>stockApi<strong>to</strong> localhost/admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rj_owAv3z4_74SpIcY7Cdw.png" /></figure><p>The response gives me a Bad Request, because the “stock check host must be stock.weliketoshop.net”.</p><p><strong>Then I read this on PortSwigger.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwHf5b3wsWEmq4EjeDrxoQ.png" /></figure><p><strong>What does </strong><strong>@ and </strong><strong># mean in the URL?</strong></p><p><strong>first the </strong><strong>@ character.</strong></p><blockquote>In a URL, @ separates <strong>credentials</strong> from the <strong>hostname</strong>. The general (simplified) structure is: scheme://username:password@hostname/path</blockquote><p><strong>So when you see this:</strong></p><p><a href="https://expected-host:fakepassword@evil-host/">https://expected-host:fakepassword@evil-host</a></p><p><strong>Your browser reads it like this:</strong></p><ul><li>expected-host → <strong>username</strong></li><li>fakepassword → <strong>password</strong></li><li>evil-host → <strong>actual host that will be contacted</strong></li></ul><p><strong>Now the </strong><strong># character.</strong></p><blockquote># marks a <strong>URL fragment</strong>. Fragments are used client-side only (for example, jumping to a section in a page).</blockquote><p><strong>So this URL:</strong></p><p><a href="https://evil-host/#expected-host">https://evil-host#expected-host</a></p><p><strong>What happens?</strong></p><ul><li>Browser connects to: evil-host</li><li>Fragment: expected-host (used only by the browser, never sent in the HTTP request)</li></ul><p><strong>Now I will try to change the </strong>stockApi<strong> to </strong>localhost@expected-host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQCt4e5vvSWXRFArx1wwVQ.png" /></figure><p>It didn’t block us, because the actual URL is after @</p><p><strong>Change the </strong>stockApi<strong> to </strong>localhost#@expected-host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKnzKCHdDqF3eEqNx4Fo_w.png" /></figure><p>It blocks us, because the actual URL is before #</p><ul><li>What if we try to encode # (URL encoding) two times.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NaAyjYkHzhe5ZcEg4jKpjQ.png" /></figure><p><em>It works!</em></p><p><strong>But why?</strong></p><blockquote>What happens is that the filter that checks the input decodes it one time.</blockquote><blockquote>When it decodes, it sees thislocalhost%23@expected-host , and when it sees this, it thinks that the host is after @</blockquote><blockquote>Next, the app decodes it one more time, and it gets this localhost#@expected-host</blockquote><p><strong>Now that we know how to bypass the filter, we will delete Carlos&#39;s user to solve the challenge.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jwmj8S4A-P7tHaEm2LA86g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_r_3e7lCsb-7K0J7gGJXg.png" /></figure><p><strong>I write a script that solves the challenge.</strong></p><pre>import sys<br>import requests<br><br>if len(sys.argv) != 2:<br>    print(f&quot;(+) Usage: {sys.argv[0]}  &lt;url&gt;&quot;)<br>    exit()<br><br>check_stock_path = &#39;/product/stock&#39;<br>url = sys.argv[1]<br>delete_carlos_ssrf_payload = &#39;http://localhost%23@stock.weliketoshop.net/admin/delete?username=carlos&#39;<br>params = {&#39;stockApi&#39; : delete_carlos_ssrf_payload}<br><br>print(&#39;(+) Deleting Carlos User...&#39;)<br>r = requests.post(url + check_stock_path, data=params)<br><br>admin_page_ssrf_payload = &#39;http://localhost%23@stock.weliketoshop.net/admin&#39;<br>params2 = {&#39;stockApi&#39; : admin_page_ssrf_payload}<br>r = requests.post(url + check_stock_path, data=params2)<br><br>if &#39;carlos&#39; not in r.text.lower():<br>    print(&#39;(+) Successfully deleted Carlos user!&#39;)<br>else:<br>    print(&#39;(-) Exploit was unsuccessfully&#39;)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de4f8b79ee6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>