Github Link: https://github.com/ChrisTruncer/Egress-Assess
On a variety of occasions, our team will attempt to extract data from the network we are operating in and move it to another location for offline analysis. Ideally, the customer that is being assessed will detect the data being extracted from their network and take preventive measures to stop further data loss.
When looking to copy data off of our target network, an attacker can do so over a variety of channels:
- Download data through Cobalt Strike’s Beacon (over http or dns)
- Download data through a Meterpreter Session
- Manually moving data over FTP, SFTP, etc.
While we routinely inspect and analyze data from the customer environment in order to aid in lateral movement, we also provide customers data exfiltration testing as a service. Performing a data exfiltration exercise can be a valuable service to a customer who wants to validate if their egress detection capabilities can identify potentially sensitive data leaving their network.
I wanted to come up with an easy to use solution that would simulate the extraction of sensitive data from my machine to another. While trying to plan out a tool, I targeted a few protocols commonly used by attackers: FTP, HTTP, and HTTPS. To ensure that I could generate “sensitive” data that would be discovered during defensive operations, I needed to identify what multiple organizations would highly value. Two different sensitive data types that would likely have signatures across organizations are social security numbers and credit card numbers and I decided to target those forms of data in my proof of concept.
After spending a couple days piecing bits of code together, I am happy to release Egress-Assess.
Egress-Assess can act as both the client and the server for the protocol you wish to simulate. It supports exfiltration testing over HTTP, HTTPS, and FTP. I envision the tool being used on an internal client and an external server where data would be passed over network boundaries. Once cloned from the repository, the dummy data can be transferred from one machine to another.
To extract data over FTP, you would first start Egress-Assess’s FTP server by placing it in server mode with the ftp and providing a username and password to use:
./Egress-Assess.py --server ftp --username testuser --password pass123
Running that command should start something similar to the following:
This shows that the FTP server is up and running. With this going, all we need to do now is configure the client to connect to the server! This is simple, can can be done by telling Egress-Assess to act in client mode and use ftp, provide the username and password to use, the ip to connect to, and the datatype to transmit (in this case, social security numbers). Your output should look similar to the following…
./Egress-Assess.py --client ftp --username test --password pass --datatype ssn --ip 192.168.63.149
Within the same directory as Egress-Assess, a “data” directory will be created. Within it is where all transmitted files will be stored. At this point, the transfer is complete via FTP!
You can also do the same over HTTP or HTTPS. Again, the first step will be starting one instance to act as the server in http mode.
./Egress-Assess.py --server http
This will now start a web server to listen on port 80. The next step is to have your client generate new dummy data, and send it to the web server. Only this time, we’ll change it up by specifying the approximate amount of data we want to generate.
By default, Egress-Assess will generate approximately 1 megabyte of data (either social security numbers or credit card numbers). This amount can be changed using the “–data-size” flag. If we want to send approximately 15 megabytes of credit card data to our web server over http, the command may look as follows…
./Egress-Assess.py --client http --data-size 15 --ip 192.168.63.149 --datatype cc
As you can see above, the file was transferred, and our web server received the file!
That about rounds out the current state of Egress-Assess. Future revisions will include making a more modularized tool so users can easily add support for new protocols, and new data types for transfer. If there are any other requests, I’d love to hear them!