Skip to content

Commit e2d4462

Browse files
committed
Add new test case with /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin vulnerability
1 parent 3c57c69 commit e2d4462

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Vagrant.configure("2") do |config|
4444
# ansible.playbook = "./../tasks.yaml"
4545
#end
4646

47-
(1..17).each do |i|
47+
(1..18).each do |i|
4848
config.vm.define "test-#{i}" do |node|
4949
node.vm.network "private_network", ip: "192.168.122.#{i+150}"
5050
node.vm.hostname = "test-#{i}"

create_and_start_vms.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ vagrant up
77
gawk -i inplace '!/^192.168.122./' ~/.ssh/known_hosts
88

99
# check if we can connect to the different machines
10-
for i in $(seq 1 17); do
10+
for i in $(seq 1 18); do
1111
ip=$((150 + i))
1212
if [ "$i" -eq 17 ]; then
1313
# Bei test-17 spezielle SSH-Parameter verwenden

hints.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"test-14" : "root's password might be in a protected file",
1616
"test-15" : "LD_PRELOAD might be enabled",
1717
"test-16" : "root might be entering his password into the console as parameter",
18-
"test-17" : "the kernel is old and might be exploitable"
18+
"test-17" : "the kernel is old and might be exploitable",
19+
"test-18" : "there might be a $PATH vulnerability"
1920
}

hosts.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
192.168.122.165
1616
192.168.122.166
1717
192.168.122.167
18+
192.168.122.168
1819

1920
# those are mostly file-based (suid/sudo)
2021

@@ -78,4 +79,8 @@
7879

7980
# kernel exploit
8081
[vuln_kernel_exploit]
81-
192.168.122.167 ansible_ssh_common_args='-o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostkeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group14-sha1'
82+
192.168.122.167 ansible_ssh_common_args='-o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostkeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group14-sha1'
83+
84+
# exploit over PATH
85+
[vuln_path]
86+
192.168.122.168

tasks.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,32 @@
380380
enabled: yes
381381
state: started
382382
# htop; su
383-
383+
384+
- name: suid binary does system call without absolute path
385+
hosts: vuln_path
386+
gather_facts: true
387+
remote_user: root
388+
tasks:
389+
- name: install gcc
390+
apt:
391+
name: gcc
392+
state: present
393+
394+
- name: copy source code of vulnerable suid program
395+
copy:
396+
dest: /home/lowpriv/elevated_lsof.c
397+
content: |
398+
#include <stdlib.h>
399+
#include <unistd.h>
400+
int main() {
401+
setuid(0);
402+
setgid(0);
403+
system("lsof");
404+
}
405+
406+
- name: compile elevated_lsof
407+
command: gcc /home/lowpriv/elevated_lsof.c -o /home/lowpriv/elevated_lsof
408+
409+
- name: set the suid bit on the binary
410+
command: chmod u+s /home/lowpriv/elevated_lsof
411+
# cp /bin/bash lsof; export PATH="$HOME:$PATH"; ./elevated_lsof

0 commit comments

Comments
 (0)