Phishing for Access
There are two ways to carry out a phishing attack. One method involves using macros, while the other uses Windows library files. An attacker can gain access to the victim's system by employing these techniques. To execute a phishing attack using macros, the macros must be installed on the victim's machine via MS Word.
Using Windows Library files
For this attack, we have to set up a WebDAV server, a Python3 web server, a Netcat listener, and prepare the Windows Library and shortcut files.
A WebDAV server (Web Distributed Authoring and Versioning) is an extension of the HTTP protocol that allows users to remotely manage files on a server. It enables clients to upload, download, and modify files on a server using standard HTTP methods, often making it function similarly to a shared drive. WebDAV is used in applications where collaborative document editing, file sharing, or remote storage access is required.
1. Setting wsgidav server
Step 1:
Make a directory named as webdev. This will act as webDEV root directory.
mkdir webdevStep 2:
Locate the wsgidav as we will be using it to sending mail.
# Example:
locate wsgidav | head -n 1 # If not found then install it.
# Start the server.
/usr/bin/wsgidav --host=0.0.0.0 --port=80 --auth=anonymous --root /home/kali/assembling_pieces/beyond/webdav/2. Preparing Windows library file
We will create and name the Library file using Windows.
I will store the above code in a file named as config.Library-ms. (Change the IP address to your Kali Linux VPN IP.)
3. Creating a Shortcut for Reverse Shell Execution
In this guide, we'll create a shortcut file on the WINDOWS machine that, when double-clicked by a victim, downloads PowerCat and establishes a reverse shell.
Step 1: Locate and Serve PowerCat on Kali Linux
First, locate the powercat.ps1 script on Kali Linux, then start a Python web server in the directory where powercat.ps1 is stored.
Locate the file:
Start the server:
Step 2: Create the Shortcut on Windows machine
Now, create a shortcut that runs PowerCat and starts a reverse shell.
Right-click on the Desktop and select New > Shortcut.
In the shortcut target, use the following PowerShell command (adjusting the IP and port as necessary) and name the file as
install:
Step 3: Start Netcat Listener
Set up a Netcat listener on Kali to capture the incoming connection.
4. Creating Body content for mail
Make relevent body content for sending in mail and save it with name as body.txt in webdev.
Example:
In a real assessment we should also use passive information gathering techniques to obtain more information about a potential target. Based on this information, we could create more tailored emails and improve our chances of success tremendously.
5. Transferring file
Now, transfer the file you created to the WebDAV folder we set up earlier. You can use the /drive option with the xfreerdp tool for this transfer, or alternatively, you can use impacket-smbserver to accomplish the same task.
Copy the files to this share. (To avoid making shortcut cut and paste)
6. Sending mail
We can use the command below to send mail. We need to modify it according to scenarios.
For safety purposes, I have placed all the required files in the WebDAV folder.
-t or --to
Purpose: Specifies the recipient(s) of the email.
--from
Purpose: Sets the sender's email address.
--attach
Purpose: Attaches a file to the email.
Description: The
@symbol before the filename indicates that the fileconfig.Library-msshould be attached to the email.
--server
Purpose: Specifies the SMTP server to use for sending the email.
Description: Points Swaks to the SMTP server's IP address or hostname that will handle the email delivery.
--body
Purpose: Sets the body content of the email.
Description: The
@symbol beforebody.txttells Swaks to read the email body from the filebody.txt.
--header
Purpose: Adds custom headers to the email.
Description: Sets the email's subject line. You can add multiple headers by using this option multiple times.
--suppress-data
Purpose: Reduces the amount of output Swaks provides during the SMTP transaction.
Description: When enabled, Swaks will not display the full email content and attachments in the terminal, summarizing the SMTP interactions instead. This makes the output cleaner and focuses on the transaction steps rather than the data being sent.
-a or --auth with -p
Purpose: Enables authentication using a password.
Usage in Command:
-apDescription:
-atypically stands for authentication method, and combined with-p, it enables password-based authentication.In some contexts,
-amight require specifying the authentication mechanism (e.g.,--auth LOGIN), but here it seems combined with-pto prompt for a password.When executing the command, Swaks will prompt you to enter the password for the sender's email account (
[email protected]).
7. Check the Netcat listener.
Wait for some time and then check netcat listener for reverse shell.
Last updated