-
Notifications
You must be signed in to change notification settings - Fork 0
/
privesc_checks.py
54 lines (50 loc) · 1.77 KB
/
privesc_checks.py
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
#Author: Daniel Morales
#Version: 1.0
class PrivesChecks:
def __init__(self):
self.checks=[
{'id': 'sudo_check',
'command' : 'cat /etc/sudoers | grep -v "^#"',
'description': 'Review sudo configuration',
'remediation': 'Delete NOPASSWD configuration in sudoers file'
},
{'id': 'setuid_check',
'command' : 'find / -perm -4000 -type f 2>/dev/null',
'description': 'Find files with setuid enabled',
'remediation': 'Review and disable the unmnecesary setuid rights over the files'
},
{'id': 'kernel_check',
'command' : 'uname -r',
'description': 'Check kernel version',
'remediation': 'Upgrade kernel version to a not vulnerable version'
}
]
self.valid_setuid_files =(
'passwd',
'sudo',
'chsh',
'chfn',
'newgrp',
'gpasswd',
'mount',
'umount',
'ping',
'pppd',
'su',
'dbus-daemon-launch-helper',
'ssh-keysign',
'at',
'fusermount',
'pkexec',
'polkit-agent-helper-1',
'snap-confine',
'nslogin',
'fusermount3',
'pam_timestamp_check',
'unix_chkpwd',
'chage',
'grub2-set-bootflag')
def get_checks(self):
return self.checks
def get_valid_setuid_files(self):
return self.valid_setuid_files