<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AnonCoder | assert true</title>
    <description>The latest articles on DEV Community by AnonCoder | assert true (@anon_user_coder).</description>
    <link>https://dev.to/anon_user_coder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4207996%2Fa7e66092-1ad7-480b-bfe5-c4f4ef7335ed.png</url>
      <title>DEV Community: AnonCoder | assert true</title>
      <link>https://dev.to/anon_user_coder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anon_user_coder"/>
    <language>en</language>
    <item>
      <title>Linux Enumeration and Access Control: What Happens in the First Sixty Seconds on a Target</title>
      <dc:creator>AnonCoder | assert true</dc:creator>
      <pubDate>Wed, 28 Oct 2026 15:38:56 +0000</pubDate>
      <link>https://dev.to/anon_user_coder/linux-enumeration-and-access-control-what-happens-in-the-first-sixty-seconds-on-a-target-dce</link>
      <guid>https://dev.to/anon_user_coder/linux-enumeration-and-access-control-what-happens-in-the-first-sixty-seconds-on-a-target-dce</guid>
      <description>&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/CJ459itJPeU" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The first sixty seconds on an unknown target decide whether the engagement is methodical or random.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;[LAB ENVIRONMENT — commands executed in a local throwaway sandbox]&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Throwaway reproduction sandbox (runs locally as unprivileged user; display_user="dev")&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/lab/&lt;span class="o"&gt;{&lt;/span&gt;reports,scripts,.config&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/lab
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"README content"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; README.txt
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"status ok"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; reports/q3.txt
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"API_TOKEN=example-not-a-real-token"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; deploy.env
&lt;span class="nb"&gt;chmod &lt;/span&gt;640 deploy.env
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"rotate the deploy token before friday"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .reminder
&lt;span class="nb"&gt;chmod &lt;/span&gt;600 .reminder
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"todo: archive old reports&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;todo: rotate keys&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; notes.txt
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;01&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;02&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;fe&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;ff&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00CONNECT db.internal:5432&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;de&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;ad&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;be&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;ef&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00user=deploy&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;00"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; data.bin
&lt;span class="nb"&gt;chmod &lt;/span&gt;755 scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What this level is
&lt;/h2&gt;

&lt;p&gt;You land on a shell on a machine you have never seen. There is no map, no architecture diagram, and no administrator telling you what matters. What you do in the next sixty seconds determines whether the rest of the session is disciplined, repeatable, and effective or chaotic and noisy. Professional operators on both offensive engagements and incident response investigations begin with the same three fundamental questions: who am I, where am I, and what is here?&lt;/p&gt;

&lt;p&gt;In this guide, we answer those questions against BreachLab's Ghost track, Level 0, titled "First Contact". The level page lists three foundational commands: &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cd&lt;/code&gt;, and &lt;code&gt;cat&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Behind those three simple commands lie decades of computer science history and operating system architecture. In this guide, we examine:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why identity in Unix is governed by kernel-level numeric IDs rather than environment variables.&lt;/li&gt;
&lt;li&gt;How the filesystem hierarchy and hidden dot-files originated from a historical shortcut.&lt;/li&gt;
&lt;li&gt;How the access matrix compresses into nine permission bits, and how discretionary access control creates predictable security vulnerabilities.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Platform:&lt;/strong&gt; &lt;a href="https://breachlab.org" rel="noopener noreferrer"&gt;BreachLab&lt;/a&gt;, a free, legal hands-on platform where every level is an isolated, real Linux environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Track &amp;amp; Level:&lt;/strong&gt; Ghost I · Level 0 — First Contact (100 points).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target Connection:&lt;/strong&gt; &lt;code&gt;ssh ghost0@204.168.229.209 -p 2222&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commands Covered:&lt;/strong&gt; &lt;code&gt;whoami&lt;/code&gt;, &lt;code&gt;pwd&lt;/code&gt;, &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cd&lt;/code&gt;, &lt;code&gt;cat&lt;/code&gt;, &lt;code&gt;file&lt;/code&gt;, &lt;code&gt;head&lt;/code&gt;, &lt;code&gt;tail&lt;/code&gt;, &lt;code&gt;strings&lt;/code&gt;, &lt;code&gt;xxd&lt;/code&gt;, &lt;code&gt;stat&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level Objective:&lt;/strong&gt; Locate the credentials for the next account (&lt;code&gt;ghost1&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Watch the full long-form video walkthrough:&lt;/strong&gt; &lt;a href="https://youtu.be/CJ459itJPeU" rel="noopener noreferrer"&gt;https://youtu.be/CJ459itJPeU&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Follow along with the complete series playlist:&lt;/strong&gt; &lt;a href="https://www.youtube.com/playlist?list=PLUep6spDxjvo" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLUep6spDxjvo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Compliance Note: In strict adherence to BreachLab creator rules, this article teaches the underlying method, mechanics, and security theory. No passwords, flags, or copy-paste solutions are published.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Today's Topics
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Orientation Loop&lt;/strong&gt;: Executing the initial sixty-second triage using &lt;code&gt;whoami&lt;/code&gt;, &lt;code&gt;pwd&lt;/code&gt;, and &lt;code&gt;ls -la&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH Protocol Mechanics&lt;/strong&gt;: Understanding TCP handshakes, Diffie-Hellman key agreement, and host verification.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity and Complete Mediation&lt;/strong&gt;: Why the kernel evaluates effective UIDs rather than shell variables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filesystem Enumeration&lt;/strong&gt;: Walking directory tables, understanding inodes, and unmasking dot-files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission Bit Triads&lt;/strong&gt;: Decoding octal modes, directory traversal mechanics, and access matrix theory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path Traversal with Shell Builtins&lt;/strong&gt;: Why &lt;code&gt;cd&lt;/code&gt; must execute inside the parent shell process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Defensive Content Inspection&lt;/strong&gt;: Safely examining unknown streams using &lt;code&gt;file&lt;/code&gt;, &lt;code&gt;cat -A&lt;/code&gt;, and &lt;code&gt;strings&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unsecured Credentials in Files (T1552.001)&lt;/strong&gt;: Real-world impact, kill chain positioning, and honeytoken detection.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Orienting on an Unknown Target: whoami and pwd
&lt;/h2&gt;

&lt;p&gt;When I first connect to a remote target, before typing any complex commands or running automated scripts, I establish orientation. I need to know the security context of the process running my shell and my exact position in the directory hierarchy.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 1: The opening moments on an unknown shell determine the course of the investigation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I begin by asking the kernel for my active identity. I run &lt;code&gt;whoami&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami
&lt;/span&gt;dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command returns &lt;code&gt;dev&lt;/code&gt; (or &lt;code&gt;ghost0&lt;/code&gt; when logged into the live target). Behind this single word, the &lt;code&gt;whoami&lt;/code&gt; utility executed the &lt;code&gt;geteuid()&lt;/code&gt; system call to fetch the numeric effective user ID from the operating system kernel, then performed a lookup against &lt;code&gt;/etc/passwd&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To illustrate why this matters, consider what happens if I rely on the common &lt;code&gt;$USER&lt;/code&gt; environment variable instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt;
dev
&lt;span class="nv"&gt;$ USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;root
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt;
root
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami
&lt;/span&gt;dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The environment variable &lt;code&gt;$USER&lt;/code&gt; is completely under user-space control. An adversary or a misconfigured script can alter it at will. The kernel's reference monitor completely ignores &lt;code&gt;$USER&lt;/code&gt; when enforcing access permissions; it consults only the numeric UID bound to the process structure in memory.&lt;/p&gt;

&lt;p&gt;Next, I check my location in the filesystem with &lt;code&gt;pwd&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/dev/lab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;pwd&lt;/code&gt; (print working directory) command prints the absolute path of the current directory. This path serves as the anchor point for every relative path resolution performed by the kernel during system calls like &lt;code&gt;open()&lt;/code&gt; and &lt;code&gt;execve()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Takeaway: Always query the kernel directly for process identity rather than trusting environment variables that user space can manipulate.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 2: BreachLab provides authentic Linux environments over SSH.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Anatomy of an SSH Connection
&lt;/h2&gt;

&lt;p&gt;To reach Level 0, we initiate an SSH connection to port 2222:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh ghost0@204.168.229.209 &lt;span class="nt"&gt;-p&lt;/span&gt; 2222
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;em&gt;Figure 3: Breakdown of an SSH connection string: binary, target account, host address, and non-standard port.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This command initiates a multi-stage protocol exchange:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Transport Layer Handshake&lt;/strong&gt;: The client opens a TCP connection to port 2222. Port 2222 is chosen by convention for secondary or containerised SSH daemons, avoiding privileged port binding (ports below 1024 require root privileges).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version Exchange&lt;/strong&gt;: Both client and server exchange identification strings (e.g., &lt;code&gt;SSH-2.0-OpenSSH_8.9p1&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key Exchange (KEX)&lt;/strong&gt;: Both sides agree on cryptographic algorithms and execute a Diffie-Hellman or elliptic curve exchange to establish a shared session key without transmitting it over the wire.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server Authentication&lt;/strong&gt;: The server signs the exchange with its private host key. The client verifies this signature against its local &lt;code&gt;~/.ssh/known_hosts&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Authentication&lt;/strong&gt;: Once encryption is established, the client sends user authentication credentials (in Level 0, password authentication; in hardened environments, Ed25519 public keys or certificates).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Takeaway: SSH ensures confidentiality, integrity, and server authentication before a single credential character is sent across the network.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Enumerating the Filesystem: ls and What Else You Could Use
&lt;/h2&gt;

&lt;p&gt;With identity and working directory confirmed, the next priority is inventorying what is present.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 4: The orientation triage answering who am I, where am I, and what is here.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I start with a plain &lt;code&gt;ls&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;README.txt
data.bin
deploy.env
notes.txt
reports
scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A standard &lt;code&gt;ls&lt;/code&gt; reads the directory data structure and outputs filenames alphabetically. However, a plain listing hides crucial information. In Unix, files whose names begin with a period (&lt;code&gt;.&lt;/code&gt;) are excluded from default directory listings.&lt;/p&gt;

&lt;p&gt;To see all entries, I supply the &lt;code&gt;-a&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;.&lt;/span&gt;
..
.config
.reminder
README.txt
data.bin
deploy.env
notes.txt
reports
scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what appeared: &lt;code&gt;.&lt;/code&gt; (the current directory), &lt;code&gt;..&lt;/code&gt; (the parent directory), &lt;code&gt;.config&lt;/code&gt; (a configuration directory), and &lt;code&gt;.reminder&lt;/code&gt; (a hidden text file).&lt;/p&gt;

&lt;p&gt;In security assessments, dot-files are prime locations for misconfigured credentials, shell histories (&lt;code&gt;.bash_history&lt;/code&gt;), cloud tokens (&lt;code&gt;.aws/&lt;/code&gt;), and private keys (&lt;code&gt;.ssh/id_rsa&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;To inspect file metadata, I combine flags into the standard enumeration command &lt;code&gt;ls -la&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
total 40
drwxrwxr-x 5 dev dev 4096 Oct  7 07:02 &lt;span class="nb"&gt;.&lt;/span&gt;
drwxrwxr-x 3 dev dev 4096 Oct  7 07:02 ..
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 .config
&lt;span class="nt"&gt;-rw-------&lt;/span&gt; 1 dev dev   38 Oct  4 07:02 .reminder
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   80 Oct  7 07:02 README.txt
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   61 Sep  7 07:02 data.bin
&lt;span class="nt"&gt;-rw-r-----&lt;/span&gt; 1 dev dev   67 Oct  2 07:02 deploy.env
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   46 Sep 28 07:02 notes.txt
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 reports
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;em&gt;Figure 5: Examining file metadata, hidden dot-entries, and permission triads with &lt;code&gt;ls -la&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What if ls is not available?
&lt;/h3&gt;

&lt;p&gt;In minimal Docker containers or restricted shells, the &lt;code&gt;ls&lt;/code&gt; binary may be absent or restricted. Because filename expansion (globbing) is handled directly by the shell before command execution, we can enumerate files using built-in shell features:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;
README.txt data.bin deploy.env notes.txt reports scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When recursive enumeration is needed, &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;tree&lt;/code&gt; provide structured visibility:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;tree &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-L&lt;/span&gt; 2
&lt;span class="nb"&gt;.&lt;/span&gt;
├── .config
│   └── app.conf
├── .reminder
├── README.txt
├── data.bin
├── deploy.env
├── notes.txt
├── reports
│   ├── q3.txt
│   └── q4.txt
└── scripts
    └── backup.sh

4 directories, 9 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Takeaway: Plain &lt;code&gt;ls&lt;/code&gt; conceals administrative configuration; standard enumeration requires &lt;code&gt;ls -la&lt;/code&gt; or native shell globbing.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Decoding Access Rights: Reading a Permission String
&lt;/h2&gt;

&lt;p&gt;The output of &lt;code&gt;ls -la&lt;/code&gt; presents a 10-character string at the beginning of each line. Understanding this string is essential for recognizing privilege boundaries.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 6: Anatomy of a Unix permission string and octal conversion.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Consider the line for &lt;code&gt;deploy.env&lt;/code&gt;:&lt;br&gt;
&lt;code&gt;-rw-r----- 1 dev dev 67 Oct 2 07:02 deploy.env&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We dissect the string from left to right:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Character 1 (File Type)&lt;/strong&gt;: &lt;code&gt;-&lt;/code&gt; denotes a regular file. A &lt;code&gt;d&lt;/code&gt; indicates a directory, while &lt;code&gt;l&lt;/code&gt; denotes a symbolic link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characters 2–4 (Owner Permissions)&lt;/strong&gt;: &lt;code&gt;rw-&lt;/code&gt; indicates the owner (&lt;code&gt;dev&lt;/code&gt;) has read (&lt;code&gt;r=4&lt;/code&gt;) and write (&lt;code&gt;w=2&lt;/code&gt;) permissions, but no execute (&lt;code&gt;x=1&lt;/code&gt;). Total = &lt;code&gt;6&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characters 5–7 (Group Permissions)&lt;/strong&gt;: &lt;code&gt;r--&lt;/code&gt; indicates members of the owning group (&lt;code&gt;dev&lt;/code&gt;) have read permission only. Total = &lt;code&gt;4&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characters 8–10 (Others Permissions)&lt;/strong&gt;: &lt;code&gt;---&lt;/code&gt; indicates any user who is neither the owner nor a member of the group has zero permissions. Total = &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The combined octal mode is &lt;code&gt;640&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can verify this numeric representation directly using &lt;code&gt;stat&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'%A  %a  %U:%G  %s bytes  %n'&lt;/span&gt; README.txt .reminder scripts/backup.sh deploy.env
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt;  644  dev:dev  80 bytes  README.txt
&lt;span class="nt"&gt;-rw-------&lt;/span&gt;  600  dev:dev  38 bytes  .reminder
&lt;span class="nt"&gt;-rwxr-xr-x&lt;/span&gt;  755  dev:dev  40 bytes  scripts/backup.sh
&lt;span class="nt"&gt;-rw-r-----&lt;/span&gt;  640  dev:dev  67 bytes  deploy.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Crucial Difference for Directories
&lt;/h3&gt;

&lt;p&gt;For files, &lt;code&gt;r&lt;/code&gt; allows reading content, &lt;code&gt;w&lt;/code&gt; allows modifying bytes, and &lt;code&gt;x&lt;/code&gt; allows running the file as an executable program.&lt;/p&gt;

&lt;p&gt;For directories, the bits have distinct meanings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;r&lt;/code&gt; (Read): Grants the ability to list the names of files inside the directory (e.g., with &lt;code&gt;ls&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;w&lt;/code&gt; (Write): Grants the ability to create, delete, or rename files within the directory (contingent on execute permissions).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; (Execute/Search): Grants the ability to enter the directory (&lt;code&gt;cd&lt;/code&gt;) and access the inodes of files inside it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Takeaway: Without directory execute permissions, read permissions allow listing names but prevent accessing file contents or metadata.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Navigating the Hierarchy: Moving Around with cd
&lt;/h2&gt;

&lt;p&gt;Navigating the directory tree is accomplished using &lt;code&gt;cd&lt;/code&gt; (change directory).&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 7: Inspecting command implementations with &lt;code&gt;type&lt;/code&gt;: builtins versus disk executables.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When we check the binary location of &lt;code&gt;cd&lt;/code&gt;, we encounter a fundamental architectural distinction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;type cd ls cat pwd
cd &lt;/span&gt;is a shell &lt;span class="nb"&gt;builtin
ls &lt;/span&gt;is /usr/bin/ls
&lt;span class="nb"&gt;cat &lt;/span&gt;is /usr/bin/cat
&lt;span class="nb"&gt;pwd &lt;/span&gt;is a shell &lt;span class="nb"&gt;builtin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ls&lt;/code&gt; and &lt;code&gt;cat&lt;/code&gt; are independent executable binaries located in &lt;code&gt;/usr/bin/&lt;/code&gt;. When invoked, the shell calls &lt;code&gt;fork()&lt;/code&gt; to create a child process, followed by &lt;code&gt;execve()&lt;/code&gt; to load the binary into memory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt;, however, is a &lt;strong&gt;shell builtin&lt;/strong&gt;. In Unix process architecture, a child process inherits a copy of its parent's working directory, but any modifications made by the child to its own working directory do not propagate back to the parent. If &lt;code&gt;cd&lt;/code&gt; were an external executable binary, running &lt;code&gt;/usr/bin/cd reports&lt;/code&gt; would change the directory of the child process, which would then immediately exit, leaving the user's interactive shell exactly where it started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Navigation Patterns
&lt;/h3&gt;

&lt;p&gt;We test navigation shortcuts across our lab hierarchy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;reports &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;pwd&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; .. &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;pwd&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ~ &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;pwd&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; - &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/dev/lab/reports
/home/dev/lab
/home/dev
/home/dev/lab
/home/dev/lab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key shortcuts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;..&lt;/code&gt;: References the parent directory entry.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;~&lt;/code&gt;: Expands to the current user's home directory (&lt;code&gt;$HOME&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-&lt;/code&gt;: Returns to the previous working directory (&lt;code&gt;$OLDPWD&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Takeaway: &lt;code&gt;cd&lt;/code&gt; must be implemented inside the shell process because child processes cannot alter parent process state.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Inspecting Files Safely: cat and the Tools Around It
&lt;/h2&gt;

&lt;p&gt;Once a target file is discovered, we must inspect its contents. The standard utility is &lt;code&gt;cat&lt;/code&gt; (short for concatenate).&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 8: Examining files safely: content inspection, line terminators, and binary strings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; reads file streams sequentially and writes them to standard output. While effective for short text files, dumping arbitrary files directly with &lt;code&gt;cat&lt;/code&gt; introduces risks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Long files scroll off the screen, obscuring terminal history.&lt;/li&gt;
&lt;li&gt;Binary files send control characters that can corrupt terminal settings or reprogram keyboard mappings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To avoid this, we follow a two-step rule: &lt;strong&gt;identify first, read second&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We inspect file types using &lt;code&gt;file&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;file &lt;span class="k"&gt;*&lt;/span&gt;
README.txt: ASCII text
data.bin:   data
deploy.env: ASCII text
notes.txt:  ASCII text, with CRLF line terminators
reports:    directory
scripts:    directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice &lt;code&gt;notes.txt&lt;/code&gt;: it is flagged as containing &lt;strong&gt;CRLF line terminators&lt;/strong&gt; (Windows-style &lt;code&gt;\r\n&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If we view &lt;code&gt;notes.txt&lt;/code&gt; with plain &lt;code&gt;cat&lt;/code&gt;, the carriage return is invisible. But when we pass &lt;code&gt;-A&lt;/code&gt; (show all invisible characters), the hidden control character becomes evident:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; notes.txt
todo: archive old reports^M&lt;span class="err"&gt;$&lt;/span&gt;
todo: rotate keys^M&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;^M&lt;/code&gt; represents carriage return (&lt;code&gt;\r&lt;/code&gt;, ASCII 0x0D), while &lt;code&gt;$&lt;/code&gt; marks the newline (&lt;code&gt;\n&lt;/code&gt;, ASCII 0x0A). If an automated script parses this file to extract a password or hostname, the carriage return remains attached to the string, causing subsequent authentication requests to fail silently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Specialized Inspection Tools
&lt;/h3&gt;

&lt;p&gt;When dealing with structured, binary, or large datasets, we use tailored utilities:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Inspecting Binaries with strings&lt;/strong&gt;&lt;br&gt;
Instead of dumping raw bytes from &lt;code&gt;data.bin&lt;/code&gt;, &lt;code&gt;strings&lt;/code&gt; extracts contiguous printable ASCII sequences (minimum length 4 by default):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;strings data.bin
CONNECT db.internal:5432
&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Exact Byte Inspection with xxd&lt;/strong&gt;&lt;br&gt;
To view hexadecimal representations and offsets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;xxd data.bin
00000000: 0001 02fe ff00 0000 434f 4e4e 4543 5420  ........CONNECT 
00000010: 6462 2e69 6e74 6572 6e61 6c3a 3534 3332  db.internal:5432
00000020: 00de adbe ef00 0000 0000 0000 0000 0000  ................
00000030: 0075 7365 723d 6465 706c 6f79 00         .user&lt;span class="o"&gt;=&lt;/span&gt;deploy.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Bounded Inspection with head and tail&lt;/strong&gt;&lt;br&gt;
To read headers or trailing log entries without flooding standard output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 3 reports/q3.txt
line 001: status ok
line 002: status ok
line 003: status ok
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Recursive Content Searching with grep&lt;/strong&gt;&lt;br&gt;
When searching across an entire hierarchy for credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'token'&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 2&amp;gt;/dev/null
./.reminder:1:rotate the deploy token before friday
./deploy.env:2:API_TOKEN&lt;span class="o"&gt;=&lt;/span&gt;example-not-a-real-token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Takeaway: Always classify unknown files with &lt;code&gt;file&lt;/code&gt; before reading, and use &lt;code&gt;cat -A&lt;/code&gt; to catch invisible carriage returns that break scripts.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Solving Level 0 on the Target Machine
&lt;/h2&gt;

&lt;p&gt;Now we apply our orientation methodology to the live BreachLab Ghost 0 target.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 9: Step-by-step navigation through the target directory structure to locate the level credential.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We log in over SSH as &lt;code&gt;ghost0&lt;/code&gt;. The session opens in &lt;code&gt;/home/ghost0&lt;/code&gt;. We execute our triage loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami
&lt;/span&gt;ghost0
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/ghost0
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;workspace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The directory contains an entry named &lt;code&gt;workspace&lt;/code&gt;. We move into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;workspace
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;archive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside &lt;code&gt;workspace&lt;/code&gt; is a directory named &lt;code&gt;archive&lt;/code&gt;. In enterprise systems, archive directories are frequently overlooked during credential rotation sweeps. We descend into &lt;code&gt;archive&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;archive
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;credentials
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We find a file named &lt;code&gt;credentials&lt;/code&gt;. Before reading it, we verify its format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;file credentials
credentials: ASCII text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we display the credential:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;credentials
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(The password output is intentionally redacted in accordance with BreachLab platform rules).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The password string displayed in this file represents the flag for Level 0 and serves as the SSH authentication password for &lt;code&gt;ghost1&lt;/code&gt;. We immediately log this credential in an external secure password manager before proceeding to Level 1.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Takeaway: Level 0 requires zero exploit payloads; disciplined filesystem traversal and directory enumeration locate the credential directly.&lt;/em&gt;&lt;/p&gt;




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

&lt;p&gt;&lt;em&gt;Figure 10: Complete mediation ensures that every system call requesting file access is validated against kernel process credentials.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Running It
&lt;/h2&gt;

&lt;p&gt;Here is the complete orientation session as executed in our sandbox environment, demonstrating the unbroken workflow from initial connection to secret identification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami
&lt;/span&gt;dev
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/dev/lab
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
total 40
drwxrwxr-x 5 dev dev 4096 Oct  7 07:02 &lt;span class="nb"&gt;.&lt;/span&gt;
drwxrwxr-x 3 dev dev 4096 Oct  7 07:02 ..
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 .config
&lt;span class="nt"&gt;-rw-------&lt;/span&gt; 1 dev dev   38 Oct  4 07:02 .reminder
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   80 Oct  7 07:02 README.txt
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   61 Sep  7 07:02 data.bin
&lt;span class="nt"&gt;-rw-r-----&lt;/span&gt; 1 dev dev   67 Oct  2 07:02 deploy.env
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 dev dev   46 Sep 28 07:02 notes.txt
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 reports
drwxr-xr-x 2 dev dev 4096 Oct  7 07:02 scripts
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'%A  %a  %U:%G  %s bytes  %n'&lt;/span&gt; deploy.env .reminder
&lt;span class="nt"&gt;-rw-r-----&lt;/span&gt;  640  dev:dev  67 bytes  deploy.env
&lt;span class="nt"&gt;-rw-------&lt;/span&gt;  600  dev:dev  38 bytes  .reminder
&lt;span class="nv"&gt;$ &lt;/span&gt;file &lt;span class="k"&gt;*&lt;/span&gt;
README.txt: ASCII text
data.bin:   data
deploy.env: ASCII text
notes.txt:  ASCII text, with CRLF line terminators
reports:    directory
scripts:    directory
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; notes.txt
todo: archive old reports^M&lt;span class="err"&gt;$&lt;/span&gt;
todo: rotate keys^M&lt;span class="err"&gt;$&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'token'&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 2&amp;gt;/dev/null
./.reminder:1:rotate the deploy token before friday
./deploy.env:2:API_TOKEN&lt;span class="o"&gt;=&lt;/span&gt;example-not-a-real-token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Reading it in groups:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identity &amp;amp; Context&lt;/strong&gt;: &lt;code&gt;whoami&lt;/code&gt; and &lt;code&gt;pwd&lt;/code&gt; verify unprivileged user execution inside the lab root.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Surface Discovery&lt;/strong&gt;: &lt;code&gt;ls -la&lt;/code&gt; unmasks hidden entries (&lt;code&gt;.config&lt;/code&gt;, &lt;code&gt;.reminder&lt;/code&gt;) that default listings omit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission Assessment&lt;/strong&gt;: &lt;code&gt;stat&lt;/code&gt; reveals that &lt;code&gt;.reminder&lt;/code&gt; is restricted to mode &lt;code&gt;600&lt;/code&gt; (owner read/write only), while &lt;code&gt;deploy.env&lt;/code&gt; is mode &lt;code&gt;640&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream Verification&lt;/strong&gt;: &lt;code&gt;file&lt;/code&gt; alerts us to Windows-style CRLF terminators in &lt;code&gt;notes.txt&lt;/code&gt;, confirmed via &lt;code&gt;cat -A&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Targeted Extraction&lt;/strong&gt;: &lt;code&gt;grep&lt;/code&gt; recursively isolates credential assignments without manual file crawling.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Theory: Why Unix Looks the Way It Does
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Fifty years of hierarchical abstraction and the accident of dot-files.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ritchie &amp;amp; Thompson, &lt;em&gt;The UNIX Time-Sharing System&lt;/em&gt; (Communications of the ACM, 1974)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Unix Programmer's Manual&lt;/em&gt;, 1st Edition (Bell Laboratories, 1971)&lt;/li&gt;
&lt;li&gt;Filesystem Hierarchy Standard (FHS 3.0, Linux Foundation, 2015)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 1969 at Bell Laboratories, Ken Thompson and Dennis Ritchie began designing a streamlined operating system on a discarded Digital Equipment Corporation PDP-7. The design principles they established remain the structural foundation of modern Linux systems.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 11: The evolution of the Unix directory tree from the 1971 Programmer's Manual to modern FHS.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ritchie and Thompson formulated four enduring architectural tenets:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical Namespace&lt;/strong&gt;: A single rooted tree where directories contain file descriptors and pointers to subordinate directories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unstructured Byte Streams&lt;/strong&gt;: A file is simply an arbitrary sequence of bytes. The operating system imposes no record delimiters or indexed access methods; interpretation is delegated entirely to user space.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pervasive File Abstraction&lt;/strong&gt;: Peripheral devices, storage disks, terminals (&lt;code&gt;/dev/tty&lt;/code&gt;), and inter-process communication channels are presented as file descriptors within the namespace.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool Composition&lt;/strong&gt;: Modular utilities that perform a single task well, linked via unidirectional pipes (introduced by Douglas McIlroy in 1973).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In November 1971, the &lt;em&gt;Unix Programmer's Manual&lt;/em&gt; (First Edition) formally documented &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cat&lt;/code&gt;, and &lt;code&gt;chdir&lt;/code&gt; (the predecessor to &lt;code&gt;cd&lt;/code&gt;). In the 1974 CACM paper, directories were defined as simple lookup tables mapping character string names to numeric internal indices called &lt;strong&gt;i-numbers&lt;/strong&gt; (inodes).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Accident of Dot-Files
&lt;/h3&gt;

&lt;p&gt;The convention of "hidden" files originated as a programming shortcut rather than a deliberate security mechanism. According to a widely cited historical account by Rob Pike, when Thompson and Ritchie added directory navigation, every directory received two structural entries: &lt;code&gt;.&lt;/code&gt; (pointing to the directory itself) and &lt;code&gt;..&lt;/code&gt; (pointing to its parent). To prevent these two entries from cluttering directory listings, a check was added to &lt;code&gt;ls&lt;/code&gt;: if the first character of a filename was &lt;code&gt;.&lt;/code&gt;, the entry was skipped.&lt;/p&gt;

&lt;p&gt;This simple prefix check inadvertently caused &lt;em&gt;any&lt;/em&gt; file beginning with a period to be hidden from the default listing. Developers quickly adopted this behavior to stash user configuration files (&lt;code&gt;.profile&lt;/code&gt;, &lt;code&gt;.bashrc&lt;/code&gt;) out of everyday view. In modern security testing, this design artifact makes dot-files the primary repository for unmonitored credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  Under the Hood: Directory Inodes
&lt;/h3&gt;

&lt;p&gt;In modern Linux filesystems (ext4, XFS), a directory is an inode containing data blocks filled with directory entries (&lt;code&gt;struct linux_dirent64&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt;
5771093 README.txt
5771103 data.bin
5771104 deploy.env
5771095 notes.txt
5771100 reports
5771098 scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The filename is merely a human-readable link pointing to an inode number. The permissions, file size, timestamps, and data block pointers reside entirely inside the inode table, not within the directory entry itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Theory: Why SSH Exists (History, Diffie-Hellman, and MITM)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;From plaintext cleartext telnet to cryptographically authenticated sessions.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ylönen, &lt;em&gt;SSH — Secure Shell Remote Login&lt;/em&gt; (1995)&lt;/li&gt;
&lt;li&gt;RFC 4251: &lt;em&gt;The Secure Shell (SSH) Protocol Architecture&lt;/em&gt; (IETF, 2006)&lt;/li&gt;
&lt;li&gt;Diffie &amp;amp; Hellman, &lt;em&gt;New Directions in Cryptography&lt;/em&gt; (IEEE Transactions on Information Theory, 1976)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before SSH, remote administration relied on Telnet (RFC 854) and the Berkeley r-commands (&lt;code&gt;rlogin&lt;/code&gt;, &lt;code&gt;rsh&lt;/code&gt;). These protocols transmitted every packet across local networks and the ARPANET in plaintext. Anyone with network access could capture passwords and keystrokes using packet sniffers.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Figure 12: Diffie-Hellman key exchange mechanics preventing eavesdropping over untrusted networks.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In 1995, following a major password sniffing incident at the Helsinki University of Technology, Tatu Ylönen designed SSH-1 as a secure replacement. In 1999, the OpenBSD project developed OpenSSH, which became the global standard implementation, formalized as SSH-2 in RFCs 4251–4254 in 2006.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cryptographic Foundation: The Diffie-Hellman Key Agreement
&lt;/h3&gt;

&lt;p&gt;The central challenge of remote login across untrusted networks is key distribution: how can two machines agree on a shared secret without an eavesdropper deducing it?&lt;/p&gt;

&lt;p&gt;Whitfield Diffie and Martin Hellman solved this in 1976 using modular arithmetic over a cyclic group. Here is a worked example using deliberately small numbers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client and server publicly agree on a generator base $g = 5$ and a prime modulus $p = 23$.&lt;/li&gt;
&lt;li&gt;The client picks a private secret $a = 6$ and computes the public value $A = g^a \pmod p = 5^6 \pmod{23} = 15625 \pmod{23} = 8$. The client transmits $A = 8$.&lt;/li&gt;
&lt;li&gt;The server picks a private secret $b = 15$ and computes the public value $B = g^b \pmod p = 5^{15} \pmod{23} = 19$. The server transmits $B = 19$.&lt;/li&gt;
&lt;li&gt;The client computes the shared secret: $K = B^a \pmod p = 19^6 \pmod{23} = 47045881 \pmod{23} = 2$.&lt;/li&gt;
&lt;li&gt;The server computes the shared secret: $K = A^b \pmod p = 8^{15} \pmod{23} = 35184372088832 \pmod{23} = 2$.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both sides obtain the shared secret $K = 2$. An adversary observing the network sees $g=5$, $p=23$, $A=8$, and $B=19$. Computing $a$ or $b$ requires solving the discrete logarithm problem ($g^x \equiv A \pmod p$), which is computationally infeasible when $p$ is a 2048-bit prime or an elliptic curve (Curve25519).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Man-in-the-Middle (MITM) Threat
&lt;/h3&gt;

&lt;p&gt;Diffie-Hellman establishes encryption against passive wiretapping, but it is vulnerable to an active attacker who intercepts communications and negotiates independent keys with each side.&lt;/p&gt;

&lt;p&gt;To prevent this, the SSH server signs the key exchange using its asymmetric host key (RSA, ECDSA, or Ed25519). The client verifies this signature against its local &lt;code&gt;known_hosts&lt;/code&gt; file. On the very first connection, the client must rely on &lt;strong&gt;Trust On First Use (TOFU)&lt;/strong&gt;, displaying the key fingerprint for manual user confirmation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Theory: Identity and the Reference Monitor
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Complete mediation, separation of identity, and the kernel boundary.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Anderson, &lt;em&gt;Computer Security Technology Planning Study&lt;/em&gt; (US Air Force, ESD-TR-73-51, 1972)&lt;/li&gt;
&lt;li&gt;Saltzer &amp;amp; Schroeder, &lt;em&gt;The Protection of Information in Computer Systems&lt;/em&gt; (Proceedings of the IEEE, 1975)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 1972, James P. Anderson introduced the foundational concept of the &lt;strong&gt;Reference Monitor&lt;/strong&gt;: an abstract machine that mediates all access attempts by active subjects to passive objects.&lt;/p&gt;

&lt;p&gt;Anderson defined three mandatory properties for any reference monitor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Complete Mediation&lt;/strong&gt;: The monitor must be invoked on every single access attempt without exception.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tamper Resistance&lt;/strong&gt;: The monitor mechanism itself must be protected from unauthorized modification.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifiability&lt;/strong&gt;: The monitor must be small and simple enough to be formally analyzed and proven correct.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the Linux kernel, the Virtual Filesystem (VFS) and the Linux Security Module (LSM) hooks act as the reference monitor. When a process issues an &lt;code&gt;open()&lt;/code&gt; or &lt;code&gt;unlink()&lt;/code&gt; system call, the kernel intercepts execution, evaluates the credentials stored in the calling process's &lt;code&gt;struct cred&lt;/code&gt;, and compares them with the target inode's mode and ownership fields.&lt;/p&gt;

&lt;h3&gt;
  
  
  The AAA Framework
&lt;/h3&gt;

&lt;p&gt;Identity is partitioned across three distinct security operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: Verifying who the entity is (e.g., SSH password verification).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorization&lt;/strong&gt;: Determining what the authenticated entity is permitted to do (e.g., filesystem permission bit checks).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accounting (Auditing)&lt;/strong&gt;: Recording what the entity actually did (e.g., Linux Audit logs via &lt;code&gt;auditd&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real vs. Effective UIDs
&lt;/h3&gt;

&lt;p&gt;Every Linux process maintains multiple UID attributes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real UID (RUID)&lt;/strong&gt;: Identifies the actual user who spawned the process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effective UID (EUID)&lt;/strong&gt;: Evaluated by the kernel for filesystem and IPC permission checks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Saved UID (SUID)&lt;/strong&gt;: Enables setuid binaries to drop and regain elevated privileges safely.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When an unprivileged user executes a command, RUID and EUID match. In subsequent Ghost levels, understanding the divergence between RUID and EUID becomes the cornerstone of privilege escalation analysis.&lt;/p&gt;




&lt;h2&gt;
  
  
  Theory: Enumeration as a Method (Kill Chain, ATT&amp;amp;CK, NIST)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Systematic discovery versus aimless exploration.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Hutchins, Cloppert &amp;amp; Amin, &lt;em&gt;Intelligence-Driven Computer Network Defense Informed by Analysis of Adversary Campaigns and Intrusion Kill Chains&lt;/em&gt; (Lockheed Martin, 2011)&lt;/li&gt;
&lt;li&gt;MITRE ATT&amp;amp;CK Framework: &lt;em&gt;Discovery Tactic (TA0007)&lt;/em&gt; (2015–Present)&lt;/li&gt;
&lt;li&gt;NIST Special Publication 800-115, &lt;em&gt;Technical Guide to Information Security Testing and Assessment&lt;/em&gt; (2008)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security assessments and forensic investigations do not proceed through random trial and error; they operate within structured threat models.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Intrusion Kill Chain
&lt;/h3&gt;

&lt;p&gt;Published in 2011 by Lockheed Martin researchers, the Cyber Kill Chain defines the linear phases of a cyberattack:&lt;br&gt;
Reconnaissance → Weaponization → Delivery → Exploitation → Installation → Command &amp;amp; Control (C2) → Actions on Objectives.&lt;/p&gt;

&lt;p&gt;When an attacker establishes an interactive shell on a target, the engagement has passed the Exploitation phase. The attacker enters the initial phase of &lt;strong&gt;Actions on Objectives&lt;/strong&gt;, where local internal discovery is required to understand the operating environment.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. MITRE ATT&amp;amp;CK Mapping
&lt;/h3&gt;

&lt;p&gt;The MITRE ATT&amp;amp;CK matrix decomposes adversary behavior into specific tactics and techniques. The actions in Level 0 map directly to the &lt;strong&gt;Discovery (TA0007)&lt;/strong&gt; tactic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;T1033 (System Owner/User Discovery)&lt;/strong&gt;: Running &lt;code&gt;whoami&lt;/code&gt; or &lt;code&gt;id&lt;/code&gt; to identify the active user context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;T1083 (File and Directory Discovery)&lt;/strong&gt;: Executing &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;find&lt;/code&gt;, or &lt;code&gt;tree&lt;/code&gt; to map directory trees and locate sensitive files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;T1552.001 (Credentials in Files)&lt;/strong&gt;: Accessing unencrypted configuration files, archives, and flat files to harvest credentials.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  3. NIST SP 800-115 Methodology
&lt;/h3&gt;

&lt;p&gt;NIST outlines four phases of penetration testing: Planning, Discovery, Attack, and Reporting. Discovery is the engine that drives exploitation: each command run on a target trades operational risk (generating audit logs) for information gain.&lt;/p&gt;
&lt;h3&gt;
  
  
  Attacker vs. Defender Trade-offs: Quiet vs. Loud Enumeration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Quiet Enumeration&lt;/strong&gt;: Running native shell builtins and a minimal set of standard utilities (&lt;code&gt;whoami&lt;/code&gt;, &lt;code&gt;pwd&lt;/code&gt;, &lt;code&gt;ls -la&lt;/code&gt;). This generates minimal telemetry and blends into normal administrative traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loud Enumeration&lt;/strong&gt;: Running automated post-exploitation scripts (such as LinPEAS or automated find loops) that touch thousands of files in seconds. This provides rapid discovery but triggers volume-based detection rules in modern Endpoint Detection and Response (EDR) sensors.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Theory: Access Control (The Matrix, DAC vs. MAC, and Design Principles)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Lampson's access matrix, the POSIX compression, and the Saltzer-Schroeder axioms.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Lampson, &lt;em&gt;Protection&lt;/em&gt; (ACM Operating Systems Review, 1974 / 5th Princeton Conference, 1971)&lt;/li&gt;
&lt;li&gt;Saltzer &amp;amp; Schroeder, &lt;em&gt;The Protection of Information in Computer Systems&lt;/em&gt; (Proceedings of the IEEE, 1975)&lt;/li&gt;
&lt;li&gt;Department of Defense Trusted Computer System Evaluation Criteria (TCSEC / "Orange Book", DoD 5200.28-STD, 1983)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 1971, Butler Lampson formalized access control theory using the &lt;strong&gt;Access Matrix Model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In Lampson's model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The rows represent &lt;strong&gt;Subjects&lt;/strong&gt; (active processes executing on behalf of users).&lt;/li&gt;
&lt;li&gt;The columns represent &lt;strong&gt;Objects&lt;/strong&gt; (passive entities: files, directories, sockets).&lt;/li&gt;
&lt;li&gt;Each cell $M[S, O]$ defines the exact access rights held by subject $S$ over object $O$.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Real-world operating systems cannot store an uncompressed matrix with thousands of users and millions of files. Systems store the matrix in one of two ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;By Row (Capabilities)&lt;/strong&gt;: Each process holds a ticket or capability list granting specific operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;By Column (Access Control Lists - ACLs)&lt;/strong&gt;: Each object stores a list of authorized subjects and their permitted actions.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  The Unix Compression
&lt;/h3&gt;

&lt;p&gt;Unix implements a compressed column-based ACL. Instead of listing every user individually, each file inode stores exactly 9 permission bits, divided into three triads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Owner (User)&lt;/strong&gt;: The identity owning the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Group&lt;/strong&gt;: The primary group associated with the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other&lt;/strong&gt;: All other system users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While computationally efficient and requiring only 12 bits of storage per inode (including setuid, setgid, and sticky bits), this compression creates a structural flaw: an owner cannot grant read access to Alice and write access to Bob without creating a dedicated group.&lt;/p&gt;
&lt;h3&gt;
  
  
  DAC vs. MAC
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Discretionary Access Control (DAC)&lt;/strong&gt;: The resource owner determines access permissions. An unprivileged user can set mode &lt;code&gt;777&lt;/code&gt; on their home directory or credentials file, exposing it to all users on the host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mandatory Access Control (MAC)&lt;/strong&gt;: Access decisions are governed by a central security policy enforced by the operating system kernel (e.g., SELinux, AppArmor), independent of user intent. Even if a file is mode &lt;code&gt;777&lt;/code&gt;, a MAC policy can block unauthorized process domains from reading it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Saltzer &amp;amp; Schroeder's Design Principles (1975)
&lt;/h3&gt;

&lt;p&gt;Four of Jerome Saltzer and Michael Schroeder's foundational security principles directly govern our analysis of Level 0:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Least Privilege&lt;/strong&gt;: Every program and user should operate using the bare minimum set of privileges necessary. A credentials file should never exceed mode &lt;code&gt;600&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail-Safe Defaults&lt;/strong&gt;: Access decisions must default to denial. Default umask configurations in standard Linux distributions (e.g., &lt;code&gt;022&lt;/code&gt;) create files that are world-readable (&lt;code&gt;644&lt;/code&gt;) by default, violating this principle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complete Mediation&lt;/strong&gt;: Every access to every object must be checked on every access attempt, preventing cached permission bypasses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Psychological Acceptability&lt;/strong&gt;: Security mechanisms must not impose excessive cognitive or operational friction. When secure secret management is difficult, administrators store plain passwords in local text files.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  Theory: A History of Getting Secrets Wrong
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;From early plaintext shadow files to modern honeytokens and canary credentials.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Morris &amp;amp; Thompson, &lt;em&gt;Password Security: A Case History&lt;/em&gt; (Communications of the ACM, 1979)&lt;/li&gt;
&lt;li&gt;MITRE Common Weakness Enumeration: &lt;em&gt;CWE-798: Use of Hard-coded Credentials&lt;/em&gt; &amp;amp; &lt;em&gt;CWE-312: Cleartext Storage of Sensitive Information&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Paes de Barros, &lt;em&gt;The Honeytoken Approach&lt;/em&gt; (SecurityFocus, 2003)&lt;/li&gt;
&lt;li&gt;CyberArk Threat Research, &lt;em&gt;Unpacking the Uber Breach&lt;/em&gt; (2022)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The file &lt;code&gt;credentials&lt;/code&gt; discovered in Level 0 represents a recurring design failure spanning five decades of computing.&lt;/p&gt;

&lt;p&gt;In early Unix (First through Sixth Editions), &lt;code&gt;/etc/passwd&lt;/code&gt; was world-readable (&lt;code&gt;644&lt;/code&gt;) because programs like &lt;code&gt;ls&lt;/code&gt; needed it to map numeric UIDs to username strings. The file contained the hashed password representations.&lt;/p&gt;

&lt;p&gt;In 1979, Robert Morris and Ken Thompson published &lt;em&gt;Password Security: A Case History&lt;/em&gt;. They demonstrated that an attacker using a PDP-11/70 could compute approximately 800 password hashes per second. Using a dictionary of 250,000 words, an entire system's password file could be cracked in five minutes.&lt;/p&gt;

&lt;p&gt;Their initial defense was the introduction of a &lt;strong&gt;salt&lt;/strong&gt;—a pseudo-random string appended to the password before hashing, preventing global rainbow table attacks. However, as computing hardware accelerated, leaving hashes accessible to unprivileged users became untenable. In 1988, the Morris Worm used automated dictionary attacks against &lt;code&gt;/etc/passwd&lt;/code&gt; to propagate across the internet.&lt;/p&gt;

&lt;p&gt;The structural remedy was the &lt;strong&gt;Shadow Suite&lt;/strong&gt;: moving the password hashes out of &lt;code&gt;/etc/passwd&lt;/code&gt; into &lt;code&gt;/etc/shadow&lt;/code&gt;, a file restricted to mode &lt;code&gt;640&lt;/code&gt; or &lt;code&gt;600&lt;/code&gt; owned by &lt;code&gt;root&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/shadow
&lt;span class="nb"&gt;cat&lt;/span&gt;: /etc/shadow: Permission denied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This permission denial is complete mediation working as intended.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Modern Threat: CWE-798 and Hard-Coded Credentials
&lt;/h3&gt;

&lt;p&gt;While system password hashes were moved to shadow files, application credentials frequently remain in flat files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CWE-798&lt;/strong&gt;: Use of Hard-coded Credentials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CWE-312&lt;/strong&gt;: Cleartext Storage of Sensitive Information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CWE-256&lt;/strong&gt;: Plaintext Storage of a Password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 2022, according to published threat research by CyberArk and public disclosures, an adversary compromised an internal network share at Uber. In a PowerShell script stored in a readable folder, the intruder located hard-coded credentials for an administrative service account. Those static credentials provided access to the enterprise's privileged access management vault. No vulnerability exploit was required; the adversary simply read a file that was exposed through lax discretionary access controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Turning the Tables: The Honeytoken Strategy
&lt;/h3&gt;

&lt;p&gt;In 2003, Brazilian researcher Augusto Paes de Barros introduced the concept of the &lt;strong&gt;honeytoken&lt;/strong&gt;: an attractive piece of data (a credential, API key, or database record) that has no legitimate operational purpose.&lt;/p&gt;

&lt;p&gt;Defenders deploy canary credentials into filesystem paths where intruders typically hunt (&lt;code&gt;~/.aws/credentials&lt;/code&gt;, &lt;code&gt;archive/credentials&lt;/code&gt;, &lt;code&gt;.env&lt;/code&gt;). When an adversary discovers and attempts to authenticate using the token, the central authentication system triggers an immediate, high-fidelity security alert. Through honeytokens, the attacker's enumeration loop is transformed into a detection tripwire.&lt;/p&gt;




&lt;h2&gt;
  
  
  Theory: The Theory Behind the Loop
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Synthesizing the practical workflow with fundamental computer science principles.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every command executed in the first sixty seconds of an engagement directly probes a core operating system structure:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Who am I? (&lt;code&gt;whoami&lt;/code&gt;)&lt;/strong&gt; $\rightarrow$ Queries the process subject credentials evaluated by the reference monitor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where am I? (&lt;code&gt;pwd&lt;/code&gt;)&lt;/strong&gt; $\rightarrow$ Establishes the current namespace node in the rooted directory hierarchy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What is here? (&lt;code&gt;ls -la&lt;/code&gt;)&lt;/strong&gt; $\rightarrow$ Probes the directory table and maps visible and hidden inode entries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What can I do? (&lt;code&gt;stat&lt;/code&gt;)&lt;/strong&gt; $\rightarrow$ Evaluates the compressed access matrix governing subject-object interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What is the content? (&lt;code&gt;file&lt;/code&gt; / &lt;code&gt;cat -A&lt;/code&gt;)&lt;/strong&gt; $\rightarrow$ Treats files as raw byte streams while guarding against terminal control injection.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Defensive Mirror
&lt;/h3&gt;

&lt;p&gt;For every offensive discovery action, there is a corresponding defensive control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adversary queries process identity $\rightarrow$ Defender monitors suspicious account enumeration via &lt;code&gt;auditd&lt;/code&gt; or EDR.&lt;/li&gt;
&lt;li&gt;Adversary enumerates directory entries $\rightarrow$ Defender enforces strict DAC modes and restricts directory traverse bits.&lt;/li&gt;
&lt;li&gt;Adversary hunts for credentials $\rightarrow$ Defender implements automated secrets management (HashiCorp Vault, AWS Secrets Manager) and deploys honeytoken tripwires.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Quiet Trap
&lt;/h2&gt;

&lt;p&gt;A quiet trap is an operational failure mode that executes without generating an error message, leading the analyst to incorrect conclusions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;notes.txt | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'rotate'&lt;/span&gt;
todo: rotate keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command appears to succeed. However, because &lt;code&gt;notes.txt&lt;/code&gt; originated from a Windows environment, it contains carriage returns (&lt;code&gt;\r&lt;/code&gt;). If we extract the token into an environment variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;notes.txt | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 1 | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $2}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; https://api.internal/auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTTP request fails or corrupts the header because the carriage return is treated as a header termination delimiter.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Rule of Thumb
&lt;/h3&gt;

&lt;p&gt;Whenever inspecting text files on an unknown system, always verify line endings using &lt;code&gt;file&lt;/code&gt; or &lt;code&gt;cat -A&lt;/code&gt;. If CRLF terminators are detected, sanitize the file using &lt;code&gt;dos2unix&lt;/code&gt; or &lt;code&gt;tr -d '\r'&lt;/code&gt; before passing values to downstream tools.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why These Concepts Matter
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rooted Simplicity&lt;/strong&gt;: Understanding that directories are simple tables mapping names to inodes demystifies filesystem navigation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Boundaries&lt;/strong&gt;: Recognizing that the kernel respects numeric UIDs rather than shell variables prevents reliance on spoofable user-space data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discretionary Vulnerabilities&lt;/strong&gt;: Discretionary access control places the burden of protection on individual users, making configuration drift and credential exposure inevitable in large environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detection Engineering&lt;/strong&gt;: Understanding that enumeration produces a distinct telemetry trail enables defenders to build high-fidelity behavioral detection rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Orientation First&lt;/strong&gt;: Never run automated scripts before manually confirming identity (&lt;code&gt;whoami&lt;/code&gt;) and location (&lt;code&gt;pwd&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Always Use &lt;code&gt;ls -la&lt;/code&gt;&lt;/strong&gt;: Default directory listings conceal dot-files where sensitive configuration and credentials reside.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check Directory Execute Bits&lt;/strong&gt;: Reading a directory requires &lt;code&gt;r&lt;/code&gt;, but accessing files inside it requires &lt;code&gt;x&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identify Before Reading&lt;/strong&gt;: Use &lt;code&gt;file&lt;/code&gt; and &lt;code&gt;cat -A&lt;/code&gt; to avoid terminal corruption and detect hidden carriage return traps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credentials in Files Are Real&lt;/strong&gt;: MITRE ATT&amp;amp;CK technique T1552.001 remains a primary initial compromise vector in real-world breaches.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The BreachLab Journey Continues
&lt;/h2&gt;

&lt;p&gt;Level 0 establishes the orientation baseline. In subsequent levels of the Ghost track, the challenges become progressively more constrained:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Level 1 introduces unusual filename syntax (spaces, special characters, leading hyphens) that breaks naive shell command lines.&lt;/li&gt;
&lt;li&gt;Subsequent levels introduce restricted shells, custom binaries, network listener inspection, and cron automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The orientation loop mastered here—identifying identity, location, and readable surface—remains identical across every level of the wargame and every enterprise network engagement.&lt;/p&gt;




&lt;h2&gt;
  
  
  Follow along with the complete playlist
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/playlist?list=PLUep6spDxjvo" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLUep6spDxjvo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Platform
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BreachLab&lt;/strong&gt;: &lt;a href="https://breachlab.org" rel="noopener noreferrer"&gt;https://breachlab.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ghost Track Level 0&lt;/strong&gt;: &lt;a href="https://breachlab.org/tracks/ghost/i/0" rel="noopener noreferrer"&gt;https://breachlab.org/tracks/ghost/i/0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Platform Rules&lt;/strong&gt;: &lt;a href="https://breachlab.org/rules" rel="noopener noreferrer"&gt;https://breachlab.org/rules&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support BreachLab&lt;/strong&gt;: &lt;a href="https://liberapay.com/breachlab/donate" rel="noopener noreferrer"&gt;https://liberapay.com/breachlab/donate&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;BreachLab is an independent platform dedicated to hands-on cybersecurity education. If content built on its tracks earns revenue, consider supporting the platform via Liberapay to keep it free and accessible for everyone.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Repository
&lt;/h2&gt;

&lt;p&gt;Follow along with the source code and production pipeline tools in the official repository:&lt;br&gt;
&lt;a href="https://github.com/Someone-anon-coder" rel="noopener noreferrer"&gt;https://github.com/Someone-anon-coder&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow the Complete Series
&lt;/h2&gt;

&lt;p&gt;Access every written guide and theoretical deep dive in the official Medium publication series:&lt;br&gt;
&lt;a href="https://computer-info-1.medium.com/list/breachlab-ghost-i-24dad052016f" rel="noopener noreferrer"&gt;https://computer-info-1.medium.com/list/breachlab-ghost-i-24dad052016f&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explore My Other Learning Series
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/arbiter-java-20daa21849c8" rel="noopener noreferrer"&gt;Arbiter Guide&lt;/a&gt; — Advanced Java Systems Architecture&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/arbiter-java-theory-13ecf0e21149" rel="noopener noreferrer"&gt;Arbiter Guide Theory&lt;/a&gt; — Theoretical Foundations of Distributed Java&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/cybersecurity-cba13dd0be16" rel="noopener noreferrer"&gt;Cybersecurity&lt;/a&gt; — Offensive Security, Wargames, and Threat Analysis&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/python-guide-8e0b3bcab940" rel="noopener noreferrer"&gt;Python Guide&lt;/a&gt; — Python Systems &amp;amp; Automation&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/python-guide-theory-81528784ebfe" rel="noopener noreferrer"&gt;Python Guide Theory&lt;/a&gt; — Python Internals, CPython VM, and Runtime Design&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/golang-guide-e70e25ca8b42" rel="noopener noreferrer"&gt;GoLang Guide&lt;/a&gt; — High-Performance Concurrency in Go&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/golang-guide-theoretical-082d8e7624ab" rel="noopener noreferrer"&gt;GoLang Guide Theory&lt;/a&gt; — Go Runtime, Memory Model, and Scheduler Internals&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/my-progress-matplotlib-669052e8da38" rel="noopener noreferrer"&gt;Matplotlib&lt;/a&gt; — Visual Analytics &amp;amp; Data Presentation&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://computer-info-1.medium.com/list/breachlab-ghost-i-24dad052016f" rel="noopener noreferrer"&gt;BreachLab · Ghost I&lt;/a&gt; — Level-by-Level Practical &amp;amp; Theoretical Walkthroughs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Ritchie, D. M., &amp;amp; Thompson, K. (1974). &lt;em&gt;The UNIX Time-Sharing System&lt;/em&gt;. Communications of the ACM, 17(7), 365–375. &lt;a href="https://www.nokia.com/bell-labs/about/dennis-m-ritchie/manintro.html" rel="noopener noreferrer"&gt;https://www.nokia.com/bell-labs/about/dennis-m-ritchie/manintro.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Filesystem Hierarchy Standard Group. (2015). &lt;em&gt;Filesystem Hierarchy Standard (FHS 3.0)&lt;/em&gt;. Linux Foundation. &lt;a href="https://refspecs.linuxfoundation.org/fhs" rel="noopener noreferrer"&gt;https://refspecs.linuxfoundation.org/fhs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Ylönen, T., &amp;amp; Lonvick, C. (2006). &lt;em&gt;The Secure Shell (SSH) Protocol Architecture&lt;/em&gt; (RFC 4251). Internet Engineering Task Force. &lt;a href="https://www.rfc-editor.org/rfc/rfc4251" rel="noopener noreferrer"&gt;https://www.rfc-editor.org/rfc/rfc4251&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Saltzer, J. H., &amp;amp; Schroeder, M. D. (1975). &lt;em&gt;The Protection of Information in Computer Systems&lt;/em&gt;. Proceedings of the IEEE, 63(9), 1278–1308. &lt;a href="https://www.cs.virginia.edu/%7Eevans/cs551/saltzer/" rel="noopener noreferrer"&gt;https://www.cs.virginia.edu/~evans/cs551/saltzer/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Lampson, B. W. (1974). &lt;em&gt;Protection&lt;/em&gt;. ACM Operating Systems Review, 8(1), 18–24. &lt;a href="https://bwlampson.site/08-Protection/WebPage.html" rel="noopener noreferrer"&gt;https://bwlampson.site/08-Protection/WebPage.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Morris, R., &amp;amp; Thompson, K. (1979). &lt;em&gt;Password Security: A Case History&lt;/em&gt;. Communications of the ACM, 22(11), 594–597. &lt;a href="https://www.passwordresearch.com/papers/paper41.html" rel="noopener noreferrer"&gt;https://www.passwordresearch.com/papers/paper41.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Scarfone, K., Souppaya, M., Cody, A., &amp;amp; Orebaugh, A. (2008). &lt;em&gt;Technical Guide to Information Security Testing and Assessment&lt;/em&gt; (NIST SP 800-115). National Institute of Standards and Technology. &lt;a href="https://csrc.nist.gov/pubs/sp/800/115/final" rel="noopener noreferrer"&gt;https://csrc.nist.gov/pubs/sp/800/115/final&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hutchins, E. M., Cloppert, M. J., &amp;amp; Amin, R. M. (2011). &lt;em&gt;Intelligence-Driven Computer Network Defense Informed by Analysis of Adversary Campaigns and Intrusion Kill Chains&lt;/em&gt;. Lockheed Martin Corporation. &lt;a href="https://www.lockheedmartin.com/en-us/capabilities/cyber/cyber-kill-chain.html" rel="noopener noreferrer"&gt;https://www.lockheedmartin.com/en-us/capabilities/cyber/cyber-kill-chain.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MITRE Corporation. (2015). &lt;em&gt;Discovery (TA0007) — Enterprise Matrix&lt;/em&gt;. MITRE ATT&amp;amp;CK. &lt;a href="https://attack.mitre.org/tactics/TA0007/" rel="noopener noreferrer"&gt;https://attack.mitre.org/tactics/TA0007/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MITRE Corporation. (2006). &lt;em&gt;CWE-798: Use of Hard-coded Credentials&lt;/em&gt;. Common Weakness Enumeration. &lt;a href="https://cwe.mitre.org/data/definitions/798.html" rel="noopener noreferrer"&gt;https://cwe.mitre.org/data/definitions/798.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CyberArk Labs. (2022). &lt;em&gt;Unpacking the Uber Breach: Technical Threat Analysis&lt;/em&gt;. CyberArk Software. &lt;a href="https://www.cyberark.com/resources/threat-research/unpacking-the-uber-breach" rel="noopener noreferrer"&gt;https://www.cyberark.com/resources/threat-research/unpacking-the-uber-breach&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;This article was prepared with AI assistance. The companion video's narration is synthesized speech and the presenter is an animated illustration, not a real person. This guide teaches methodology and intentionally does not reveal wargame solutions or passwords.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;In the next installment, we tackle &lt;strong&gt;Level 1: Name Game&lt;/strong&gt;. We confront filenames containing whitespace, special escape sequences, and leading dashes, exploring how the shell's argument parsing treats options and filenames, and how operators manipulate files that seem impossible to open.&lt;/p&gt;

&lt;p&gt;Happy hacking!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;Cybersecurity&lt;/code&gt;, &lt;code&gt;Linux&lt;/code&gt;, &lt;code&gt;Ethical Hacking&lt;/code&gt;, &lt;code&gt;Beginners&lt;/code&gt;, &lt;code&gt;Computer Science&lt;/code&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>linux</category>
      <category>beginners</category>
      <category>security</category>
    </item>
  </channel>
</rss>
