Code Monkey home page Code Monkey logo

flightsim's Introduction

Network Flight Simulator

flightsim is a lightweight utility used to generate malicious network traffic and help security teams to evaluate security controls and network visibility. The tool performs tests to simulate DNS tunneling, DGA traffic, requests to known active C2 destinations, and other suspicious traffic patterns.

Installation

Download the latest flightsim binary for your OS from the GitHub Releases page. Alternatively, the utility can be built using Golang in any environment (e.g. Linux, MacOS, Windows), as follows:

go install github.com/alphasoc/flightsim/v2@latest

Running Network Flight Simulator

Upon installation, test flightsim as follows:

$ flightsim --help

AlphaSOC Network Flight Simulator™ (https://github.com/alphasoc/flightsim)

flightsim is an application which generates malicious network traffic for security
teams to evaluate security controls (e.g. firewalls) and ensure that monitoring tools
are able to detect malicious traffic.

Usage:
    flightsim <command> [arguments]

Available commands:
    get         Get a list of elements (ie. families) of a certain category (ie. c2)
    run         Run all modules, or a particular module
    version     Prints the version number

Cheatsheet:
    flightsim run                   Run all the modules
    flightsim run c2                Simulate C2 traffic
    flightsim run c2:trickbot       Simulate C2 traffic for the TrickBot family
    flightsim run ssh-transfer:1GB  Simulate a 1GB SSH/SFTP file transfer

    flightsim get families:c2       Get a list of all c2 families

The utility runs individual modules to generate malicious traffic. To perform all available tests, simply use flightsim run which will generate traffic using the first available non-loopback network interface. Note: when running many modules, flightsim will gather destination addresses from the AlphaSOC API, so requires egress Internet access.

To list the available modules, use flightsim run --help. To execute a particular test, use flightsim run <module>, as below.

$ flightsim run --help
usage: flightsim run [flags] [modules]

To run all available modules, call:

    flightsim run

 To run a specific module:

    flightsim run c2

Available modules:

        c2, dga, imposter, miner, scan, sink, spambot, ssh-exfil, ssh-transfer, tunnel-dns, tunnel-icmp

Available flags:
  -dry
        print actions without performing any network activity
  -fast
        reduce sleep intervals between simulation events
  -iface string
        network interface or local IP address to use
  -size int
        number of hosts generated for each simulator

$ flightsim run dga

AlphaSOC Network Flight Simulator™  (https://github.com/alphasoc/flightsim)
The address of the network interface for IP traffic is 192.168.220.38
The address of the network interface for DNS queries is 192.168.220.38
The current time is 26-Oct-21 17:28:51

17:28:51 [dga] Generating a list of DGA domains
17:28:51 [dga] Resolving 6kauziij.com
17:28:52 [dga] Resolving paxeo0jk.biz
17:28:53 [dga] Resolving iuuub8al.biz
17:28:54 [dga] Resolving bxsei3nj.com
17:28:55 [dga] Resolving zbwltf1h.space
17:28:56 [dga] Resolving yoze7avi.com
17:28:57 [dga] Resolving ijax8aqw.space
17:28:58 [dga] Resolving wwrjyj4l.space
17:28:59 [dga] Resolving uioc5hky.com
17:29:00 [dga] Resolving lcwdji5t.biz
17:29:01 [dga] Resolving zluwcb4h.biz
17:29:02 [dga] Resolving 8jodcvhj.space
17:29:03 [dga] Resolving ju5haxur.com
17:29:04 [dga] Resolving ivthu2dl.biz
17:29:05 [dga] Resolving ha0bsxft.com
17:29:05 [dga] Done (15/15)

All done! Check your SIEM for alerts using the timestamps and details above.

The utility also has a get command which can be used to query information that can later be used with the simulation modules. At present, a list of C2 families can be obtained to be used with the C2 module. To see how to use the get command, run flightsim get -h as below.

$ flightsim get -h

AlphaSOC Network Flight Simulator™  (https://github.com/alphasoc/flightsim)
The current time is 26-Oct-21 17:42:23

usage: flightsim get [flags] element:category

Available elements:

        families

Available categories:

        c2

Available flags:

To get a list of C2 families, run:

$ flightsim get families:c2

AlphaSOC Network Flight Simulator™  (https://github.com/alphasoc/flightsim)
The current time is 16-Nov-21 11:16:51

11:16:51 [families:c2] Fetching c2 families
11:16:55 [families:c2] Adwind, Agent Tesla, Amadey, AsyncRAT, AZORult, BASHLITE, BazarBackdoor, BlackNET RAT, Cobalt Strike, Collector Stealer, CryptBot, DarkComet, DiamondFox, Dridex, Emotet, Gozi, IcedID, Kimsuky, KPOT Stealer, LokiBot, Mirai, NanoCore RAT, njRAT, Oski Stealer, Pony, Predator the Thief, Quakbot, RedLine, RedLine Stealer, Remcos RAT, Smoke Loader, Taurus, TrickBot, XtremeRAT, Zloader
11:16:55 [families:c2] Fetched 35 c2 families

All done!

Description of Modules

The modules packaged with the utility are listed in the table below.

Module Description
c2 Generates both DNS and IP traffic to a random list of known C2 destinations
cleartext Generates random cleartext traffic to an Internet service operated by AlphaSOC
dga Simulates DGA traffic using random labels and top-level domains
imposter Generates DNS traffic to a list of imposter domains
irc Connects to a random list of public IRC servers
miner Generates Stratum mining protocol traffic to known cryptomining pools
oast Simulates out-of-band application security testing (OAST) traffic
scan Performs a port scan of random RFC 5737 addresses using common TCP ports
sink Connects to known sinkholed destinations run by security researchers
spambot Resolves and connects to random Internet SMTP servers to simulate a spam bot
ssh-exfil Simulates an SSH file transfer to a service running on a non-standard SSH port
ssh-transfer Simulates an SSH file transfer to a service running on an SSH port
telegram-bot Generates Telegram Bot API traffic using a random or provided token
tunnel-dns Generates DNS tunneling requests to *.sandbox.alphasoc.xyz
tunnel-icmp Generates ICMP tunneling traffic to an Internet service operated by AlphaSOC

flightsim's People

Contributors

arkregiel avatar chrisforce1 avatar ioj avatar kmroz avatar krhubert avatar lastsalmonman avatar tg 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

flightsim's Issues

New release check

As pointed out by @chrisforce1 users being on old releases may experience various problems due to open-wisdom api changes and so on.

Let's check github's releases every time user executes flightsim (or daily, it doesn't matter) and if there's a new release let's print an information in CLI about it with a link to the release.

New module: c2-ip

Let's bring this one back. Contact me on Slack for details around the IP:port feed.

We'd connect to 10 C2 destinations and output would look something like this:

Time      Module   Description
--------------------------------------------------------------------------------
11:26:01  c2-ip    Starting
11:26:02  c2-ip    Preparing random sample of current C2 IP:port pairs
11:26:03  c2-ip    Connecting to 1.2.3.4:1192
11:26:04  c2-ip    Connecting to 2.3.4.5:443
11:26:05  c2-ip    Connecting to 3.4.5.6:71
...
11:26:09  c2-ip    Finished

New module: irc

We should connect to known IRC servers and generate traffic.

gh actions: further investigate if we can extract the target branch when pushing a tag

This would help ensure we don't kick off a release from something like flightsim@[email protected].

Can dump context as below:

foo.yml:
...
  jobs:
  ...
      steps:
        - name: Dump GitHub context
          env:
            GITHUB_CONTEXT: ${{ toJSON(github) }}
          run: echo "$GITHUB_CONTEXT"
        - name: Dump job context
          env:
            JOB_CONTEXT: ${{ toJSON(job) }}
          run: echo "$JOB_CONTEXT"
        - name: Dump steps context
          env:
            STEPS_CONTEXT: ${{ toJSON(steps) }}
          run: echo "$STEPS_CONTEXT"
        - name: Dump runner context
          env:
            RUNNER_CONTEXT: ${{ toJSON(runner) }}
          run: echo "$RUNNER_CONTEXT"
        - name: Dump strategy context
          env:
            STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
          run: echo "$STRATEGY_CONTEXT"
        - name: Dump matrix context
          env:
            MATRIX_CONTEXT: ${{ toJSON(matrix) }}
          run: echo "$MATRIX_CONTEXT"

invalid interface being used for DNS queries

flightsim tries to be smart and picks up external interface default for the internet traffic – this works fine for IP traffic simulators, but not necessarily for DNS. We had a situation lately (on AWS VM) where the default interface was in 10.0.0.0/8, but the DNS server was running under 127.0.0.53. As we were binding to 10.x.x.x, the whole DNS traffic was going into oblivion and was not registered by Route53.

We need to solve the problem above plus add some sort of reporting to detect such problems and let user know if DNS queries are not reaching any server.

Combine c2-dns and c2-ip modules into c2

We should combine them by taking 5 random FQDNs and 5 random IP:port pairs, then:

  • Resolving the FQDNs (as per c2-dns)
  • Connecting to the resolved IPs on TCP port 80 (new code)
  • Connecting to the 5 IP:port pairs (as per c2-ip)

docker support

Hi
Can you provide Dockerfile to run this tool on diffrent OS with docker image..

Thnaks

Version number incorrect

More than just a PR, the version/version.go file shows v0.0.0. See about changing this to match the version releases and have master show latest release.

New module: oast

We should generate OAST traffic patterns to random 33-character hostnames beneath these domains:

oast.pro
oast.live
oast.site
oast.online
oast.fun
oast.me
oastify.com

Here's an example of the FQDN format:

cfm1m19rm8es8h8k0ti0nk95987ojzy1s.oast.me
ccrq5f1br19caa000010rj578k1rxyofb.oast.pro
cflkmv5bf3v166000010mg9bup789oa3t.oast.online
cfmbem6d7l6ktb000010ayruwetaon435.oast.site

New module: miner

Let's create a module to check into random cryptomining pools using the Stratum protocol. We can use the CryptoIOC API to pull a live list of mining pool FQDNs and ports to use. Selecting 5 random servers should be sufficient for testing purposes. As below:

  • Pull 5 random FQDN:port pairs from the CryptoIOC API
  • Connect to them using the Stratum protocol and simply ping / check-in to each

New module: hijack

Attempt to perform the equivalent of this operation:

  • dig www.google.com @ns1.sandbox.alphasoc.xyz

We'll then set up a simple resolver (e.g. TinyDNS) on the server that only ever resolves www.google.com and we can test to see whether it's possible in customer environments for arbitrary name servers to be used by workstations (which can be used to facilitate DNS hijacking..)

Here's what it would look like in terms of terminal output:

Time      Module   Description
--------------------------------------------------------------------------------
09:30:28  hijack   Starting
09:30:28  hijack   Resolving www.google.com via ns1.sandbox.alphasoc.xyz
09:30:29  hijack   Success! DNS hijacking is possible in this environment
09:30:30  hijack   Finished

If the test fails, we'd serve this instead:

Time      Module   Description
--------------------------------------------------------------------------------
09:30:28  hijack   Starting
09:30:28  hijack   Resolving www.google.com via ns1.sandbox.alphasoc.xyz
09:30:29  hijack   Test failed (queries to arbitrary DNS servers are blocked)
09:30:30  hijack   Finished

Update hijack module to use OpenNIC servers

An increasing amount of malware is using non-ICANN domains (e.g. .bazar as used by Team9) for C2, which are resolved via OpenNIC servers that we mark within Wisdom as alt_dns. We should register alphasoc.bazar via EmerDNS and update the hijack module so that it:

  • selects 3 random OpenNIC servers from the alt_dns list
  • hits each on UDP port 53 with a request for alphasoc.bazar

New module: sink

We need to pull a list of sinkholed domains and IPs and connect out to them.

New module: sctp-exfil

SCTP can be used to bypass monitoring and filtering, along the lines of http://0x27.me/ssh/sctp/privacy/security/evasion/2015/07/27/SSH-Over-SCTP/. It's a different protocol than TCP or UDP, and I'd like to do some marketing around this at some point to raise awareness.

In this case, we'd do the following:

  • Set up the FTP service from #23 over SCTP
  • Configure the client to use SCTP, establish a session, and send data to the service

We'd want the module to report on success or failure, so that users can see whether SCTP is being blocked within their environment (similar to what we do with Tor, DNS tunneling, etc.)

Direct traffic to specific interface

Is there a way I can direct the traffic to a specific interface like you can with tcpreplay? I want to send the traffic to an interface I have a sensor attached directly to in order to sniff the traffic.

Allow for delay between modules

There was a request for configurable delay between modules, so it's easier to identify results in the SIEM.

Sounds as simple as adding a sleep in the loop.

New module: encrypted-dns

DNS tunneling over DNS-over-HTTPS (DoH) to *.sandbox.alphasoc.xyz via a random public server picked from the list below.

https://dns.google/dns-query
https://cloudflare-dns.com/dns-query
https://dns.quad9.net/dns-query
https://doh.opendns.com/dns-query
https://doh.powerdns.org -- shutdown planned for 15.09.2021 according to https://powerdns.org/doh/privacy.html

New module: base64-dns

As per https://github.com/krmaxwell/dns-exfiltration we should synthesize Base64 encoding and exfiltration of data to hostnames under base64.alphasoc.xyz, as below:

  1. Generate a long random binary value from /dev/random or similar
  2. Chop the value into pieces and encode each with Base64
  3. Ship each piece out over DNS (e.g. AAAAAAAAAAAxMjM0NTY3OA==.base64.alphasoc.xyz)

Module description for the table in the documentation as below.

Module Description
base64-dns Exfiltrates Base64-encoded data over DNS to *.base64.alphasoc.xyz

We should probably rename sandbox.alphasoc.xyz to tunnel.alphasoc.xyz too. Thoughts?

New module: ftp-exfil

We should synthesize a large outbound FTP transfer to a valid service endpoint that we control (e.g. ftp.sandbox.alphasoc.xyz) by using /dev/random or similar, establishing a connection, and uploading the content. Thinking of 100MB as the default, but it should be configurable.

New module: ssh-mask

We should generate SSH traffic to a legitimate service that we operate using a common non-SSH port number, selected randomly from this list, and send a significant amount of data from /dev/random or similar to synthesize data exfiltration.

25
80
110
143
443
445
465
587
993
995

New module: tor

This will require some research and integration. We'll need to have flightsim set up a Tor circuit.

Output would look something like this:

Time      Module   Description
--------------------------------------------------------------------------------
11:26:01  tor      Starting
11:26:01  tor      Establishing Tor circuit
11:26:04  tor      Success! Tor use is permitted in this environment
11:26:05  tor      Finished

And if the test fails:

Time      Module   Description
--------------------------------------------------------------------------------
11:26:01  tor      Starting
11:26:01  tor      Establishing Tor circuit
11:26:04  tor      Test failed (unable to establish Tor circuit)
11:26:05  tor      Finished

Bug in scan module

For sure you mistyped with a counter in scan.go
There should be 'j' instead of 'i'

This bug cause flightsim to connect to the same port 10 times in a row
image

Establish way of enumerating C2 families

Currently users can simulate different malware families (e.g. c2:trickbot) but there's no way for a user to list the available families within the tool, so they would have to guess or know ahead of time. If we can't display this within the tool itself, we should update the documentation so that the supported malware families are clear.

Build from source command

Minor issue in the readme.
The install command on the current version of go will be
"go install github.com/alphasoc/flightsim@latest"

Service SSH is down: ssh.sandbox-services.alphasoc.xyz

When attempting to run the ssh-transfer test, the SSH service is not active

The current time is 16-Feb-24 21:11:52

21:11:52 [ssh-transfer:6GB] Preparing to send randomly generated data to a standard SSH port
21:11:52 [ssh-transfer:6GB] Simulating an SSH/SFTP file transfer of 6442450944B (6.00GB) to ssh.sandbox-services.alphasoc.xyz:22
21:11:55 [ssh-transfer:6GB] ERROR: ssh.sandbox-services.alphasoc.xyz:22: [0B (0.00B) successfully transferred] Errors encountered:
        client alphasoc-1: unable to connect: dial tcp >35.211.33.16:22: connect: no route to host
        client alphasoc-0: unable to connect: dial tcp >35.211.33.16:22: connect: no route to host
21:11:55 [ssh-transfer:6GB] Done (0/1)

add prechecks

Add some concept of pre-checks. If interfaces are invalid, etc, die before running any simulations. Allow an override for this though (ie. --nochecks) or something along those lines.

New module: imposter

Would be useful to have an imposter module, so one can generate traffic to domains impersonating well known brands, e.g. offiec365.com, console.amazonaws-ec2.net etc.

add documentation for each module

We should somehow document each module so users know what they're for and why they're important. I had a will of describing new modules during the release notes, but these messages are not consumed by many people and are not long lasting – instead with every new module we should link to a documentation.

This could be either a single .md file, a series of files for each mode, or a wiki. I guess ideally these should be also available directly via CLI.

Make "go install @latest" install v2, not v1

The readme says flightsim can be installed using the following command:

go install github.com/alphasoc/flightsim@latest

However, it installs the latest v1 version (v1.1.1), not v2.

Feature Request

Whenever we use any module for eg. c2-dns. It generates 10 c2 domains. The no. of domains to be generated should be configurable by using some parameters

Sample Eg:- flightsim run c2-dns -n 20

IOC List

is there a list of IOCs I can use to make a rule for Elastic detection?

Problem with the hijack module

Please take a look and let's fix this up:


AlphaSOC Network Flight Simulator™ v1.0.4 (https://github.com/alphasoc/flightsim)
The IP address of the network interface is 172.20.10.2
The current time is 28-May-19 00:20:31

Time      Module   Description
--------------------------------------------------------------------------------
00:20:31  hijack   Starting
00:20:31  hijack   Resolving alphasoc.com via ns1.sandbox.alphasoc.xyz
00:20:31  hijack   Test failed (queries to arbitrary DNS servers are blocked)
00:20:32  hijack   Finished

All done! Check your SIEM for alerts using the timestamps and details above.

Reports as failed, but alphasoc.com resolves just fine using that name server, as below.

$ dig @ns1.sandbox.alphasoc.xyz alphasoc.com +short
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21

New module: spambot

We need to pick 10 random domains from this list and then, for each domain:

  1. perform the equivalent of dig mx <domain>
  2. take the first MX entry and resolve it to an IP
  3. attempt to connect to the IP on TCP port 25

Suggested output is as follows:

Time      Module   Description
--------------------------------------------------------------------------------
11:26:01  spambot  Starting
11:26:01  spambot  Preparing random sample of Internet mail servers
11:26:02  spambot  Resolving mx1.domain.com
11:26:03  spambot  Connecting to 1.2.3.4:25
11:26:04  spambot  Resolving mx2.domain.com
11:26:05  spambot  Connecting to 2.4.5.6:25
...
11:26:09  spambot  Resolving smtp.blah.com
11:26:10  spambot  Connecting to 3.4.5.6:25
11:26:11  spambot  Finished

We can improve this later to record successes and failures (like with do with the Tor module), but for now it'll be fine to resolve each of these domains to a mail exchanger, then connect to it on TCP port 25.

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.