Setting up a server (in the attacking machine)
Protocol / app |
---|
smb server |
Apache server |
ngix |
symple python server |
php web server |
Ruby web server |
Burp Suite Collaborator |
Interactsh |
responder |
uploadserver |
Webdav wsgodav server |
FTP server |
FTP server
We may also host our script through the FTP protocol. We can start a basic FTP server with Python's pyftpdlib
, as follows:
smb server
Launch smbserver in our attacker machine:
Now, from PS in the victim's windows machine we could upload a folder to the shared folder in the attacker machine just by running:
Apache server
Once you have a folder structure such as "/var/www/" or "/var/www/html", and also an Apache server installed, you can serve all files from that path by initiating the service:
In Apache, the PHP module loves to execute anything ending in PHP. Also, by default, with Apache, if we hit a directory without an index file (index.html), it will list all the files.
nginx
In Apache, the PHP module loves to execute anything ending in PHP. This is not very safe when allowing HTTP
uploads, as we are trying to avoid that users cannot upload web shells and execute them.
Nginx server:
Debuggin nginx:
First check: ensure the directory listing is not enabled by navigating to http://localhost/SecretUploadDirectory
Second check: Is default port in nginx already in use?
Finally you can copy to your nginx server all files you want to transfer with curl:
Simple python server
PHP web server
Ruby Web Server
uploadserver
More at uploadserver.
Python's http.server extended to include a file upload page. Accepts the same options as http.server, plus a couple extras.
After the server starts, the upload page is at /upload. For example, if the server is running at http://localhost:8000/ go to http://localhost:8000/upload .
Warning: This is an upload server, and running it will allow uploads.
Repo: https://github.com/Densaugeo/uploadserver
Installation:
Basic usage:
openssl
Create a certificate in the attacker's machine:
Launch the openssl server in the attacker's machine:
Next, with the server running, we need to download the file from the compromised machine. So, download the file from the victim's machine: