<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Vidul Nikolaev Petrov: getting root acccess without sudo</title>
    <link>http://www.vidul.com/articles/2007/12/29/getting-root-acccess-without-sudo</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>getting root acccess without sudo</title>
      <description>&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_C "&gt;#include &amp;lt;sys/types.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

int main(int argc, char** argv)
{
    int root_id = 0;
    char *command = argv[1];

    if(!command)
        command = &amp;quot;/bin/bash&amp;quot;;

    setuid(root_id);
    system(command);
    exit(0);
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;strong&gt;root#&lt;/strong&gt; gcc -o temproot temproot.c&lt;br/&gt;
&lt;strong&gt;root#&lt;/strong&gt; chmod +s temproot&lt;br/&gt;
&lt;strong&gt;nobody$&lt;/strong&gt; alias root=&amp;#8217;temproot &amp;#8220;su &amp;#8211; root&amp;#8221;&amp;#8217;&lt;br/&gt;
&lt;strong&gt;nobody$&lt;/strong&gt; root</description>
      <pubDate>Sat, 29 Dec 2007 08:31:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:488cc02b-d10e-4a33-bff6-bed3be3dee86</guid>
      <author>root</author>
      <link>http://www.vidul.com/articles/2007/12/29/getting-root-acccess-without-sudo</link>
      <category>programming</category>
      <category>administration</category>
    </item>
  </channel>
</rss>
