Monday, October 29, 2018

Network Fuzzing through Mutiny Fuzzing Framework

Network Fuzzing through Mutiny Fuzzing Framework

Fuzzing provides a way to test for vulnerabilities through generating random data to push into an application. This can be used to test desktop applications, network applications, and just about anything else. I have seen plenty of other types of fuzzers for non-network applications. Mutiny Fuzzing Framework provides a easy to use network fuzzer.

Per the website, it allows to replay PCAPs through a mutational fuzzer. What the hell is a mutational fuzzer? It changes (or mutates) the specified data packets for every request send to a host. This mutation maybe applied to a legitimate, captured traffic stream, but it might also be applied to a generated package stream based on what the user needs. 

The video showing how it works with a simple python script, but the computer generated voice is hard to follow. There is plenty of documentation and source code on Github at Cisco-Talos/mutiny-fuzzer repo.

Wednesday, October 24, 2018

Forensics Workstation/Lab (pt 3. Hypervisor Installation)

Forensics Workstation/Lab (pt 3. Hypervisor Installation)

Part 1: Overview
Part 2: pfSense

For the hypervisor, I am using the following configuration:
  • Arch Linux (with default kernel)
  • i3wm - improved tiling wm - Arch Wiki
    • rofi - generic popup menu
    • i3status - notifications
    • i3bar - status bar
  • Oracle VirtualBox - type 2 hypervisor
  • aura (optional) - 3rd party package manager
I have been using Arch Linux for years and due to its small size, I am using it as the base operating system for the hypervisor. Also, I am installing the bare minimum software and customization for it because I do not need much to run in the base system (that's what the VM's are doing). 

Oracle VirtualBox is the best choice for an open source virtual machine manager. It is a type-2 hypervisor--meaning it runs within an operating system instead of directly on the machine (think VMWare eSXI or ZEN). The problem with type-1 hypervisors is the management of the VMs. You really need a second computer to setup, configure, and manage the VMs where as type-2, you can manage them directly on the system they are running.

The i3wm desktop is interesting piece of software. I usually stuck to XFCE4 (though, I have been using gnome a bit as well lately) and i3wm is completely different. i3wm takes little resources to run and provides a text based configuration files for whatever configuration you need. Also, it can be ran completely through shortcuts. One word of caution, dragging windows around does not work, you have to use the shortcut keys to arrange and management your application windows.

Aura has been my go-to package manager for a while now. Although, not required, I usually have it installed anyway. It provides more ways to manage packages from official repos and Arch Linux User Repo (AUR).

Installation

Installing Arch Linux is not hard but will take a while to get everything up and running. I am not going to go through a whole base installation for Arch Linux here. There are two good resources for installing Arch Linux:
  1. Installation Guide
  2. General Recommendations (post install)

Encryption

I plan to do encryption on the computer at some point. I just need to find something usable for Arch. I do not think LUKS will work in this scenario. 

Partitioning

Here is the partition that I used. It's using LVM (no encryption -- yet). Most of the space is given to the /data partition and I attempted to minimize the space for each mount location. 

For the partition format types, see this screenshot:
This how I choose to setup the partition based on how xfs and reiserfs work; of course, the default ext4 would work if you wanted to simplify the partitioning. 

Software

For software packages, remember KISS. I installed the following packages:
  • Package Groups
    • base
    • i3
  • Official Packages
    • rofi
    • networkmanager
    • network-manager-applet
    • iwd (replaces wpa_supplicant for NetworkManager)
    • firefox
    • nano
    • refind-efi
    • reflector
    • termite
    • virtualbox
    • virtualbox-ext-oracle
    • virtualbox-guest-iso
    • virtual-box-host-modules-arch
  • AUR Packages (optional)
    • aura-bin
      • This provides access to AUR packages as well as extra features not in Pacman. Read more on the Github Project page here.
    • reflector-timer
      • This creates a timer and service files to run reflector once per week automatically with a simple configuration file.
      • before you build this package, you will need the following packages installed:
        • binutils
        • fakeroot
    • rofi-dmenu
      • Provides automatically symlinking rofi to /usr/bin/dmenu.
For the package groups and official packages, those can be installed when doing pacstrap during the install stage of the Installation Guide. 

For the AUR packages, you need to first install the aura-bin package. To install this package perform the following setups:
  • From a terminal run the command: git clone https://aur.archlinux.org/aura-bin.git
  • Change directory into the 'aura-bin' folder.
  • Run the command: makepkg -irs --clean
    This will package up the application and install it in one setup.
  • You may remove the folder after installation.
Installation of AUR packages uses the '-A' flag instead of the normal pacman '-S' flag for official packages. You can read about aura options from Aura Readme on github.

Services

Enable and start the following services:
  • iwd.service
  • NetworkManager.service
  • reflector.timer

Networking

I am use the newer iwd service instead of wpa_supplicant. To enable NetworkManager to work with iwd, you need to create the file /etc/NetworkManager/conf.d/wifi_backend.conf with the following configuration:

[device]
wifi.backend=iwd

Note: "device" must be replaced with the name of your device, where in my case it is "wlp1s0". If you do not replace "device", NetworkManager will appear to not see your wifi card and give the status of "device not ready" when looking at the NM Applet. 

Virtualbox

After you install the virtualbox packages, ensure the computer is restarted at least once or load the virtualbox modules manually (see Virtualbox Documentation).

File Storage

To better organize the files on the system, all of the VM files are located within the '/data' folder/partition. I have the following layout.

/data
|-- ISOs
|-- VMs
    |
    |-- Arch Linux
    |
    |-- Kali Linux (Live CD)
    |
    |-- Sift Workstation
    |
    |-- paladin (Live CD)
    |
    |-- pfSense
|-- share
    |
    |-- forensics
    |
    |-- personal
    |
    |-- pfsense

The folders are self explanatory. For the /data/share, these are used to seperate each different type of VM. This can be loaded either Read Only or Read/Write while providing a method to pass information between different VMs.

Update (2019/7/5): Fixed the reflector.timer service name. I incorrectly stated it was 'reflector-timer.timer'

Monday, October 22, 2018

Forensic Workstation/Lab (pt. 2 pfsense)

Forensic Workstation/Lab (pt 2. pfsense)

Part 1 can be found here.

pfsense probably is the most well-known used used open-sourced Linux firewall appliance in used today. It provides an easy to use web page GUI and installation is extremely easy. However, someone could run iptables, ufw, or something else on choose your favor of Linux for a highly customized firewall solution without the GUI and pre-configured system.

Downloading and Installation

pfsense Comunity Edition is downloaded directly from the website: https://www.pfsense.org/download/

Then choosing the following options:

In Oracle VM VirtualBox Manager, create a new VM with the following settings:
  • name: pfSense
  • Type: BSD
  • Version: FreeBSD (64-bit)
  • Memory: 1024 MB (default)
  • Hard Drive: 7 GB
  • Network:
    • Adapter 1
      • Enabled
      • Attached to: Bridged Adapter
      • Name: <choose your PHY network adapter name>
      • Advanced > Promiscuous Mode > Allow VMs (needed?)
    • Adapter 2
      • Enabled
      • Attached to: Internal Network
      • Name: corp
    • Adapter 3
      • Enabled
      • Attached to: Internal Network
      • Name: untrusted
    • Adapter 4
      • Enabled
      • Attached to: Internal Network
      • Name: semi-trust
  • Storage:
    • Controller > CD/DVD Rom > Load pfSense ISO
After creating the VM, start the VM (Right Click > Start > Normal Start). Let the VM boot into the installer.

When the installer starts, follow these options:
  1. Accept the Copyright statement.
  2. Choose Install option and select OK.
  3. Keymap Selection: Continue with default keymap
    (Note: "US" is the default).
  4. Partitioning: Auto (UFS)
    (Note: I did not see a need to do some custom setup here but you can do custom partition by either directly in the shell or Manually).
  5. After a few minutes, the installation completed. 
  6. Manual Configuration: No
  7. In the VM Window, at the bottom of the screen, there is a set of icons, right click the "CD" icon and choose "Remove disk from virtual drive." If you get the force unmount prompt, hit "Yes"
  8. Complete: Reboot
After first boot, it will enter set of prompts:
  1. Should VLANs be setup now [y|n]? n
  2. Enter the WAN interface name or 'a' for auto-detection: a
  3. Do you want to proceed [y|n]? y
Next, I went ahead and setup the other interfaces. Select OPT 1 from the menu and you should see the following interfaces:
If these are missing then you need to modify your VM network settings as noted above before continuing.

Skip the VLAN configuration again.

Follow the prompts to setting the following settings per interface:
  • WAN - em0
  • LAN - em1
  • OPT1 (Option 1) - em2
  • OPT2 (Option 2) - em3
This sets each interface from Virtualbox to an interface for pfSense. Next, set the IP addresses, choose OPT 2 from the menu. Choose 3 different networks (one per interface):
  • em1 - 172.16.0.1/24
  • em2 - 172.16.4.1/24
  • em3 - 172.16.8.1/24
You can create smaller networks or different networks. I choose to use a 24-bit mask to make it easy and spacing the 3-rd octet out so I know exactly which network has what VMs on it.

Do not enable DHCP on any of the LANs. Apparently, in 2.4.4, there is a parse error and it will not take the configuration. 

Do not revert the webConfigurator to HTTP per the prompt that pops up. 

You will have the following interface configurations:
Now, it is time to configure it through the web interface.

Web Interface Configurations

Caveat: As soon as you configure a LAN IP Address, the web configuration can only be access from the LAN network and not the WAN network for security reasons. There are two things that can be done:
  1. Install and Configure the primary VM on the LAN (corp) network to provide access to the web configuration page.
  2. Download any Live Distro CD/DVD which has an interface and a web browser in it such as KALI, Linux Mint, Ubuntu, or others; then, setup a VM on the LAN (corp) to boot the Live Distro and provide the web browser access.
For this configuration, I am using Linux Mint Debian Edition. I set a manually IP address of 172.16.0.2 on the box (remember no DHCP configured yet on the LAN).

Use the default login: admin/pfsense

After logon, the pfSense Step wizard automatically starts. Keep the defaults except change the password at Step 6.

DNS Resolver

To Configure, go to Services > DNS Resolver > General Settings

Then, I change Network Interfaces by selecting all LAN, OPT1, and OPT2 IPV4 and IPV6 interfaces.

Then, I set the Outgoing Network Interfaces to only WAN.

Next, go to Setup > General Settings and uncheck "Allow DNS server list to be overridden by DHCP/PPP on WAN". This ensures pfSense uses the root DNS servers for all requests instead of the local network.

DHCP Server

To Configure, go to Services > DHCP Server.

Enable DHCP server on all interfaces. I set the range to 172.16.X.20 - 30 for each interface.

Firewall

Next, I added rules to ensure each network could not reach each other isolating the networks.

LAN

OPT1


OPT2

Other Considerations

This is just a basic configuration. You could add changes to the LAN where only VLAN traffic was allowed out to further protect personal data. There are tons of security configurations within pfSense which can also be explored depending on how locked down the box needs to be.