A Docker container is containment, not a credential boundary
The RubyGems story has a detail that keeps tripping me up. The "GemStuffer" gems didn't sneak payloads through gem install. They went through RubyDoc.info's documentation pipeline: publish a gem, it gets downloaded, YARD runs and executes whatever is in --load ./script.rb , inside a Docker container. The container was the containment story. It just wasn't a security boundary, because two things…
The RubyGems story reveals a critical flaw in using Docker containers as a means of containment. Unlike many believe, containers do not act as a secure credential boundary. Instead, they merely contain the blast radius to the contents within the sandbox. This becomes evident when examining the RubyDoc.info documentation pipeline, which downloads gems and executes any scripts within a Docker container.
However, two crucial factors remained accessible from within the container: network egress and the ability to scrape and exfiltrate data. Consequently, despite the containment shrinking the blast radius to what's inside the sandbox, the exposed credentials and existing sessions within the container still posed significant risks.
The exfiltration code, demonstrated by Tenderlove, involves making a GET request to rubygems.org, utilizing a regular expression to locate a cached key, and falling back to a global key if the regex proves unsuccessful. This flaw underscores the importance of evaluating both the egress and the internal reach of any contained environment.
Simply running untrusted code within a sandbox does not guarantee security; one must also scrutinize what the container is allowed to access and what keys it can potentially exploit. In essence, the real blast radius of any containment strategy lies in these overlooked aspects.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.