<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2016:09:20</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Wed, 06 May 2026 11:51:28 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>root_via_docker</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2016:09:20:root_via_docker</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;root_via_docker&quot;&gt;2016-09-20 - root via docker&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.baszerr.eu/lib/exe/detail.php?id=blog%3A2016%3A09%3A20%3Aroot_via_docker&amp;amp;media=blog:2016:09:20:docker_logo.png&quot; class=&quot;media&quot; title=&quot;blog:2016:09:20:docker_logo.png&quot;&gt;&lt;img src=&quot;https://www.baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=2c78d9&amp;amp;media=blog:2016:09:20:docker_logo.png&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;docker&amp;#039;s logo&quot; alt=&quot;docker&amp;#039;s logo&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
there are a lot of discussions regarding docker and its security features. there are two main aspects here:
&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; can application, started as a non-root, inside a container, escape from it?&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; can we gain root access by having an access to docker?&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
in this post i&amp;#039;d like to quickly answer 2nd question. just try this one out:
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;docker run &lt;span class=&quot;re5&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;etc&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;:&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;mnt debian:stable
&lt;span class=&quot;kw2&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;mnt&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;shadow &lt;span class=&quot;st_h&quot;&gt;&#039;s#^root:.*#root:YOUR_PROPERLY_ENCODED_PASSWORD_GOES_HERE:0:0:99999:7:::&#039;&lt;/span&gt;
&lt;span class=&quot;kw3&quot;&gt;exit&lt;/span&gt;
&lt;span class=&quot;kw2&quot;&gt;su&lt;/span&gt; &lt;span class=&quot;co0&quot;&gt;# type in your new password&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
and voila – you&amp;#039;re root now.
&lt;/p&gt;

&lt;p&gt;
how does it work? it&amp;#039;s simple – we&amp;#039;re mapping content of /etc/ from root filesystem (docker&amp;#039;s daemon can access it) as /mnt inside our (temporary) container. inside the container, with root privileges, we edit &lt;em&gt;shadow&lt;/em&gt; file, to set our own password.
&lt;/p&gt;

&lt;p&gt;
is it the only way to go? definitely NO! some more examples follow:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; map the whole / to /mnt and do &lt;em&gt;chroot&lt;/em&gt; into there – root there is!&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; export device with a filesystem to a container (eg. &lt;em&gt;–device=/dev/sda&lt;/em&gt;) and mount/hex-edit it there – and root there is!&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; map any directory you want to /mnt and just steal/change what you need w/o leaving additional traces.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
…and probably many more, alike. i think you get the point.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;long story short – giving any user access to docker daemon means effectively giving her a root access.&lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:21 +0000</pubDate>
        </item>
    </channel>
</rss>
