<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><script src="https://www.rss.style/js/atom-style.js" xmlns="http://www.w3.org/1999/xhtml"/><title>Tower of Kubes</title><link rel="self" type="application/atom+xml" hreflang="en" href="https://www.towerofkubes.com/tags/security/feed.xml"/><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/tags/security/"/><link rel="alternate" type="application/rss+xml" hreflang="en" href="https://www.towerofkubes.com/tags/security/index.xml"/><id>/</id><updated>2026-01-13T00:00:00Z</updated><author><name>Ro'i Bandel</name></author><generator>Hugo 0.157.0</generator><entry><title>Claude Code Sandboxing</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/claude-code-sandboxing/"/><id>https://www.towerofkubes.com/articles/claude-code-sandboxing/</id><updated>2026-01-13T00:00:00Z</updated><summary type="html">Ways to run Claude Code in a sandbox</summary><content type="html"><![CDATA[<p>A couple of days ago, my coworker Roey Wullman wrote this article: <a href="https://www.develeap.com/claude-code-sandboxing-stop-babysitting-your-ai-assistant/roey/"  target="_blank" rel="noreferrer">Claude Code Sandboxing: Stop Babysitting Your AI Assistant</a> (published in <a href="https://www.develeap.com/magazine/"  target="_blank" rel="noreferrer">Develeap’s Magazine</a>).</p>
<p>This morning, I saw the latest announcement by Anthropic: <a href="https://claude.com/blog/cowork-research-preview"  target="_blank" rel="noreferrer">Introducing Cowork | Claude</a>, then read the <a href="https://news.ycombinator.com/item?id=46593022"  target="_blank" rel="noreferrer">comments on Hacker News</a>. Some of the comments discussed how secure Cowork is (or isn’t) and how it’s sandboxing works. Then other comments mentioned different approaches of sandboxing <a href="/articles/claude-sonnet-4.5-and-claude-code-2.0/" >Claude Code</a> (e.g. <a href="https://news.ycombinator.com/item?id=46594916"  target="_blank" rel="noreferrer">this comment</a> and <a href="https://news.ycombinator.com/item?id=46594059"  target="_blank" rel="noreferrer">these comments</a>).</p>

<h2 class="relative group">Ways to Sandbox Claude Code
    <div id="ways-to-sandbox-claude-code" class="anchor"></div>
    
</h2>
<ul>
<li><a href="https://www.develeap.com/claude-code-sandboxing-stop-babysitting-your-ai-assistant/roey/"  target="_blank" rel="noreferrer">Claude Code Sandboxing: Stop Babysitting Your AI Assistant - Develeap</a></li>
<li><a href="https://github.com/nezhar/claude-container"  target="_blank" rel="noreferrer">nezhar/claude-container: Container workflow for Claude Code. Complete isolation from host system while maintaining persistent credentials and workspace access.</a></li>
<li><a href="https://github.com/ashishb/amazing-sandbox"  target="_blank" rel="noreferrer">ashishb/amazing-sandbox: Amazing Sandbox  - inspired from https://ashishb.net/programming/run-tools-inside-docker/</a></li>
<li><a href="https://github.com/dagger/container-use"  target="_blank" rel="noreferrer">dagger/container-use: Development environments for coding agents. Enable multiple agents to work safely and independently with your preferred stack.</a></li>
<li><a href="https://github.com/mensfeld/claude-on-incus"  target="_blank" rel="noreferrer">mensfeld/claude-on-incus: Run coding agents in isolated Incus containers with session persistence, workspace isolation, and multi-slot support.</a></li>
</ul>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@markusspiske?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Markus Spiske</a> on <a href="https://unsplash.com/photos/green-and-black-tractor-toy-KU3lOAiP-tQ?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="claude" label="Claude" scheme="https://www.towerofkubes.com/tags/claude/"/><category term="ai" label="Ai" scheme="https://www.towerofkubes.com/tags/ai/"/><category term="llm" label="Llm" scheme="https://www.towerofkubes.com/tags/llm/"/><category term="security" label="Security" scheme="https://www.towerofkubes.com/tags/security/"/><published>2026-01-13T00:00:00Z</published></entry><entry><title>MCP Security</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/mcp-security/"/><id>https://www.towerofkubes.com/articles/mcp-security/</id><updated>2025-11-04T00:00:00Z</updated><summary type="html">How to harden MCP security: real-world horror stories, supply-chain risks, malicious servers, and practical defenses for agentic CLI tools.</summary><content type="html"><![CDATA[<p><a href="https://zivawernick.wixstudio.com/home"  target="_blank" rel="noreferrer">Ziva Wernick</a> did a Google AI workshop today and learned about MCP. She raised valuable concerns about MCP security and privacy.</p>
<ol>
<li><strong>Security:</strong> Has to do with the security risk of using MCP servers, and the possibility of those servers to facilitate malicious actions.</li>
<li><strong>Privacy:</strong> Has to do with AI tools constantly collecting private information. In some cases there may be an option to opt-out, or pay for an enterprise license that limits what the provider can do with the data.</li>
</ol>
<p>I will focus on <strong>Security</strong> in regards to how it works with <a href="/articles/agentic-cli-tools-comparison/" >agentic CLI tools</a> and MCP servers.</p>

<h2 class="relative group">MCP Horror Stories
    <div id="mcp-horror-stories" class="anchor"></div>
    
</h2>
<p><a href="https://www.docker.com/blog/"  target="_blank" rel="noreferrer">Docker Blog</a> wrote a series called <strong>MCP Horror Stories</strong>:</p>
<ol>
<li><strong>Part 1:</strong> <a href="https://www.docker.com/blog/mcp-security-issues-threatening-ai-infrastructure/"  target="_blank" rel="noreferrer">MCP Security Issues Threatening AI Infrastructure | Docker</a></li>
<li><strong>Part 2:</strong> <a href="https://www.docker.com/blog/mcp-horror-stories-the-supply-chain-attack/"  target="_blank" rel="noreferrer">MCP Horror Stories: The Supply Chain Attack | Docker</a></li>
<li><strong>Part 3:</strong> <a href="https://www.docker.com/blog/mcp-horror-stories-github-prompt-injection/"  target="_blank" rel="noreferrer">The GitHub Prompt Injection Data Heist | Docker</a></li>
<li><strong>Part 4:</strong> <a href="https://www.docker.com/blog/mpc-horror-stories-cve-2025-49596-local-host-breach/"  target="_blank" rel="noreferrer">MCP Horror Stories: The Drive-By Localhost Breach | Docker</a></li>
</ol>
<p>Unrelated to Docker, there’s also this article that features “Five Horror Stories That Actually Happened”: <a href="https://www.ajeetraina.com/the-day-i-told-800-engineers-their-ai-dreams-could-become-security-nightmares/"  target="_blank" rel="noreferrer">The Day I Told 800+ Engineers Their AI Dreams Could Become Security Nightmares</a></p>

    <div class="admonition abstract">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-288-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM112 256l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>
        <span>Five Horror Stories That Actually Happened 😱</span>
      </div>
      <div class="admonition-content">
        <ol>
<li>The GitHub Data Heist (CVSS: 9.6/10)</li>
<li>The mcp-remote Catastrophe (437,000 Environments Compromised)</li>
<li>Container Escape via Tool Poisoning (CVSS: 9.4/10)</li>
<li>The Great Secrets Exposure</li>
<li>WhatsApp MCP Shadowing</li>
</ol>
      </div>
    </div><hr>

    <div class="admonition info">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>
        <span>For more information on each “horror story”, read the full article:</span>
      </div>
      <div class="admonition-content">
        <p><a href="https://www.ajeetraina.com/the-day-i-told-800-engineers-their-ai-dreams-could-become-security-nightmares/"  target="_blank" rel="noreferrer">The Day I Told 800+ Engineers Their AI Dreams Could Become Security Nightmares</a></p>
      </div>
    </div>
<h2 class="relative group">First Malicious MCP in the Wild
    <div id="first-malicious-mcp-in-the-wild" class="anchor"></div>
    
</h2>
<p>On 2025-09-25, <a href="https://www.koi.ai/blog"  target="_blank" rel="noreferrer">Koi Blog</a> wrote this article: <a href="https://www.koi.ai/blog/postmark-mcp-npm-malicious-backdoor-email-theft"  target="_blank" rel="noreferrer">First Malicious MCP in the Wild: The Postmark Backdoor That’s Stealing Your Emails | Koi Blog</a></p>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Quote</span>
      </div>
      <div class="admonition-content">
        <p><code>postmark-mcp</code> - downloaded <strong>1,500 times every single week</strong>, integrated into hundreds of developer workflows. Since version <code>1.0.16</code>, it’s been quietly copying every email to the developer’s personal server. I’m talking password resets, invoices, internal memos, confidential documents - everything.</p>
<p>This is the <strong>world’s first sighting of a real world malicious MCP server</strong>. The attack surface for endpoint supply chain attacks is slowly becoming the enterprise’s biggest attack surface.</p>
      </div>
    </div><p>The article generated some discussion, including on Hacker News: <a href="https://news.ycombinator.com/item?id=45395957"  target="_blank" rel="noreferrer">A Postmark backdoor that’s downloading emails | Hacker News</a>. Some of the comments pointed out that the MCP risk isn’t really different from existing software risks:</p>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Quote</span>
      </div>
      <div class="admonition-content">
        <p>This has nothing to do with MCP really, the same flaw is there in all software: you have to trust the author and the distributor. Nothing stops Microsoft from copying all your Outlook mail. Nothing stops Google from copying all your gmail. Nothing stops the Mutt project from copying all your email. Open source users like to think that “many eyes” keep the code clean and they probably do help, especially on popular projects where all commits get reviewed in detail, but the chance is still there. And the rest of us just trust the developers. This problem is as old as software.</p>
      </div>
    </div>
<h2 class="relative group">Are MCP Security risks real or overblown?
    <div id="are-mcp-security-risks-real-or-overblown" class="anchor"></div>
    
</h2>
<p>MCP security <strong>risks are a real concern</strong> and I do not want to downplay that. In many ways though, these risks have existed for as long as software itself, MCP is just the latest attack vendor.</p>
<p>I will note that the blogs I featured here, from Docker and Koi Security, are from companies that attempt to sell solutions to this problem. This does not mean that the problem is not real or that the solutions are not needed, just something to note. I actually do find <a href="https://www.docker.com/products/mcp-catalog-and-toolkit/"  target="_blank" rel="noreferrer">Docker’s MCP solutions</a> to be very interesting (I mention <a href="https://hub.docker.com/mcp"  target="_blank" rel="noreferrer">Docker MCP Catalog</a> below in <a href="/articles/mcp-security/#supply-chain-security" >Supply-Chain Security</a>).</p>

<h2 class="relative group">MCP Defense
    <div id="mcp-defense" class="anchor"></div>
    
</h2>
<p>The article “<a href="https://www.ajeetraina.com/the-day-i-told-800-engineers-their-ai-dreams-could-become-security-nightmares/"  target="_blank" rel="noreferrer">The Day I Told 800+ Engineers Their AI Dreams Could Become Security Nightmares</a>” (mentioned above  in <a href="/articles/mcp-security/#mcp-horror-stories" >MCP Horror Stories</a>), suggests five defense solutions:</p>

    <div class="admonition abstract">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-288-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM112 256l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>
        <span>The Solution: Defense in Depth (That Actually Works) 🛡</span>
      </div>
      <div class="admonition-content">
        <ol>
<li>Component Isolation</li>
<li>️Attack Surface Reduction</li>
<li>Supply Chain Security</li>
<li>Input/Output Sanitization</li>
<li>WhatsApp MCP Shadowing</li>
</ol>
      </div>
    </div><hr>

    <div class="admonition info">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>
        <span>For more information on each solution, read the full article:</span>
      </div>
      <div class="admonition-content">
        <p><a href="https://www.ajeetraina.com/the-day-i-told-800-engineers-their-ai-dreams-could-become-security-nightmares/"  target="_blank" rel="noreferrer">The Day I Told 800+ Engineers Their AI Dreams Could Become Security Nightmares</a></p>
      </div>
    </div>
<h2 class="relative group">What I Do
    <div id="what-i-do" class="anchor"></div>
    
</h2>
<p>So far I have been limiting my MCP usage to personal projects and learning. Below are some of the things I have noted while learning about how to use MCP “safely”:</p>

<h3 class="relative group">Supply-Chain Security
    <div id="supply-chain-security" class="anchor"></div>
    
</h3>
<p>When Ziva asked about the MCP security risks, she was told to “read the code”. While it’s true that many MCP servers are open-source, reviewing all of them is not exactly feasible. I often do a surface level look at the repo, its activity and amount of stars, but this is not same as reviewing the code in-depth. For this reason, I believe it is worth using <strong>MCP servers by known publishers</strong>. Docker does come in handy here with their <a href="https://hub.docker.com/mcp"  target="_blank" rel="noreferrer">Docker MCP Catalog</a>. While, this catalog is not as extensive as other MCP galleries, it focuses on quality over quantity. All of the MCP servers are in the Docker MCP Catalog are by known publishers. Note that I still refuse to use Docker Desktop (due to its license), but these MCP servers can also be used in Docker CLI together with an MCP client.</p>

<h3 class="relative group">MCP Server Configuration
    <div id="mcp-server-configuration" class="anchor"></div>
    
</h3>
<p>Some MCP servers may have permissive default permissions, but can be configured to be more “locked-down” and limited and what they can do and access.</p>
<p>As an example, <a href="https://github.com/containers/kubernetes-mcp-server"  target="_blank" rel="noreferrer">Kubernetes MCP Server</a> can be run in <a href="https://github.com/containers/kubernetes-mcp-server?tab=readme-ov-file#configuration-options"  target="_blank" rel="noreferrer"><strong>read-only mode</strong></a> (this is not the default but can be set with a flag when setting up the MCP server). In this mode, the Kubernetes MCP server cannot make changes to clusters (for example, it is unable to apply manifests, but can still view existing resources). Note that even in this mode there can be security risks. One example is viewing secrets. In Kubernetes, secrets are stored in Base64 strings, which are trivial to decode for anyone that has full read access to the cluster. I have personally witnessed Claude Code attempt to read and decode Kuberenets Secrets (either with Kubernetes MCP Server or just <code>kubectl</code> commands) when asked to help troubleshoot my homelab cluster. For this reason, when using <a href="/articles/agentic-cli-tools-comparison/" >agentic CLI tools</a>, I prefer to approve each command individually. Further, Kubernetes access can be regulated with <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/"  target="_blank" rel="noreferrer">Role-based access control (RBAC)</a>.</p>

<h3 class="relative group">Ignore files
    <div id="ignore-files" class="anchor"></div>
    
</h3>
<p>Similar to <a href="https://git-scm.com/docs/gitignore"  target="_blank" rel="noreferrer"><code>.gitignore</code></a> files, most <a href="/articles/agentic-cli-tools-comparison/" >agentic CLI tools</a> have a way to exclude specific files from the context. For example, a <code>.env</code> file (that may include secrets), should be specifically excluded (when not doing this, I have seen Claude Code attempt to read these files). Unfortunately, there isn’t really a standard “ignore file” for this, each tool has it own way to achieve this. If using multiple tools, multiple files might be needed.</p>

<h4 class="relative group">Documentation on excluding/ignoring files
    <div id="documentation-on-excludingignoring-files" class="anchor"></div>
    
</h4>
<ul>
<li><a href="https://developers.google.com/gemini-code-assist/docs/create-aiexclude-file"  target="_blank" rel="noreferrer">Exclude files from Gemini Code Assist use  |  Google for Developers</a></li>
<li><a href="https://docs.claude.com/en/docs/claude-code/settings#excluding-sensitive-files"  target="_blank" rel="noreferrer">Claude Code settings - Claude Docs</a></li>
<li><a href="https://cursor.com/docs/context/ignore-files"  target="_blank" rel="noreferrer">Ignore files | Cursor Docs</a></li>
<li><a href="https://docs.github.com/en/copilot/how-tos/configure-content-exclusion/exclude-content-from-copilot"  target="_blank" rel="noreferrer">Excluding content from GitHub Copilot - GitHub Docs</a></li>
<li><a href="https://github.com/charmbracelet/crush?tab=readme-ov-file#ignoring-files"  target="_blank" rel="noreferrer">charmbracelet/crush: The glamourous AI coding agent for your favourite terminal 💘</a></li>
<li><a href="https://opencode.ai/docs/config/#watcher"  target="_blank" rel="noreferrer">Config | OpenCode</a></li>
</ul>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@flyd2069?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">FlyD</a> on <a href="https://unsplash.com/photos/red-and-black-love-lock-zAhAUSdRLJ8?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="mcp" label="Mcp" scheme="https://www.towerofkubes.com/tags/mcp/"/><category term="ai" label="Ai" scheme="https://www.towerofkubes.com/tags/ai/"/><category term="security" label="Security" scheme="https://www.towerofkubes.com/tags/security/"/><published>2025-11-04T00:00:00Z</published></entry></feed>