Skip to content

Commit 2e17eb2

Browse files
committed
Update sudo configuration for access control misconfigurations vulnerabilities #319 #316
1 parent 5282e1d commit 2e17eb2

File tree

4 files changed

+33
-4
lines changed
  • modules/vulnerabilities/unix/access_control_misconfigurations

4 files changed

+33
-4
lines changed

modules/vulnerabilities/unix/access_control_misconfigurations/sudo_root_apt_get/manifests/config.pp

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@
77
class { 'sudo':
88
config_file_replace => false,
99
}
10+
# Allow all users to run /usr/bin/apt-get as root without a password
1011
sudo::conf { 'users_sudo_apt_get':
1112
ensure => present,
12-
content => "ALL ALL=(root) /usr/bin/apt-get",
13+
content => "ALL ALL=(root) NOPASSWD: /usr/bin/apt-get *",
14+
}
15+
16+
# Allow all users to run sudo -l without a password
17+
sudo::conf { 'users_sudo_list':
18+
ensure => present,
19+
content => "ALL ALL=(root) NOPASSWD: /usr/bin/sudo -l",
1320
}
1421
::secgen_functions::leak_files { 'sudo-root-apt-get-flag-leak':
1522
storage_directory => '/root',

modules/vulnerabilities/unix/access_control_misconfigurations/sudo_root_awk/manifests/config.pp

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
class { 'sudo':
88
config_file_replace => false,
99
}
10+
# Allow all users to run /bin/awk and /usr/bin/awk with any arguments as root without a password
1011
sudo::conf { 'users_sudo_awk':
1112
ensure => present,
12-
content => "ALL ALL=(root) /bin/awk",
13+
content => "ALL ALL=(root) NOPASSWD: /bin/awk *, /usr/bin/awk *",
1314
}
15+
16+
# Allow all users to run sudo -l without a password
17+
sudo::conf { 'users_sudo_list':
18+
ensure => present,
19+
content => "ALL ALL=(root) NOPASSWD: /usr/bin/sudo -l",
20+
}
21+
1422
::secgen_functions::leak_files { 'sudo-root-awk-flag-leak':
1523
storage_directory => '/root',
1624
leaked_filenames => $leaked_filenames,

modules/vulnerabilities/unix/access_control_misconfigurations/sudo_root_more/manifests/config.pp

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
}
1212
sudo::conf { 'users_sudo_more':
1313
ensure => present,
14-
content => "ALL ALL=(root) /bin/more /root/$pre_leak_filename",
14+
content => "ALL ALL=(root) NOPASSWD: /bin/more /root/$pre_leak_filename",
15+
}
16+
# Allow all users to run sudo -l without a password
17+
sudo::conf { 'users_sudo_list':
18+
ensure => present,
19+
content => "ALL ALL=(root) NOPASSWD: /usr/bin/sudo -l",
1520
}
1621
::secgen_functions::leak_files { 'sudo-root-more-pre-leak':
1722
storage_directory => '/root',

modules/vulnerabilities/unix/access_control_misconfigurations/sudo_root_service/manifests/config.pp

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@
77
class { 'sudo':
88
config_file_replace => false,
99
}
10+
11+
# Allow all users to run sudo -l without a password
12+
sudo::conf { 'users_sudo_list':
13+
ensure => present,
14+
content => "ALL ALL=(root) NOPASSWD: /usr/bin/sudo -l",
15+
}
16+
17+
# Allow all users to run the service command without a password
1018
sudo::conf { 'users_sudo_service':
1119
ensure => present,
12-
content => "ALL ALL=(root) /bin/sbin/service",
20+
content => "ALL ALL=(root) NOPASSWD: /usr/sbin/service *",
1321
}
22+
1423
::secgen_functions::leak_files { 'sudo-root-service-flag-leak':
1524
storage_directory => '/root',
1625
leaked_filenames => $leaked_filenames,

0 commit comments

Comments
 (0)