<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>YesYouKen’s MetaNest</title>
        <link>https://yesyouken.space/</link>
        <description>yesyouken.space</description>
        <lastBuildDate>Fri, 27 Mar 2026 06:46:33 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en-US</language>
        <copyright>All rights reserved 2026, YesYouKen</copyright>
        <item>
            <title><![CDATA[Extracting binary from other images Vs installing from scratch]]></title>
            <link>https://yesyouken.space/article/docker-binaries-from-other-images</link>
            <guid>https://yesyouken.space/article/docker-binaries-from-other-images</guid>
            <pubDate>Wed, 11 Feb 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[Extracting binary from other images Vs installing from scratch]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30473dadb62e80cbad67f25f362309e8"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-2112adc938e5450097721dcd267c47b5" data-id="2112adc938e5450097721dcd267c47b5"><span><div id="2112adc938e5450097721dcd267c47b5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2112adc938e5450097721dcd267c47b5" title="Benefits"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Benefits</span></span></h4><ul class="notion-list notion-list-disc notion-block-582997ea108e4318a4bf10f6d655eec8"><li>Faster builds since I am not compiling or installing packages myself.</li></ul><ul class="notion-list notion-list-disc notion-block-1623990ee1474d29946495d3ca89d3d3"><li>Smaller final image because I can keep the runtime stage minimal and avoid bundling build tools.</li></ul><ul class="notion-list notion-list-disc notion-block-e495c81a9e884a06b87d9e66e1edc09d"><li>More predictable and reproducible results when the source image is pinned by digest.</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-f69f9f561bcb405496d38a92922c7381" data-id="f69f9f561bcb405496d38a92922c7381"><span><div id="f69f9f561bcb405496d38a92922c7381" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f69f9f561bcb405496d38a92922c7381" title="Shortcomings"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Shortcomings</span></span></h4><ul class="notion-list notion-list-disc notion-block-fc02a0833e0f4a7c85dbe54db389c4f9"><li>Compatibility can break, especially when mixing binaries from Alpine (musl) with a Debian or distroless runtime (glibc).</li></ul><ul class="notion-list notion-list-disc notion-block-28bfa2c483bf49bb9457af0f5118ff23"><li>Hidden runtime dependencies can be missing in the final image, such as shared libraries, CA certificates, timezone data, or small utilities.</li></ul><ul class="notion-list notion-list-disc notion-block-aa74960f3d874dae9c2ebce45051e30f"><li>Security updates are easier to miss because I need to track patches in the source images I copy from, not only the final base image.</li></ul><ul class="notion-list notion-list-disc notion-block-56852ed3b6fc404ab82a9bfaabedd5e9"><li>Provenance is less explicit, which can make auditing and debugging harder.</li></ul><ul class="notion-list notion-list-disc notion-block-b9ab0b7d7ef74a8d84d04c0cee89392a"><li>Licensing and notice files can be overlooked when copying only a single binary.</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-30473dadb62e805d9284d8cc6eb4eb2d" data-id="30473dadb62e805d9284d8cc6eb4eb2d"><span><div id="30473dadb62e805d9284d8cc6eb4eb2d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30473dadb62e805d9284d8cc6eb4eb2d" title="Requirements "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Requirements </span></span></h4><ul class="notion-list notion-list-disc notion-block-30473dadb62e8025a954ef2c0b8b7c6d"><li>Only works with self-contained binary, binaries with statically linked libraries would require more effort</li></ul><div class="notion-blank notion-block-30473dadb62e80be9a3bffa22aebf542"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An AI friendly numbering system]]></title>
            <link>https://yesyouken.space/article/25673dad-b62e-8063-9ad7-cd2d832847f8</link>
            <guid>https://yesyouken.space/article/25673dad-b62e-8063-9ad7-cd2d832847f8</guid>
            <pubDate>Thu, 21 Aug 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-25673dadb62e80639ad7cd2d832847f8"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-25673dadb62e8037a4d2d97811329cf4">You know how Generative Artificial Intelligence (GAI) could still make mistakes in float numbers?</div><div class="notion-text notion-block-25673dadb62e80d18fcce20fd9b53506">For example, it could still think that 1.11 ≥ 1.2, this is because. it interpreted 1.11 as 1 and 11 and compares them with 1 and 2. </div><div class="notion-text notion-block-25673dadb62e80d4b3fcf4f5b7cddeb5">I am sure you have seen this on a LinkedIn post or X post, and using this as grounds to claim that GAI is not ready yet or cannot “replace” humans. I don’t care enough to dispute them. But it made me think, what if the GAI is right? Our numbering representation is the one that is flawed?</div><div class="notion-blank notion-block-25673dadb62e8029ad78d8410165c997"> </div><div class="notion-text notion-block-25673dadb62e800896b5cb4af5430ca2">Why can’t 1.11 ≥ 1.2? If it is using IP address semantics, it is! Why can’t we also do that? every decimal point is a separator of 3 digits, for example:</div><div class="notion-text notion-block-25673dadb62e801aa0eddeebbc14fbbd">This actually looks much cleaner. </div><div class="notion-text notion-block-25673dadb62e80bda2bbce1f642b664e">This is probably not a new idea but I just wanted to write my thoughts down :)</div><div class="notion-blank notion-block-25673dadb62e80a1a6a4ecb8af6d6d97"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to output OpenApiV2/swagger in snake case with grpc-gateway?]]></title>
            <link>https://yesyouken.space/article/grpc-gateway-snake-case</link>
            <guid>https://yesyouken.space/article/grpc-gateway-snake-case</guid>
            <pubDate>Tue, 15 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[How to output OpenApiV2/swagger in snake case with grpc-gateway?]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-1d573dadb62e80fbb729d15dfc1ea0fb"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1d573dadb62e806a8aa1fb9ba5b0a274" data-id="1d573dadb62e806a8aa1fb9ba5b0a274"><span><div id="1d573dadb62e806a8aa1fb9ba5b0a274" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d573dadb62e806a8aa1fb9ba5b0a274" title="How to output OpenApiV2 /swagger with grpc-ecosysytem/grpc-gateway"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">How to output OpenApiV2 /swagger with grpc-ecosysytem/grpc-gateway</span></span></h2><div class="notion-text notion-block-1d573dadb62e8027ad97e7be00f03e18">The grpc-gateway OpenApi V2 (swagger) generator generates in the fields in camelCase by default (<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://grpc-ecosystem.github.io/grpc-gateway/docs/development/grpc-gateway_v2_migration_guide/#we-now-use-the-camelcase-json-names-by-default">ref</a>)</div><div class="notion-text notion-block-1d573dadb62e80f3922acf9fb0e55eb6">To generate in snake case if the field names are already written in snake case in the proto files. </div><div class="notion-text notion-block-84c04bf9c7ca4c10938b66a8c09f0d95">Else this would just use the proto names for field names in whatever case they are already in.</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pintu CTF 2024]]></title>
            <link>https://yesyouken.space/article/ctf-pintu-2024</link>
            <guid>https://yesyouken.space/article/ctf-pintu-2024</guid>
            <pubDate>Thu, 13 Feb 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-bc3148ef9f5d43aea39faef069e6800e"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-table-of-contents notion-gray notion-block-9f889a7f0f4345d1b860ed4d95170894"><a href="#b911ce66998948bd9c49ab7ae7926f6a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Pintu CTF 2024</span></a><a href="#4702fc2df612465db60a7ccd15f84d8b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">1. Welcome - 10</span></a><a href="#19873dadb62e802ea35fc5e1e4feb272" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">2. Path to the Flag - 100</span></a><a href="#19873dadb62e80a9901ef16a49eba47a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">2.1 Journey </span></a><a href="#19873dadb62e80379345ef5235df39f6" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">2.2 TLDR - Directory Traversal </span></a><a href="#ff328cada9e241df9e25b555c19e9c91" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">3. IP Checker - Username - 100</span></a><a href="#50068c74800c4b15b06e7ddc7295cdfe" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">3.1 Journey </span></a><a href="#14cdb33ad5bc4da98f6076baa687be17" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">3.2 Solution  </span></a><a href="#c747b06941594e3d86ee4e75585de370" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">3.3 TLDR - .git Exposure Vulnerability</span></a><a href="#83b066fe74084ee8b5cff8f902b8c153" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">4. IP Checker - Password - 100</span></a><a href="#19873dadb62e800780e4fbc34f36c3b8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">4.1 Journey</span></a><a href="#19873dadb62e802099d5e574c03725c1" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">5. Login - 100</span></a><a href="#19873dadb62e80f098abd329a1fe8c16" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">6. Juicy Injection - Squeeze the Query - 200</span></a><a href="#19873dadb62e805786dce02d23c2e858" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">6.1 Journey</span></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b911ce66998948bd9c49ab7ae7926f6a" data-id="b911ce66998948bd9c49ab7ae7926f6a"><span><div id="b911ce66998948bd9c49ab7ae7926f6a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b911ce66998948bd9c49ab7ae7926f6a" title="Pintu CTF 2024"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Pintu CTF 2024</span></span></h2><div class="notion-text notion-block-80fc3e42bdd345f4a9c8ac093ae1f510">This is my first time participating in a CTF (short for “Capture the flag”). I never knew it could be so much fun! Got to give a huge thanks to the Pintu’s cybersecurity team for the exposure and introduction!</div><div class="notion-callout notion-gray_background_co notion-block-491f22a246824b459db9ec32b1f813da"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-ca5d2361d1d949158c21dbdb37cfe7e0">Readers’ guide</div><div class="notion-text notion-block-fada7c28deb645a7b1faaa3d6e1a8542">Every primary header after this was a challenge. Each challenge writings are divided into 3 sub headers: </div><ul class="notion-list notion-list-disc notion-block-423a813c458d4e44b84f4e7fa367b406"><li>Journey — Just some blabbering on how I arrived at the solution, and of course I did not talk about the little <s>crazy amount of googling</s> web searches I did</li></ul><ul class="notion-list notion-list-disc notion-block-19873dadb62e804b8fb1d3132d8b4847"><li>Solution — some shell commands, code used to solve the challenge</li></ul><ul class="notion-list notion-list-disc notion-block-768dbc992384411a9a7eef56677b551e"><li>TLDR — Well if you want to skip to what the challenge is actually about, the sauce and maybe some of my thoughts</li></ul></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-4702fc2df612465db60a7ccd15f84d8b" data-id="4702fc2df612465db60a7ccd15f84d8b"><span><div id="4702fc2df612465db60a7ccd15f84d8b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4702fc2df612465db60a7ccd15f84d8b" title="1. Welcome - 10"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. Welcome - 10</span></span></h2><details class="notion-toggle notion-block-19873dadb62e8058ae71fa07e508a95c"><summary>Excerpt</summary><div><blockquote class="notion-quote notion-block-19873dadb62e80049355e701204bf6a0"><div>Welcome to Pintu CTF - Genesis Edition <em>(The Beginning)</em></div><div class="notion-text notion-block-4b1de1c75f7442f49da4efdffc335a6c">A terminal screen flickers to life with a simple challenge: &quot;What is the MD5 hash of the word &#x27;admin&#x27;?</div><div class="notion-text notion-block-d6488a9e9ee7468ca0f1bb1a58b6adcd">Prove your readiness by submitting the answer in the format:</div></blockquote></div></details><div class="notion-text notion-block-19873dadb62e80a1938eda73e60df73e">This challenge was simple just to make sure the audience is at the right place. Merely asking for a md5 hash of a word, easily achievable with online tools.</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-19873dadb62e802ea35fc5e1e4feb272" data-id="19873dadb62e802ea35fc5e1e4feb272"><span><div id="19873dadb62e802ea35fc5e1e4feb272" class="notion-header-anchor"></div><a class="notion-hash-link" href="#19873dadb62e802ea35fc5e1e4feb272" title="2. Path to the Flag - 100"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. Path to the Flag - 100</span></span></h2><details class="notion-toggle notion-block-19873dadb62e80a9901ef16a49eba47a"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-19873dadb62e80a9901ef16a49eba47a" data-id="19873dadb62e80a9901ef16a49eba47a"><span><div id="19873dadb62e80a9901ef16a49eba47a" class="notion-header-anchor"></div><span class="notion-h-title">2.1 Journey </span></span></h3></summary><div><details class="notion-toggle notion-block-19873dadb62e80eaa0e8c8805523d2c4"><summary>Excerpt</summary><div><blockquote class="notion-quote notion-block-19873dadb62e8034ad9fff0bf746d03e"><div>You’ve stumbled upon a mysterious server that holds the key to the challenge. A cryptic message reveals that the flag is hidden inside <code class="notion-inline-code">/home/flag.txt</code>. However, direct access seems impossible, and the application’s <code class="notion-inline-code">file</code> parameter might be the only way in.</div><div class="notion-text notion-block-68404230afdb42e1acc006f121011ed7">Can you exploit the path to uncover the flag?</div></blockquote></div></details><div class="notion-text notion-block-19873dadb62e80219d7deb1f979f6a49">A url links to server which returns the following message</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-19873dadb62e800781abcb5acac763ae"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A9f4f9380-2fce-4fcc-b6b8-b4ffdad8de48%3Aimage.png?table=block&amp;id=19873dad-b62e-8007-81ab-cb5acac763ae&amp;t=19873dad-b62e-8007-81ab-cb5acac763ae" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-19873dadb62e80b0a9f5cfecf17a5e1a">At first i just tried <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://100.109.132.8:8081/?file=/home/flag.txt">http://hostname?file=/home/flag.txt</a></code> , can’t be that easy right? I got </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-19873dadb62e80279fbada86fa985278"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ad4b83327-363b-4891-8214-89101fe5f433%3Aimage.png?table=block&amp;id=19873dad-b62e-8027-9fba-da86fa985278&amp;t=19873dad-b62e-8027-9fba-da86fa985278" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-19873dadb62e80ba9a79cba0e1df5e44">Recalling what i read before starting this challenge about directory traversal →  <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ctf101.org/web-exploitation/directory-traversal/what-is-directory-traversal/">https://ctf101.org/web-exploitation/directory-traversal/what-is-directory-traversal/</a> </div><div class="notion-text notion-block-19873dadb62e802595dde882b05bcb08">Tried  <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://100.109.132.8:8081/?file=/home/flag.txt">http://hostname?file=../../home/flag.txt</a></code> . Voila!</div></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-19873dadb62e80379345ef5235df39f6" data-id="19873dadb62e80379345ef5235df39f6"><span><div id="19873dadb62e80379345ef5235df39f6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#19873dadb62e80379345ef5235df39f6" title="2.2 TLDR - Directory Traversal "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 TLDR - <code class="notion-inline-code">Directory Traversal</code> </span></span></h3><div class="notion-text notion-block-19873dadb62e8040abeff3eb127b85b3">Best explained in CTF101 Handbook</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-ba2be40581d4495282a8c97b77de1fe7" href="https://ctf101.org/web-exploitation/directory-traversal/what-is-directory-traversal/"><div><div class="notion-bookmark-title">Directory Traversal - CTF Handbook</div><div class="notion-bookmark-description">Capture the Flag Competition Wiki</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://www.notion.so/image/https%3A%2F%2Fctf101.org%2Fimages%2Ffavicon%2Ffavicon.ico?table=block&amp;id=ba2be405-81d4-4952-82a8-c97b77de1fe7&amp;t=ba2be405-81d4-4952-82a8-c97b77de1fe7" alt="Directory Traversal - CTF Handbook" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://ctf101.org/web-exploitation/directory-traversal/what-is-directory-traversal/</div></div></div></a></div><div class="notion-text notion-block-19873dadb62e80b28c7edd4003ed36f2">This vulnerability can happen in any application that uses user input in directory path. This could be common with any form of file access or even traversing in s3 buckets. A team could want to save a database query and uses user input to directly navigate to the file — without sanitising the inputs user could navigate the file storage.</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-ff328cada9e241df9e25b555c19e9c91" data-id="ff328cada9e241df9e25b555c19e9c91"><span><div id="ff328cada9e241df9e25b555c19e9c91" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ff328cada9e241df9e25b555c19e9c91" title="3. IP Checker - Username - 100"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. IP Checker - Username - 100</span></span></h2><details class="notion-toggle notion-block-50068c74800c4b15b06e7ddc7295cdfe"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-50068c74800c4b15b06e7ddc7295cdfe" data-id="50068c74800c4b15b06e7ddc7295cdfe"><span><div id="50068c74800c4b15b06e7ddc7295cdfe" class="notion-header-anchor"></div><span class="notion-h-title">3.1 Journey </span></span></h3></summary><div><details class="notion-toggle notion-block-19873dadb62e802a8f23f5a509d1df8f"><summary>Excerpt</summary><div><blockquote class="notion-quote notion-block-20d38f12186d486abcad4a1b3d4206a8"><div>Alex was conducting information gathering on the IP Checker challenge when he discovered that solving it would require a username at some point.</div></blockquote><blockquote class="notion-quote notion-block-ba266d8e28454dc886420fc9ca14169e"><div>From past experience, Alex knew that developers sometimes fail to deploy applications securely, which can inadvertently expose the source code.</div></blockquote><blockquote class="notion-quote notion-block-4f357dd9eba8496ab94432573f4edd56"><div>Your goal is to find the hidden username.</div></blockquote></div></details><div class="notion-text notion-block-8a23aa32adad484ea2ebfb6bc32aec7b">This challenge provides a url that links to this web app. It does not really do anything and it is buggy. </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-40d4a56404e94a9ab3e2459f915ae19f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A3f82ce72-4568-46f8-bc8d-84afed1f62a1%3Aimage.png?table=block&amp;id=40d4a564-04e9-4a9a-b3e2-459f915ae19f&amp;t=40d4a564-04e9-4a9a-b3e2-459f915ae19f" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-a5b1422c4a6940cd8452556f345eb054">I had to reveal the hint to move on… as I really didn’t know what to do. </div><blockquote class="notion-quote notion-block-da2bdbdcc92c4e2f9acdcff80bef682d"><div>Merge and Conflict :D , the tools has default hidden directory.
Can you dump and read the username?</div></blockquote><div class="notion-text notion-block-2312188c26cf43fb9b8bc52fc07a055d">With this hint I immediately tried <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://hostname/.git">http://hostname/.git</a></code> and it revealed the following directory listing.</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a5876b9929d2496f8e50bf9110faf00d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:136.98863220214844px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A7ce3b2f7-6f8c-475a-b4e7-77f3cb939f74%3Aimage.png?table=block&amp;id=a5876b99-29d2-496f-8e50-bf9110faf00d&amp;t=a5876b99-29d2-496f-8e50-bf9110faf00d" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-c2a12b858c4c415ca3add139f8b79d4d">Downloading the <code class="notion-inline-code">.git</code> folder and running <code class="notion-inline-code">git status</code> showed us that there are local changes to delete <code class="notion-inline-code">username.go.bak</code> we just had to do a <code class="notion-inline-code">git checkout</code>  to revert the delete and job done!</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-bb54c735048a49829fb7b44728718233"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:331.97442626953125px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aa16dbe52-5a9e-4edf-a3a5-620fcbd901fd%3Aimage.png?table=block&amp;id=bb54c735-048a-4982-9fb7-b44728718233&amp;t=bb54c735-048a-4982-9fb7-b44728718233" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><details class="notion-toggle notion-block-14cdb33ad5bc4da98f6076baa687be17"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-14cdb33ad5bc4da98f6076baa687be17" data-id="14cdb33ad5bc4da98f6076baa687be17"><span><div id="14cdb33ad5bc4da98f6076baa687be17" class="notion-header-anchor"></div><span class="notion-h-title">3.2 Solution  </span></span></h3></summary><div><ol start="1" class="notion-list notion-list-numbered notion-block-b76feb444acc421b8e1e4f32719113d6" style="list-style-type:decimal"><li><code class="notion-inline-code">wget -mpEk -np robots=off --random-wait </code><code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://100.109.132.8:9494/.git">http://100.109.132.8:9494/.git</a></code><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://100.109.132.8:9494/.git"> </a></li><ol class="notion-list notion-list-numbered notion-block-b76feb444acc421b8e1e4f32719113d6" style="list-style-type:lower-alpha"><div class="notion-text notion-block-d1b06a310df64927b7fe00b26f0081dd">This wget command recursively downloads the entire <code class="notion-inline-code">.git</code> see more at<a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://100.109.132.8:9494/.git"> </a><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://explainshell.com/explain?cmd=wget+-mpEk+-np+robots%3Doff+--random-wait+http%3A%2F%2F100.109.132.8%3A9494%2F.git">explain shell</a></div></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-879a407ab1e34334be99b09f86afd273" style="list-style-type:decimal"><li><code class="notion-inline-code">cd 100.109.132.8:9494 &amp;&amp; git checkout .</code> </li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-7ce2b3e6b9f9402cba3394f2cc7fe3a1" style="list-style-type:decimal"><li>There is a file <code class="notion-inline-code">username.go.bak</code> and rename the file by removing <code class="notion-inline-code">.bak</code></li><ol class="notion-list notion-list-numbered notion-block-7ce2b3e6b9f9402cba3394f2cc7fe3a1" style="list-style-type:lower-alpha"></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-358a5ac20d7b4510bcf835d39b8969a0" style="list-style-type:decimal"><li>Just have to add the following lines </li><ol class="notion-list notion-list-numbered notion-block-358a5ac20d7b4510bcf835d39b8969a0" style="list-style-type:lower-alpha"></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-212583c82b864ebf8481e5c8da1ffe0f" style="list-style-type:decimal"><li><code class="notion-inline-code">go run username.go</code></li></ol></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-c747b06941594e3d86ee4e75585de370" data-id="c747b06941594e3d86ee4e75585de370"><span><div id="c747b06941594e3d86ee4e75585de370" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c747b06941594e3d86ee4e75585de370" title="3.3 TLDR - .git Exposure Vulnerability"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.3 TLDR - <code class="notion-inline-code">.git Exposure Vulnerability</code></span></span></h3><div class="notion-text notion-block-2fcf23ab27cc445d8f95573e039bc525">This is a case of deploying <code class="notion-inline-code">.git</code> folder along with the web app. With the <code class="notion-inline-code">.git</code> folder we could have the entire history of the source code, depending on the clone depth. I found this guy who does scans for exposed <code class="notion-inline-code">.git</code> on websites on a global scale (<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://smitka.me/open-git/">https://smitka.me/open-git/</a>). They also shared ways to prevent. </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-83b066fe74084ee8b5cff8f902b8c153" data-id="83b066fe74084ee8b5cff8f902b8c153"><span><div id="83b066fe74084ee8b5cff8f902b8c153" class="notion-header-anchor"></div><a class="notion-hash-link" href="#83b066fe74084ee8b5cff8f902b8c153" title="4. IP Checker - Password - 100"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. IP Checker - Password - 100</span></span></h2><details class="notion-toggle notion-block-19873dadb62e800780e4fbc34f36c3b8"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-19873dadb62e800780e4fbc34f36c3b8" data-id="19873dadb62e800780e4fbc34f36c3b8"><span><div id="19873dadb62e800780e4fbc34f36c3b8" class="notion-header-anchor"></div><span class="notion-h-title">4.1 Journey</span></span></h3></summary><div><details class="notion-toggle notion-block-19873dadb62e801fa922db3c2d671072"><summary>Excerpt</summary><div><blockquote class="notion-quote notion-block-19873dadb62e80868f25e1d713cf6e8d"><div>Alex was conducting information gathering on the IP Checker challenge when he discovered that solving it would require a password at some point.</div><div class="notion-text notion-block-c3895fb3ec13434b812034e6deabeec2">From past experience, Alex knew that developers sometimes fail to deploy applications securely, which can inadvertently expose the source code.</div><div class="notion-text notion-block-26c14c92520b41cc89326dd298d091ed">At first glance, Alex didn&#x27;t notice anything unusual about the application. However, he soon realized that the things related to the image hold valuable information.</div><div class="notion-text notion-block-da59129ec883437d830b4c33153e9c66">Unfortunately the valueable information can&#x27;t be read. Can you read the password?</div></blockquote></div></details><div class="notion-text notion-block-19873dadb62e80a9a077d9b20ee3fef3">The image was hosted on a s3 bucket → <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ptu-ctf.s3.ap-southeast-1.amazonaws.com/pintu-banner.jpg">https://ptu-ctf.s3.ap-southeast-1.amazonaws.com/pintu-banner.jpg</a> . Accessing <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ptu-ctf.s3.ap-southeast-1.amazonaws.com/">https://ptu-ctf.s3.ap-southeast-1.amazonaws.com/</a> revealed a list of items hosted on the s3 bucket.</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-19873dadb62e80689c82fcf303d6b32a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A41171d71-ed75-43f1-b7b7-80823c6aafef%3Aimage.png?table=block&amp;id=19873dad-b62e-8068-9c82-fcf303d6b32a&amp;t=19873dad-b62e-8068-9c82-fcf303d6b32a" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-19873dadb62e804a88f1c07366b0a0f6">One of them is <code class="notion-inline-code">password.txt</code></div><div class="notion-text notion-block-19873dadb62e80e1b74bfb1a339467a1">TODO: Not completed</div><div class="notion-blank notion-block-19873dadb62e808180e0c4a898e4a175"> </div></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-19873dadb62e802099d5e574c03725c1" data-id="19873dadb62e802099d5e574c03725c1"><span><div id="19873dadb62e802099d5e574c03725c1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#19873dadb62e802099d5e574c03725c1" title="5. Login - 100"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">5. Login - 100</span></span></h2><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-19873dadb62e80f098abd329a1fe8c16" data-id="19873dadb62e80f098abd329a1fe8c16"><span><div id="19873dadb62e80f098abd329a1fe8c16" class="notion-header-anchor"></div><a class="notion-hash-link" href="#19873dadb62e80f098abd329a1fe8c16" title="6. Juicy Injection - Squeeze the Query - 200"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">6. Juicy Injection - Squeeze the Query - 200</span></span></h2><details class="notion-toggle notion-block-19873dadb62e805786dce02d23c2e858"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-19873dadb62e805786dce02d23c2e858" data-id="19873dadb62e805786dce02d23c2e858"><span><div id="19873dadb62e805786dce02d23c2e858" class="notion-header-anchor"></div><span class="notion-h-title">6.1 Journey</span></span></h3></summary><div><details class="notion-toggle notion-block-19873dadb62e80b99343e39cd85c663c"><summary>Excerpt</summary><div><blockquote class="notion-quote notion-block-19873dadb62e80d0a1c3dc7e3b0b6126"><div>Welcome to the <b>Juice Market</b>, where every juice bottle is identified by a unique ID. However, a critical flaw in the <code class="notion-inline-code">/juice/:id</code> endpoint allows an attacker to manipulate the database through unsanitized user input. To make matters worse, the <code class="notion-inline-code">/ping</code> endpoint shows the server is alive, providing an extra clue.</div><div class="notion-text notion-block-24dfb07199a549f9acd9b8c065d3ac65">Your task:</div><div class="notion-text notion-block-510b89940d894795af5cac52415a169b">Exploit the vulnerability in the query, retrieve the secret flag hidden in the database, and show the Juice Market who&#x27;s boss!</div></blockquote></div></details></div></details><div class="notion-blank notion-block-19873dadb62e8043aafac3817122fa28"> </div><div class="notion-blank notion-block-830b3cd9ece74f359ede7863b42f9038"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethernaut Walkthrough - Part 1]]></title>
            <link>https://yesyouken.space/article/ethernaut-walkthrough-1</link>
            <guid>https://yesyouken.space/article/ethernaut-walkthrough-1</guid>
            <pubDate>Fri, 21 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[A walkthrough for Ethernaut - Hello Ethernaut, Fallback, Fallout, Coin Flip]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-f587c0234e4b40ee9b94d38b4f9e13dc"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-aa03a14183284861bbb00dde53d25a2f">Hello I am YesYouKen, this is my first time writing a walkthrough and I am just going to write as things come. Enjoy! And, I hope this helps!</div><div class="notion-text notion-block-30d98e5ca0554f48b1c0a31bc7f7f8eb">Each level gets its own section and I will talk about how I get to the answer but if you want to go to the hint or the answer they are at the end of each section.</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f0e3f42009f5421392af41754df74582" data-id="f0e3f42009f5421392af41754df74582"><span><div id="f0e3f42009f5421392af41754df74582" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f0e3f42009f5421392af41754df74582" title="Levels "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Levels </span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a4906a80772e4547af5894af3b1f1b72" data-id="a4906a80772e4547af5894af3b1f1b72"><span><div id="a4906a80772e4547af5894af3b1f1b72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a4906a80772e4547af5894af3b1f1b72" title="1. Hello Ethernaut "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. Hello Ethernaut </span></span></h3><div class="notion-text notion-block-b44ae5c737a84879b8bdf7179a6df254">This one is easy. Just got to go through everything.</div><div class="notion-text notion-block-a8c46dfb7ca546a79b6c3bf5ad180584">Take a longer look at the <code class="notion-inline-code">contract</code> object to see if anything shouts password</div><details class="notion-toggle notion-block-ae468755b7e244529147f3c2921b50c8"><summary>Solution on how to get the password</summary><div><div class="notion-text notion-block-218cff1f78e54d8680f2fc283db758e1"><code class="notion-inline-code">contract.password()</code></div></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1382898c55604b79bba0c21a1f910a24" data-id="1382898c55604b79bba0c21a1f910a24"><span><div id="1382898c55604b79bba0c21a1f910a24" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1382898c55604b79bba0c21a1f910a24" title="2. Fallback "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. Fallback </span></span></h3><div class="notion-text notion-block-0b7dd721f26e44038a9d22322edf54e6">Our goal is to call <code class="notion-inline-code">contract.withdraw</code> to get all the balance in the smart contract account</div><ol start="1" class="notion-list notion-list-numbered notion-block-d387a935aa4d44aeaf2f22c1a094ac90" style="list-style-type:decimal"><li>Notice the <code class="notion-inline-code">onlyOwner</code> modifier</li><ol class="notion-list notion-list-numbered notion-block-d387a935aa4d44aeaf2f22c1a094ac90" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-8ce3caae467f44b296ec51dbf390f9ab"><li>it prevents anyone other than the owner from calling <code class="notion-inline-code">contract.withdraw</code></li></ul><ul class="notion-list notion-list-disc notion-block-8baf281d0b5e49d48cb13d8ad8db9ae4"><li>this is where I found out more about modifiers <a target="_blank" rel="noopener noreferrer" class="notion-link" href="notion://www.notion.so/yesyouken/YesYouKen-s-NetNest-2bc441628505497c817cfc277e30bf81?p=f587c0234e4b40ee9b94d38b4f9e13dc&amp;pm=s#References">What are solidity modifiers?</a></li></ul></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-ffff2f4d35014346bd07abec304765d0" style="list-style-type:decimal"><li>There are two lines in the smart contract that allows us to change the owner of the smart contract with the following line
<code class="notion-inline-code">owner = msg.sender;</code></li><ol class="notion-list notion-list-numbered notion-block-ffff2f4d35014346bd07abec304765d0" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-8fdc21bd79e14cc885f21e2bbfa41cc6"><li>in <code class="notion-inline-code">contribute</code> and <code class="notion-inline-code">receive</code></li></ul></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-2801d01b18f64100aa296f60df109ad4" style="list-style-type:decimal"><li>Notice that <code class="notion-inline-code">receive</code> looks a little different from other function. Did some research and found out that <code class="notion-inline-code">receive() external payable</code> is a fallback function that is called &quot;if Ether are sent to the contract and no calldata are provided&quot; </li><ol class="notion-list notion-list-numbered notion-block-2801d01b18f64100aa296f60df109ad4" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-15cd2e27486d454da95a4a3a829c2794"><li></li></ul></ol></ol><div class="notion-text notion-block-04a4808e626a43348ac88306cd375ae5">There are two possible solutions</div><details class="notion-toggle notion-block-517fc3aa3b0f4fbe821a5e96516131f9"><summary>Solution A</summary><div></div></details><details class="notion-toggle notion-block-01a27fef7866424c98f5be6a13511644"><summary>Solution B</summary><div></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-9ecbb8e2c9da4097b70aa15cac9c3d5c" data-id="9ecbb8e2c9da4097b70aa15cac9c3d5c"><span><div id="9ecbb8e2c9da4097b70aa15cac9c3d5c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9ecbb8e2c9da4097b70aa15cac9c3d5c" title="3. Fallout "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. Fallout </span></span></h3><div class="notion-text notion-block-1864d1f8c91c4f1ea6a9f19f6ea74af2">Once again, same goal become the owner of the contract.</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-a41005fe3ca64de4a136c1b18f5a5075" data-id="a41005fe3ca64de4a136c1b18f5a5075"><span><div id="a41005fe3ca64de4a136c1b18f5a5075" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a41005fe3ca64de4a136c1b18f5a5075" title="Solution"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Solution</span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-9b1ccc535b02402db1ad582d966cf0f8" style="list-style-type:decimal"><li>Notice that there is only one function that allows change of <code class="notion-inline-code">owner</code> which is <code class="notion-inline-code">Fallout</code></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-9e10cb528d504692b2442c92d9afe5ba" style="list-style-type:decimal"><li>Tries to call <code class="notion-inline-code">contract.Fallout</code> but realised it is undefined.</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-43c453885bfa47eab6ed11439fffc993" style="list-style-type:decimal"><li>then notice the typo it is actually <code class="notion-inline-code">Fal1out</code> , the second <code class="notion-inline-code">l</code> is actually a <code class="notion-inline-code">1</code></li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1bab28cf3c9743f385c2ac0178a54036" style="list-style-type:decimal"><li>Just execute the following in the browser console and you will become the owner</li></ol><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-f029e2087ec943f998fa7ee8f9a14629" data-id="f029e2087ec943f998fa7ee8f9a14629"><span><div id="f029e2087ec943f998fa7ee8f9a14629" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f029e2087ec943f998fa7ee8f9a14629" title="Takeaways"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaways</span></span></h4><ul class="notion-list notion-list-disc notion-block-299d35f74d5c43daaa8af65a5fb51d9c"><li>Turns out that it has to be a typo else the challenge will not work, the challenge simulates a typo where the constructors is misnamed and became a public function instead.</li></ul><ul class="notion-list notion-list-disc notion-block-7a7b5c21a6144d3c9d9a702bb470c23c"><li>Seems like a bad idea to even define constructors by the contract name, note to myself, maybe just use the <code class="notion-inline-code">constructor</code> keyword?</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1ea89ddb09bc4459bf6d0af5e353f4bb" data-id="1ea89ddb09bc4459bf6d0af5e353f4bb"><span><div id="1ea89ddb09bc4459bf6d0af5e353f4bb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1ea89ddb09bc4459bf6d0af5e353f4bb" title="4. Coin Flip "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. Coin Flip </span></span></h3><div class="notion-text notion-block-bac802b3d73d4f0aa0a2941720261e73">We need to rack up some consecutive wins by making the right guesses.</div><div class="notion-text notion-block-9f07c9e806ad4b66ad2a31b55da0164a">I faced a few hiccups here.</div><ol start="1" class="notion-list notion-list-numbered notion-block-1fe323e98a9246c2867d23e8dc1ce523" style="list-style-type:decimal"><li>I tried to be fancy here and did a <code class="notion-inline-code">for-loop</code> only to realised that the challenge prevents that with the following</li></ol><div class="notion-text notion-block-297ca661f4f7405b8f7d60e859ee6d2d">it will error out with <code class="notion-inline-code">execution reverted</code> <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://sepolia.etherscan.io/tx/0xe3f8500ee187297c0f4dc29e95fbcc0497758b4084880a0f68572cbffb23e539">example transaction</a>
</div><details class="notion-toggle notion-block-71a453f5fb074ccf8900f8fd10c0c395"><summary>Solution</summary><div></div></details><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-822cc2fba63c4f88a797b97fd63a87ba" data-id="822cc2fba63c4f88a797b97fd63a87ba"><span><div id="822cc2fba63c4f88a797b97fd63a87ba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#822cc2fba63c4f88a797b97fd63a87ba" title="Takeaways "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaways </span></span></h4><ul class="notion-list notion-list-disc notion-block-4f6cdb738f354615a87bb05450b186a1"><li><code class="notion-inline-code">external</code> is like <code class="notion-inline-code">public</code> but cannot be called internally</li></ul><div class="notion-blank notion-block-3932606164764b05bd94eaf5ebeb133c"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-574e5f05069a41648ec3df7c68479a60" data-id="574e5f05069a41648ec3df7c68479a60"><span><div id="574e5f05069a41648ec3df7c68479a60" class="notion-header-anchor"></div><a class="notion-hash-link" href="#574e5f05069a41648ec3df7c68479a60" title="Next -  "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Next - <a class="notion-link" href="/b4f91114de34491f83cf39de17ed7719"><span class="notion-page-title"><div class="notion-page-icon-inline notion-page-icon-image"><img class="notion-page-title-icon notion-page-icon" src="https://i.ibb.co/MNhPJ58/ethereum-astronaut.jpg?t=b4f91114-de34-491f-83cf-39de17ed7719" alt="Ethernaut Walkthrough - Part 2" loading="lazy" decoding="async"/></div><span class="notion-page-title-text">Ethernaut Walkthrough - Part 2</span></span></a> </span></span></h2><div class="notion-blank notion-block-ab0d3f4ecb3c4f97b0ff180dc9c9a6a3"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethernaut Walkthrough - Part 2]]></title>
            <link>https://yesyouken.space/article/ethernaut-walkthrough-2</link>
            <guid>https://yesyouken.space/article/ethernaut-walkthrough-2</guid>
            <pubDate>Thu, 27 Apr 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-b4f91114de34491f83cf39de17ed7719"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-ac4b9efe5d2948dd9bd992f4b531f5c7" data-id="ac4b9efe5d2948dd9bd992f4b531f5c7"><span><div id="ac4b9efe5d2948dd9bd992f4b531f5c7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ac4b9efe5d2948dd9bd992f4b531f5c7" title="We are back at it!"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">We are back at it!</span></span></h2><div class="notion-text notion-block-a4c06cf3166f42f795dff1da1b112dda">In case you missed the previous post, here is the link to the previous post <a class="notion-link" href="/f587c0234e4b40ee9b94d38b4f9e13dc"><span class="notion-page-title"><div class="notion-page-icon-inline notion-page-icon-image"><img class="notion-page-title-icon notion-page-icon" src="https://i.ibb.co/MNhPJ58/ethereum-astronaut.jpg?t=f587c023-4e4b-40ee-9b94-d38b4f9e13dc" alt="Ethernaut Walkthrough - Part 1" loading="lazy" decoding="async"/></div><span class="notion-page-title-text">Ethernaut Walkthrough - Part 1</span></span></a> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-a856065cf8f14409b2f569e2aa7c30e3" data-id="a856065cf8f14409b2f569e2aa7c30e3"><span><div id="a856065cf8f14409b2f569e2aa7c30e3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a856065cf8f14409b2f569e2aa7c30e3" title="Levels"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Levels</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-efdfe5461ac648cea20a6ec754002bab" data-id="efdfe5461ac648cea20a6ec754002bab"><span><div id="efdfe5461ac648cea20a6ec754002bab" class="notion-header-anchor"></div><a class="notion-hash-link" href="#efdfe5461ac648cea20a6ec754002bab" title="5. Telephone"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">5. Telephone</span></span></h3><div class="notion-text notion-block-6a706af018fd4252aacb17a73da892e3">source: <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ethernaut.openzeppelin.com/level/0x2C2307bb8824a0AbBf2CC7D76d8e63374D2f8446">0x2C2307bb8824a0AbBf2CC7D76d8e63374D2f8446</a></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-efa28dea71b54080a317597c636d7080" data-id="efa28dea71b54080a317597c636d7080"><span><div id="efa28dea71b54080a317597c636d7080" class="notion-header-anchor"></div><a class="notion-hash-link" href="#efa28dea71b54080a317597c636d7080" title="Thought process "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Thought process </span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-2f61a6e846784d6187eef9d2cfc3d255" style="list-style-type:decimal"><li>Notice in <code class="notion-inline-code">Telephone.sol</code> that we just have to call <code class="notion-inline-code">changeOwner</code> such that <code class="notion-inline-code">tx.origin</code> and <code class="notion-inline-code">msg.sender</code> are not the same and we can change the owner to whichever address we want</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-535be2b3fa1843fc94582ce488dd9a05" style="list-style-type:decimal"><li>Did a quick google on <code class="notion-inline-code">“tx origin solidity”</code> which led me to this page <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.guardrails.io/docs/vulnerabilities/solidity/use_of_insecure_function#:~:text=%E2%80%8B,calls%20into%20a%20malicious%20contract">https://docs.guardrails.io/docs/vulnerabilities/solidity/use_of_insecure_function#:~:text=,calls into a malicious contract</a>.</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-f2083c51309c4d369a8e74b6329e5cba" style="list-style-type:decimal"><li>So <code class="notion-inline-code">tx.origin</code> is the address of the account that sent the transaction</li></ol><details class="notion-toggle notion-block-918483ba0d0c42d4b7cdc96cbf5b4631"><summary>Solution </summary><div><ol start="1" class="notion-list notion-list-numbered notion-block-6f20924d9dc14138bccec988ffc440df" style="list-style-type:decimal"><li>Deploy the following contract </li><ol class="notion-list notion-list-numbered notion-block-6f20924d9dc14138bccec988ffc440df" style="list-style-type:lower-alpha"></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-2cfed8dcc8d9447fa880164ef92c1a39" style="list-style-type:decimal"><li>Get contract’s address by running the following in the browser console</li><ol class="notion-list notion-list-numbered notion-block-2cfed8dcc8d9447fa880164ef92c1a39" style="list-style-type:lower-alpha"></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-3acd5084b54c4c25ae608e1753bd2b0d" style="list-style-type:decimal"><li>Run the deployed <code class="notion-inline-code">TelephoneSolution.solve</code> with the contract’s address </li></ol></div></details><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-492b3bf6d4d44446a629d8b765b3708f" data-id="492b3bf6d4d44446a629d8b765b3708f"><span><div id="492b3bf6d4d44446a629d8b765b3708f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#492b3bf6d4d44446a629d8b765b3708f" title="Takeaways"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaways</span></span></h4><ul class="notion-list notion-list-disc notion-block-d079a8c0c08b49bc8987dff83a68d812"><li><code class="notion-inline-code">tx.origin</code> is the address which started the transaction</li></ul><ul class="notion-list notion-list-disc notion-block-58fa8dad54e54ff79c17d6c2610af999"><li><code class="notion-inline-code">msg.sender</code> is the address which sent the message to the contract, and this could be another contract that was triggered by the transaction</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b2e282a5a39140b3814b4d0002f6e353" data-id="b2e282a5a39140b3814b4d0002f6e353"><span><div id="b2e282a5a39140b3814b4d0002f6e353" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b2e282a5a39140b3814b4d0002f6e353" title="6. Token "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">6. Token </span></span></h3><div class="notion-text notion-block-23e41e90f97046de876e65a72ce76d84">source: <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ethernaut.openzeppelin.com/level/0x478f3476358Eb166Cb7adE4666d04fbdDB56C407">0x478f3476358Eb166Cb7adE4666d04fbdDB56C407</a></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-faf1a7c1ed584da39f00bd4f7c28c0da" data-id="faf1a7c1ed584da39f00bd4f7c28c0da"><span><div id="faf1a7c1ed584da39f00bd4f7c28c0da" class="notion-header-anchor"></div><a class="notion-hash-link" href="#faf1a7c1ed584da39f00bd4f7c28c0da" title="Thought Process"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Thought Process</span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-ea72f351961e4c91b827eb49fceb8f40" style="list-style-type:decimal"><li>I had to google for help on this one. I googled a little and found out that it had to do with integer underflow and overflow. </li><ol class="notion-list notion-list-numbered notion-block-ea72f351961e4c91b827eb49fceb8f40" style="list-style-type:lower-alpha"><blockquote class="notion-quote notion-block-e18f6beffc8d457dbd37f961e20f7e07"><div>To hack this contract first you need to understand the concept of integer underflow and overflow. The overflow is a situation when uint (unsigned integer) reaches its byte size. Then the next element added will return the first variable element.
- <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hackernoon.com/how-to-solve-the-ethernaut-games-level-5-token">https://hackernoon.com/how-to-solve-the-ethernaut-games-level-5-token</a></div></blockquote></ol></ol><details class="notion-toggle notion-block-bd42b1f4e2714deb8fea2adc4e7fd1a5"><summary>Solution</summary><div><div class="notion-text notion-block-ba3fea6758c94dad8af3203382c47216">1. Execute the following in the browser console</div></div></details><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-8db11d9ee5f44738bbedefff41de37a1" data-id="8db11d9ee5f44738bbedefff41de37a1"><span><div id="8db11d9ee5f44738bbedefff41de37a1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8db11d9ee5f44738bbedefff41de37a1" title="Takeaways"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaways</span></span></h4><ul class="notion-list notion-list-disc notion-block-13fe3f9ef8cb43d1bff002da3d5b09ef"><li>We can check overflow with the following</li><ul class="notion-list notion-list-disc notion-block-13fe3f9ef8cb43d1bff002da3d5b09ef"></ul></ul><ul class="notion-list notion-list-disc notion-block-aa38bacb492243de8f0bff3787503a74"><li>An easier alternative is to use OpenZeppelin&#x27;s SafeMath library that automatically checks for overflows in all the mathematical operators. The resulting code looks like this:</li><ul class="notion-list notion-list-disc notion-block-aa38bacb492243de8f0bff3787503a74"></ul></ul><ul class="notion-list notion-list-disc notion-block-83dfdd42ea4342beb0eea6126a866af3"><li>Or use solidity <code class="notion-inline-code">0.8</code> onwards (refer to <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.soliditylang.org/en/v0.8.0/080-breaking-changes.html#silent-changes-of-the-semantics">v0.8.0 Solidity Changes</a>)</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1699113d04a3498080af5aad20a09112" data-id="1699113d04a3498080af5aad20a09112"><span><div id="1699113d04a3498080af5aad20a09112" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1699113d04a3498080af5aad20a09112" title="7. Delegation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">7. Delegation</span></span></h3><div class="notion-text notion-block-73204d927323491e967d10b2aad283a3">source: <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://ethernaut.openzeppelin.com/level/0x73379d8B82Fda494ee59555f333DF7D44483fD58">0x73379d8B82Fda494ee59555f333DF7D44483fD58</a></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-992bbf92795f4de0b744fbecd4de52dd" data-id="992bbf92795f4de0b744fbecd4de52dd"><span><div id="992bbf92795f4de0b744fbecd4de52dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#992bbf92795f4de0b744fbecd4de52dd" title="Thought Process"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Thought Process</span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-9b3b4051d9634e98a3938d82ddac30a2" style="list-style-type:decimal"><li>Went to research about <code class="notion-inline-code">delegatecall</code> as suggested (reference: <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.soliditylang.org/en/latest/introduction-to-smart-contracts.html#delegatecall-and-libraries">Solidity Docs</a>)</li><ol class="notion-list notion-list-numbered notion-block-9b3b4051d9634e98a3938d82ddac30a2" style="list-style-type:lower-alpha"><li>Notice that <code class="notion-inline-code">delegatecall</code> is similar to using another contract’s code as a library</li></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-4348044d351842288bd00624c9a20e58" style="list-style-type:decimal"><li>Notice that in <code class="notion-inline-code">Delegate.sol</code> the <code class="notion-inline-code">pwn()</code> function changes the owner to <code class="notion-inline-code">msg.sender</code></li></ol><details class="notion-toggle notion-block-f875836eab4f4118a0ab1a6dbbb8c842"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-f875836eab4f4118a0ab1a6dbbb8c842" data-id="f875836eab4f4118a0ab1a6dbbb8c842"><span><div id="f875836eab4f4118a0ab1a6dbbb8c842" class="notion-header-anchor"></div><span class="notion-h-title"> Solution</span></span></h3></summary><div><ol start="1" class="notion-list notion-list-numbered notion-block-4476e94d0f144387b9eaecb99bc6f8ea" style="list-style-type:decimal"><li> Load this interface into remix IDE</li><ol class="notion-list notion-list-numbered notion-block-4476e94d0f144387b9eaecb99bc6f8ea" style="list-style-type:lower-alpha"></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-babbc047bda746dba2660256ad92ebf5" style="list-style-type:decimal"><li>Just overlay this interface on top of the level&#x27;s contract address</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-69c031cf892546ceb146f3719d179b56" style="list-style-type:decimal"><li>And call <code class="notion-inline-code">pwn()</code></li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-7a777b1fb7b741dd94a8c48fb05f51bc" style="list-style-type:decimal"><li>Make sure that there is enough gas limit given</li></ol></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-27a4ea3eea3e41dd84ddcc1de023ce00" data-id="27a4ea3eea3e41dd84ddcc1de023ce00"><span><div id="27a4ea3eea3e41dd84ddcc1de023ce00" class="notion-header-anchor"></div><a class="notion-hash-link" href="#27a4ea3eea3e41dd84ddcc1de023ce00" title="Takeaways"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaways</span></span></h3><ul class="notion-list notion-list-disc notion-block-731be30e1182419a81c33692cc52659a"><li><code class="notion-inline-code">delegatecall</code> combined with <code class="notion-inline-code">fallback</code> is very much like composition in OOP (Object Oriented Programming)</li></ul><ul class="notion-list notion-list-disc notion-block-f33e9822a0b748318459f3b7acf4894e"><li>Solidity documentation on <code class="notion-inline-code">fallback</code> function was not easy to understand, in my opinion.</li></ul><ul class="notion-list notion-list-disc notion-block-404d0dd5a0e64127a9615c59ababfff0"><li>The first possible way to trigger <code class="notion-inline-code">fallback</code> function was just calling a non-existent method on the target contract. This can be simulated by overlaying a wrong interface on an contract address and calling whichever method that was defined in the interface but not on the contract</li></ul><ul class="notion-list notion-list-disc notion-block-4a0b72c4647441c9abae03e28b9988bf"><li>The second possible way to trigger <code class="notion-inline-code">fallback</code> function was not easy to understand for me. I thought I could trigger solve the level another way by sending <code class="notion-inline-code">Ether</code> to it but turns out that does not work. The <code class="notion-inline-code">fallback</code> function has to be marked <code class="notion-inline-code">payable</code> for that to work</li></ul></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>