Git Product home page Git Product logo

egress-assess's Introduction

Egress-Assess

Egress-Assess is a tool used to test egress data detection capabilities.

Setup

To set up, run the included setup script, or perform the following:

  1. Install pyftpdlib
  2. Generate a server certificate and store it as "server.pem" on the same level as Egress-Assess. This can be done with the following command:

openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes

Usage

Blog posts are available here:

Typical use case for Egress-Assess is to copy this tool in two locations. One location will act as the server, the other will act as the client. Egress-Assess can send data over FTP, HTTP, and HTTPS.

To extract data over FTP, you would first start Egress-Assess’s FTP server by selecting “--server ftp” and providing a username and password to use:

./Egress-Assess.py --server ftp --username testuser --password pass123

Now, to have the client connect and send data to the FTP server, you could run...

./Egress-Assess.py --client ftp --username testuser --password pass123 --ip 192.168.63.149 --datatype ssn

Also, you can set up Egress-Assess to act as a web server by running....

./Egress-Assess.py --server https

Then, to send data to the FTP server, and to specifically send 15 megs of credit card data, run the following command...

./Egress-Assess.py --client https --data-size 15 --ip 192.168.63.149 --datatype cc

Other things of note:

  • dns_complete is an improved version of the DNS Server module. Using DNSLib, this module can listen and respond to requests from both TXT and A records, decode the requests utilizing the correct format, and write the output to a file.
  • SMB has an option for SMB2 support or not. Newer Windows10 systems typically have SMBv1 disabled. For this reason SMBv2 is the default, you can use the switch to disable SMBv2.

How the Protocols Attempt Exfil

  • SMTP - The client creates a mail message placing the data in the body of the message or if a file, as an attachment. The client then attempts to make an SMTP connection to the EgressAssess Server over port 25 (or an alternate port provided). The SMTP server does not require authentication and accepts the incoming connection and processes the email. The processing of the mail message takes the data from the body of the email or from the attached file in the mail message. This test does not attempt to send the email through the organizations email server.

  • SMTP_Outlook – (This module is only available in the PowerShell client). If an Outlook client has been previously configured, the PowerShell client creates a COM Object to Outlook (This may require a user to provide authentication depending on the configuration). The PowerShell client then will create a mail message with the data in the body of the email or if a file, as an attachment. Emails are sent from Outlook as the previously configured user. (Some security settings may notify the user that a program is trying to send emails in the background and needs to select allow). For this module to work an MX record needs to be created for the EgressAssess Server. The EgressAssess SMTP server accepts all email messages sent to the domain of the MX record and receives the email with the file attachments or the data as test in out the body of the email. Invoke-EssessAgress -Client SMTPOutlook -IP <domain of SMTP Sever> -NoPing -DataType "ssn"

  • ICMP - The data is broken up into bytes and base64 encoded and sent over the wire in an ICMP Type 8 ECHO request. the data is placed inside the data field of the packet. The ECHO requests are continuously made to the EgressAsess Server which receives the ICMP request and gathers the data and decodes it.

  • FTP - Data and files are upload to the EgressAssess FTP server following typical protocol usage. A username and password are used to access the server. See examples above.

  • SFTP - Data and files are uploaded following the SFTP protocol. A username and password are used to access the server.

  • HTTP(S) - Data and files are sent via a POST web request to the EgressAssess web server. For the Python client, the data is posted to http(s):///post_data.php and for the PowerShell Client the data is posted to http(s):///posh_file.php.

  • SMB - The EgressAssess Server (using Impacket's SimpleSMBserver) creates a /TRANSFER SMB Share. The client system connects to the share with no authentication and transfers the file. Just like connecting to a network share and copying a file over. There is the option to add a username and password for authentication as well if desired. As noted above, determine which system you are egressing from and their security policies to see if you can use the old vulnerable SMBv1 or need to enable SMBv2

  • DNS_TXT - Data and files are broken up into bytes and then converted to base64 and chunked into separate DNS TXT queries that are made at an IP address or Domain Name. The client attempts to connect directly to the EgressAssess Server and makes the DNS TXT query. The Server then filters the data out of the packets and decodes the data. In the PowerShell Client there is an option for Stacked queries. This will make up to 7 TXT queries in each DNS request at the server which increases the speed at which the data is exfilled.

  • DNS_Resolved - Data and files are broken up into bytes and then converted to base64. The data is then chunked up and used as a part of a DNS request to resolve a subdomain. <encoded_data>.domain.com. For this to work an NS record for the domain needs to be setup for the EgressAssess server. All the DNS requests are made to the systems set nameserver and ultimately reach the EgressAssess server that was previously setup. The EgressAssess server takes the data section from each request and puts the file back together.

egress-assess's People

Contributors

butlerallenj avatar christruncer avatar harleyqu1nn avatar john-rivers avatar khr0x40sh avatar l1ghtn1ng avatar leebaird avatar n03lx avatar piesecurity avatar raikia avatar rasta-mouse avatar ruddawg26 avatar rvrsh3ll avatar sethsec avatar sithari avatar trallgorm avatar xan7r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

egress-assess's Issues

SSL Certificate location

This is less of an issue and more like a comment on how to fix it, you mention to generate a server.pem "on the same level as Egress-Assess" but in the https web server code you specify the following certificate path
cert_path = helpers.ea_path() +\ '/protocols/servers/serverlibs/web/server.pem'
This results in the code not being able to find the certificate unless it is located here -> {EGRESS-PATH}/protocols/servers/serverlibs/web/server.pem.
You can easily fix that and even integrate the ssl certificate creation with the code itself.

Feature Request - Generate and output data to file

It would be a great feature to have to generate the fake data so that we could use it to zip up and upload to something like google drive, mega.nz, etc. As well as using native SSH clients (SCP) and FTP clients.

Invoke-EgressAssess -client none -Datatype cc -Size 50 -Outfile cc.txt

Transfer error when using the .ps1 using FTP/DNS client session.

VERBOSE: [] Testing server connection
VERBOSE: [
] Server is UP on .
VERBOSE: [] FTP Server Running on port 21.
VERBOSE: [
] Generating 50 MB of Credit Cards (1500000)...

[+] received output:
VERBOSE: [*] Uploading data..

[+] received output:
VERBOSE: [] Error, tranfer failed with error:
VERBOSE: Exception calling "UploadString" with "2" argument(s): "The remote server returned an error: 227 Entering passive mode (,234,183).
."
VERBOSE: [
] Exiting..

Tried with ufw fw rules in place and also opening up the server to allow any connection to and from FTP. Still the same error comes up.

Add Trojan communication features

I am a Chinese security researcher, very happy to use Egress-assessment, I would like to add gh0st Trojan simulation traffic, how to simulate the implementation?

--file not working with smb

  • Server
    ./Egress-Assess.py --server smb

  • Client
    ./Egress-Assess.py --client smb --file /root/secrets.txt --ip 10.0.0.10
    ##############################################################

smbclient \\10.0.0.10\DATA -N -c "put secrets.txt"
WARNING: The "syslog" option is deprecated
secrets.txt does not exist
[+] File Transmitted!
##############################################################

Notice that the file paths to secrets.txt are different.
Same thing works fine with https.

Identity data type issue...

The following command...
date; IEX (New-Object Net.Webclient).DownloadString('https://raw.githubusercontent.com/ChrisTruncer/Egress-Assess/master/Invoke-EgressAssess.ps1‘); Invoke-EgressAssess -client http -IP x.x.x.x -ResolveDNS -Proxy -Datatype identity -Size 5 -Loops 1 -Verbose; date;

Returns the following results...
Thursday, October 08, 2015 11:38:35 AM
VERBOSE: [] Testing server connection
VERBOSE: [
] Server is UP on secure.malofsky-schwartz.com.
VERBOSE: [*] HTTP Server Running on secure.malofsky-schwartz.com port 80.
VERBOSE: Uploading data...

VERBOSE: [] Transfer complete!
VERBOSE: [
] 0 loops remaining..
VERBOSE: Uploading data..

VERBOSE: [] Transaction Complete.
VERBOSE: [
] Exiting..
Thursday, October 08, 2015 11:38:38 AM

Error

When running the following command...
Invoke-EgressAssess -client http -IP X.X.X.X -ResolveDNS -Proxy -Datatype ssn -Size 5 -Loops 1 -Report c:\temp\report.txt -Verbose
I get this error...
VERBOSE: Report File = c:\temp\report.txt
Unable to find type [ordered]: make sure that the assembly containing this type is loaded.
At line:1019 char:34

  •         $EAreport = [ordered] <<<< @{
    
    • CategoryInfo : InvalidOperation: (ordered:String) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : TypeNotFound

Error

I am facing the timeout error on Exfiltration using HTTPS.

On Server:
p@kali:~/Egress-Assess$ sudo ./Egress-Assess.py --server https

On Client :
PS C:\Users\Egress-Assess-master> Invoke-EgressAssess -client https -datatype cc -Verbose -ip 9.73.2.1
VERBOSE: [] Testing server connection
VERBOSE: [
] Server is UP on 9.73.2.1.
VERBOSE: [*] Error, tranfer failed with error:
VERBOSE: Exception calling "Connect" with "2" argument(s): "A connection attempt failed because the connected party did not properly respond after a period of
time, or established connection failed because connected host has failed to respond 9.73.2.1:443"
PS C:\Users\Egress-Assess-master>

But when I browse 9.73.2.1:443 using browser, i can see the request. Any help.

Specify port for powershell client

It'd be nice if you could specify the port to send data on in the Powershell version. You can set the server port number for the listener server-side, but not the client-side. For example, I can't test FTP data over port 1234 because the powershell client doesnt accept an alternate port.

Append to Log File Feature Request

It would be cool to keep a running log somewhere on disk of the transfers that were done. The source IP, protocol, data size, type, etc. That way the user can reference it after the terminal has been closed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.