-
Notifications
You must be signed in to change notification settings - Fork 12
/
linux_privesc.sh
executable file
·119 lines (119 loc) · 3.55 KB
/
linux_privesc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
echo "+ - --=[Linux Privilege Escalation Script by 1N3@CrowdShield - https://crowdshield.com"
echo ""
echo "Whats the distribution type? What version?"
echo "#####################################################################"
cat /etc/issue
cat /etc/*-release
echo ""
echo "What's the Kernel version?"
echo "#####################################################################"
uname -a
echo ""
echo "What users are on the system?"
cat /etc/passwd
echo ""
cat /etc/group
echo ""
echo "#####################################################################"
echo "What services are running? Which service has which user"
echo "#####################################################################"
ps -auxxx | grep root
echo ""
echo "What applications are installed?"
echo "#####################################################################"
dpkg -l
rpm -qa
echo ""
echo "#####################################################################"
echo "Find configuration files for services..."
find /etc/ -name *.conf
echo ""
echo "What jobs are scheduled?"
echo "#####################################################################"
crontab -l
ls -alh /var/spool/cron
ls -al /etc/cron*
cat /etc/cron*
echo ""
echo "What NIC(s) does the system have?"
echo "#####################################################################"
echo "- Hostname"
hostname
echo "- Network Interfaces:"
/sbin/ifconfig -a
echo "- Routing info:"
/sbin/route
echo "- ARP Cache:"
arp -a
echo "- Current Network Connections:"
netstat -antup
echo ""
echo "What sudo commands can be ran?"
echo "#####################################################################"
sudo -l 2> /dev/null
echo ""
cat /etc/sudoers
echo ""
echo "Anything interesting in the home directorie(s)? If its possible to access"
echo "#####################################################################"
echo " - /root/"
ls -ahl /root/
echo ""
echo " - /home/"
ls -ahl /home/
echo "*** NOTE: Check for .bash_history files for clues, .ssh directories/keys and hidden directories/files for more clues..."
echo ""
echo "Can private-key information be found?"
echo "#####################################################################"
find /home/ -name authorized_keys
echo ""
find /home/ -name id_*
echo ""
find /root/ -name authorized_keys
echo ""
find /root/ -name id_*
echo ""
ls -lah /root/.ssh/
echo ""
echo "Any settings/files (hidden) on website?"
echo "#####################################################################"
ls -alh /var/www/
echo ""
echo "If commands are limited, you break out of the jail shell?"
echo "#####################################################################"
echo "python -c 'import pty;pty.spawn("/bin/bash")'"
echo "echo os.system('/bin/bash')"
echo "/bin/sh -i"
echo ""
echo "Are there any unmounted file-systems?"
echo "#####################################################################"
cat /etc/fstab
echo ""
echo "SUID OR GUID files..."
echo "#####################################################################"
find / -type f \( -perm -04000 -o -perm -02000 \) -exec ls -lh {} \; 2> /dev/null
echo ""
echo "What development tools/languages are installed/supported?"
echo "#####################################################################"
which perl
which gcc
which g++
which python
which php
which cc
which go
which node
echo ""
echo "How can files be uploaded?"
echo "#####################################################################"
which wget
which nc
which netcat
which scp
which ftp
which tftp
which curl
echo ""
echo "#####################################################################"
echo "Done!"