Tuesday, December 8, 2015

Angler EK - TeslaCrypt - Traffic Analysis and IOC - Splunk and Suricata (IDS)

This blog post is to walk through the Lab exercise from "malware-traffic-analysis.net" posted on Nov 2015.  And the focus is mainly on using Splunk as a SIEM tool to detect the pattern. This post assumes some basic working knowledge of Splunk , Suricata and Wireshark.

Lab-Setup

My set-up is to run the like Suricata (IDS), Wireshark and Fiddler inside the virtual instance for analysis and use a Splunk universal forwarder to transport the logs to Splunk Core instance. Follow the below post for Suricata install and configure to transport the logs-to splunk


Navigate to the suricata folder  and run the following command.

Suricata -c suricata.yaml - r input_pcap_file_location -l output_location_to_store_the_logs

Example,

root@brainfold-blackbox:/opt# suricata -c /opt/suricata-3.1.1/suricata.yaml -r /mnt/hgfs/Shared/network_traffic_analysis/CRIME/Angular-EK_TeslaCrypt/Angler\=EK-traffic.pcap -l /mnt/hgfs/Shared/network_traffic_analysis/CRIME/Angular-EK_TeslaCrypt/

Successful run will have the following information without any error.

<Notice> - This is Suricata version 3.1.1 RELEASE
<Notice> - all 3 packet processing threads, 4 management threads initialized, engine started.
<Notice> - Signal Received.  Stopping engine.
<Notice> - Pcap-file module read 3103 packets, 2155330 bytes

Suricata's output eve.json file contains various event_types, segregating the activities to alert, dns, fileinfo, flow, http, stats, tls. This is very useful in identifying the malicious events.

Angler EK - TeslaCrypt

Initial request were made to ojituksenastevaihtelutyypill[.]my-payroll-site.org which is a compromised site. The user is then redirected to the landing site 24u4jf7s4regu6hn.htye943kjc38[.]com  where few html files with embedded iframe and javasript is download. After profiling the victim browser, add-ons and OS before connection  to C2. Various file downloads , http and DNS connections are outlined in the below screenshots. 

                            

Screenshot showing the Emerging Threats Signature


List of Signatures Triggered

index="suricata" sourcetype="pcap" source="*Angular-EK_TeslaCrypt*" event_type=alert alert.signature!="\*suricata\*" | stats count by alert.signature | RENAME alert.signature AS "Signatures_Trigerred"




List of Notable HTTP Traffic



index="suricata" sourcetype="pcap" source="*Angular-EK_TeslaCrypt*" fileinfo.filename=* NOT (http.hostname="*google*" OR http.hostname="*facebook*" OR http.hostname="*bing*" OR http.hostname="*youtube*" OR http.hostname="*microsoft*" OR fileinfo.filename="*.css" OR fileinfo.filename="*.eot" OR fileinfo.filename="*.woff" OR fileinfo.filename="/" OR fileinfo.filename="*.jpg" OR fileinfo.filename="*.png" OR fileinfo.filename="*.gif" OR fileinfo.filename="*.woff2") | stats count by http.http_content_type

 



In this lab instance, we have insufficient information coming into Splunk to see the packet level information. Wireshark can come to aide.


HTTP traffic in wireshark
 


Files Downloaded
index="suricata"  sourcetype="pcap" source="*$crimename$*" fileinfo.filename=* NOT (http.hostname="*google*" OR http.hostname="*facebook*" OR http.hostname="*bing*" OR http.hostname="*youtube*" OR http.hostname="*microsoft*" OR fileinfo.filename="*.js" OR fileinfo.filename="*.css" OR fileinfo.filename="*.eot" OR fileinfo.filename="*.woff" OR fileinfo.filename="/" OR fileinfo.filename="*.jpg" OR fileinfo.filename="*.png" OR fileinfo.filename="*.gif" OR fileinfo.filename="*.woff2")  | stats values(fileinfo.filename) AS "Files Downloaded" values(http.http_content_type) AS Content_type by http.hostname src_ip | RENAME http.hostname AS "Malicious Domain"

 

DNS Traffic :- DNS queries made during this scenario

 
 TLS Traffic
         


Further analysis can be done on the infected and compromised sites to understand the scripts downloaded using network miner or fiddler.

Tuesday, October 6, 2015

Splunk Common Network Ports - Reference

Splunk Common Ports 


This is a diagram of Splunk components and network ports that are commonly used in a Splunk Enterprise environment. Firewall rules often need to be updated to allow communication on ports 8000, 8089, 9997, 8080 and 514.

UFs ---9997---> HF --- 9997---> Indexers
UFs, Indexers, SHs ---8089 ---> DS


Splunk Web Port: 8000

Splunk Management Port: 8089

Splunk Indexing Port: 9997

Splunk Index Replication Port 8080

Splunk network port: 514 (Used to get data in from netwok port i.e. UDP data)








How to change default port numbers in splunk?

There may be certain conditions where you may need to change default port numbers used.Most of the case due to security reasons OR if other service is using the port then You can change the default values by following below steps:

Using Splunk WebTo change the ports from their installation settings:

1. Log into Splunk Web as the admin user.
2. Click Manager in the top-right of the interface.
3. Click the System settings link in the System section of the screen.
4. Click General settings.
5. Change the value for either Management port or Web port, and click Save.
Using Splunk CLITo change the port settings via the Splunk CLI, use the CLI command set.

For example, this command sets the Splunk Web port to 9000:

splunk set web-port 9000

This command sets the splunkd port to 9089:

splunk set splunkd-port 9089

Wednesday, August 12, 2015

Suricata - Installation an Configuration to log to Splunk

This is a supporting blog post to assist with solving the exercise posted on malware-traffic-analysis.net. This post acts as a prelude with set-up instruction to install and configure the pre-reqs.

Lab-Setup

The set-up is to run the analysis tool like Suricata, Wireshark and Fidler in a seperate instance for analysis and use a Splunk universal forwarder to send the logs to my Splunk Core instance.

Pre-installation requirements to install Suricata (IDS) on Linux
Before you can build Suricata for your system, run the following command to ensure that you have everything you need for the installation. 
sudo apt-get -y install libpcre3 libpcre3-dbg libpcre3-dev build-essential autoconf automake libtool libpcap-dev libnet1-dev libyaml-0-2 libyaml-dev zlib1g zlib1g-dev libcap-ng-dev libcap-ng0 make libmagic-dev libjansson-dev libjansson4 pkg-config

Dowload and install Suricata

tar -xvzf "suricata-3.1.1.tar.gz"
cd "suricata-3.1.1"
./configure --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
./configure && make && make install-conf

Configure Suricata to enable JSON output.
Besides enabling JSON output, no other configuration is required.
This is covered in Eve JSON Output, we just have to enable it in the config file suricata.yaml

root@brainfold-blackbox:/opt/suricata-3.1.1# cat suricata.yaml | grep -C 2  "eve-log\:"

  # Extensible Event Format (nicknamed EVE) event log in JSON format
  - eve-log:
      enabled: yes
      filetype: regular #regular|syslog|unix_dgram|unix_stream|redis


Navigate to the folder where Splunk is installed and run the follwing command.

Suricata -c suricata.yaml - r input_pcap_file_location -l output_location_to_store_the_logs

Successful run will have the following information without any error.

<Notice> - This is Suricata version 3.1.1 RELEASE
<Notice> - all 3 packet processing threads, 4 management threads initialized, engine started.
<Notice> - Signal Received.  Stopping engine.
<Notice> - Pcap-file module read 3103 packets, 2155330 bytes

Either use Splunk forwarder or "Local - Data inputs" option to transport the log into Splunk.

Splunk - inputs.conf 
brainfold-mac:local root# cat inputs.conf
[monitor:///Volumes/Mac_Development/Shared/network_traffic_analysis/CRIME/.../eve.json]
disabled = false
index = suricata
sourcetype = pcap

Splunk - Props.conf
[pcap]
DATETIME_CONFIG =
NO_BINARY_CHECK = true
category = Custom
disabled = false
pulldown_type = true
SHOULD_LINEMERGE = false

Note that the key is to assign the sourcetype as "pcap" OR "json" which makes it easier for Splunk to parse the evets.

Verify the logs are flowing into splunk

index=suricata sourcetype=pcap


Note - Updated with latest suricata version "3.1.1".

Tuesday, June 9, 2015

awesome-incident-response


awesome-incident-response

A curated list of tools and resources for security incident response, aimed to help security analysts and DFIR teams. Not my collection, Found in Github

IR tools Collection
Disk Image Creation Tools
  • GetData Forensic Imager - GetData Forensic Imager is a Windows based program that will acquire, convert, or verify a forensic image in one of the following common forensic file formats
  • Guymager - Guymager is a free forensic imager for media acquisition on Linux
  • AccessData FTK Imager - AccessData FTK Imager is a forensics tool whose main purpose is to preview recoverable data from a disk of any kind. FTK Imager can also acquire live memory and paging file on 32bit and 64bit systems
Memory Analysis Tools
  • Volatility - An advanced memory forensics framework
  • Evolve - Web interface for the Volatility Memory Forensics Framework
  • WindowsSCOPE - another memory forensics and reverse engineering tool used for analyzing volatile memory. It is basically used for reverse engineering of malwares. It provides the capability of analyzing the Windows kernel, drivers, DLLs, virtual and physical memory
  • Responder PRO - Responder PRO is the industry standard physical memory and automated malware analysis solution
  • KnTList - Computer memory analysis tools
  • Rekall - Open source tool (and library) for the extraction of digital artifacts from volatile memory (RAM) samples
  • Memoryze - Memoryze by Mandiant is a free memory forensic software that helps incident responders find evil in live memory. Memoryze can acquire and/or analyze memory images, and on live systems, can include the paging file in its analysis
  • Memoryze for Mac - Memoryze for Mac is Memoryze but then for Macs. A lower number of features, however
Memory Imaging Tools
  • OSForensics - OSForensics can acquire live memory on 32bit and 64bit systems. A dump of an individual process’s memory space or physical memory dump can be done
  • Belkasoft Live RAM Capturer - A tiny free forensic tool to reliably extract the entire content of the computer’s volatile memory – even if protected by an active anti-debugging or anti-dumping system
Process Dump Tools
  • PMDump - PMDump is a tool that lets you dump the memory contents of a process to a file without stopping the process
  • Microsoft User Mode Process Dumper - The User Mode Process Dumper (userdump) dumps any running Win32 processes memory image on the fly
Timeline tools
  • Plaso - a Python-based backend engine for the tool log2timeline
  • Timesketch - open source tool for collaborative forensic timeline analysis
  • Highlighter - Free Tool available from Fire/Mandiant that will depict log/text file that can highlight areas on the graphic, that corresponded to a key word or phrase. Good for time lining an infection and what was done post compromise
All in one Tools
  • X-Ways Forensics - X-Ways is a forensics tool for Disk cloning and imaging. It can be used to find deleted files and disk analysis
  • The Sleuth Kit & Autopsy - The Sleuth Kit is a Unix and Windows based tool which helps in forensic analysis of computers. It comes with various tools which helps in digital forensics. These tools help in analyzing disk images, performing in-depth analysis of file systems, and various other things
  • Open Computer Forensics Architecture - Open Computer Forensics Architecture (OCFA) is another popular distributed open-source computer forensics framework. This framework was built on Linux platform and uses postgreSQL database for storing data
  • Digital Forensics Framework - DFF is an Open Source computer forensics platform built on top of a dedicated Application Programming Interface (API). DFF proposes an alternative to the aging digital forensics solutions used today. Designed for simple use and automation, the DFF interface guides the user through the main steps of a digital investigation so it can be used by both professional and non-expert to quickly and easily conduct a digital investigations and perform incident response
  • Osquery - with osquery you can easily ask questions about your Linux and OSX infrastructure. Whether your goal is intrusion detection, infrastructure reliability, or compliance, osquery gives you the ability to empower and inform a broad set of organizations within your company. Queries in the incident-response pack help you detect and respond to breaches
  • MozDef - The Mozilla Defense Platform (MozDef) seeks to automate the security incident handling process and facilitate the real-time activities of incident handlers
  • GRR Rapid Response - GRR Rapid Response is an incident response framework focused on remote live forensics. It consists of a python agent (client) that is installed on target systems, and a python server infrastructure that can manage and talk to the agent
  • MIG - Mozilla Investigator (MIG) is a platform to perform investigative surgery on remote endpoints. It enables investigators to obtain information from large numbers of systems in parallel, thus accelerating investigation of incidents and day-to-day operations security
  • FIDO - Fully Integrated Defense Operation (FIDO) by Netflix is an orchestration layer used to automate the incident response process by evaluating, assessing and responding to malware. FIDO’s primary purpose is to handle the heavy manual effort needed to evaluate threats coming from today's security stack and the large number of alerts generated by them
  • Redline - provides host investigative capabilities to users to find signs of malicious activity through memory and file analysis, and the development of a threat assessment profile
  • Envdb - Envdb turns your production, dev, cloud, etc environments into a database cluster you can search using osquery as the foundation. It wraps the osquery process with a (cluster) node agent that can communicate back to a central location
  • Limacharlie - an endpoint security platform, It is itself a collection of small projects all working together, and gives you a cross-platform (Windows, OSX, Linux, Android and iOS) low-level environment allowing you to manage and push (in memory) additional modules to
  • Belkasoft Evidence Center - The toolkit will quickly extract digital evidence from multiple sources by analyzing hard drives, drive images, memory dumps, iOS, Blackberry and Android backups, UFED, JTAG and chip-off dumps
Incident Management
  • FIR - Fast Incident Response (FIR) is an cybersecurity incident management platform designed with agility and speed in mind. It allows for easy creation, tracking, and reporting of cybersecurity incidents and is useful for CSIRTs, CERTs and SOCs alike
  • SCOT - Sandia Cyber Omni Tracker (SCOT) is an Incident Response collaboration and knowledge capture tool focused on flexibility and ease of use. Our goal is to add value to the incident response process without burdening the user
  • RTIR - Request Tracker for Incident Response (RTIR) is the premier open source incident handling system targeted for computer security teams. We worked with over a dozen CERT and CSIRT teams around the world to help you handle the ever-increasing volume of incident reports. RTIR builds on all the features of Request Tracker
  • threat_note - A lightweight investigation notebook that allows security researchers the ability to register and retrieve indicators related to their research
Evidence Collection
  • Live Response Collection - The Live Response collection by BriMor Labs is an automated tool that collects volatile data from Windows, OSX, and *nix based operating systems
  • bulk_extractor - bulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. Because of ignoring the file system structure, the program distinguishes itself in terms of speed and thoroughness
Windows Evidence Collection
  • FECT - Fast Evidence Collector Toolkit (FECT) is a light incident response toolkit to collect evidences on a suspicious Windows computer. Basically it is intended to be used by non-tech savvy people working with a journeyman Incident Handler
  • PSRecon - PSRecon gathers data from a remote Windows host using PowerShell (v2 or later), organizes the data into folders, hashes all extracted data, hashes PowerShell and various system properties, and sends the data off to the security team. The data can be pushed to a share, sent over email, or retained locally
  • FastIR Collector - FastIR Collector is a tool that collects different artefacts on live Windows systems and records the results in csv files. With the analyses of these artefacts, an early compromise can be detected
  • AChoir - Achoir is a framework/scripting tool to standardize and simplify the process of scripting live acquisition utilities for Windows
  • RegRipper - Regripper is an open source tool, written in Perl, for extracting/parsing information (keys, values, data) from the Registry and presenting it for analysis
  • IOC Finder - IOC Finder is a free tool from Mandiant for collecting host system data and reporting the presence of Indicators of Compromise (IOCs). Support for Windows only
  • Crowd Response - Crowd Response by CrowdStrike is a lightweight Windows console application designed to aid in the gathering of system information for incident response and security engagements. It features numerous modules and output formats
  • LOKI - Loki is a free IR scanner for scanning endpoint with yara rules and other indicators(IOCs)
  • TRIAGE-IR - Triage-IR is a IR collector for Windows
  • PowerForensics - Live disk forensics platform, using PowerShall
OSX Evidence Collection
  • OSX Auditor - OSX Auditor is a free Mac OS X computer forensics tool
  • OSX Collector - An OSX Auditor offshoot for live response
Linux Evidence Collection
  • FastIR Collector Linux - FastIR for Linux collects different artefacts on live Linux and records the results in csv files.
Sandboxing/reversing tools
  • Cuckoo - Open Source Highly configurable sandboxing tool
  • Cuckoo-modified - Heavily modified Cuckoo fork developed by community
  • Mastiff - MASTIFF is a static analysis framework that automates the process of extracting key characteristics from a number of different file formats.
  • Viper - Viper is a python based binary analysis and management framework, that works well with Cuckoo and YARA.
  • Virustotal - Virustotal, a subsidiary of Google, is a free online service that analyzes files and URLs enabling the identification of viruses, worms, trojans and other kinds of malicious content detected by antivirus engines and website scanners
  • Malwr - Malwr is a free online malware analysis service and community, which is powered by the Cuckoo Sandbox
  • Hybrid-Analysis - Hybrid-Analysis is a free powerful online sandbox by Payload Security
Linux Distributions
  • Security Onion - Security Onion is a special Linux distro aimed at network security monitoring featuring advanced analysis tools
  • SIFT Workstation - The SANS Investigative Forensic Toolkit (SIFT) Workstation demonstrates that advanced incident response capabilities and deep dive digital forensic techniques to intrusions can be accomplished using cutting-edge open-source tools that are freely available and frequently updated.
  • CAINE - The Computer Aided Investigative Environment (CAINE) contains numerous tools that help investigators during their analysis, including forensic evidence collection
  • DEFT - The Digital Evidence & Forensics Toolkit (DEFT) is a Linux distribution made for computer forensic evidence collection. It comes bundled with the Digital Advanced Response Toolkit (DART) for Windows. A light version of DEFT, called DEFT Zero, is also available, which is focused primarily on forensically sound evidence collection
Other Tools
  • Hindsight - Internet history forensics for Google Chrome/Chromium
  • Kansa - Kansa is a modular incident response framework in Powershell.
  • Stalk - Collect forensic data about MySQL when problems occur
  • DNS Miner - DNS Miner is a semi-automatic incident response and threat intelligence tool for small, over worked security teams. Specific incident reponse features include a DNS sinkhole and historical analysis of DNS traffic against newly arriving data, e.g. suspicious domain lists
  • traceroute-circl - traceroute-circl is an extended traceroute to support the activities of CSIRT (or CERT) operators. Usually CSIRT team have to handle incidents based on IP addresses received. Created by Computer Emergency Responce Center Luxembourg
  • Fenrir - Fenrir is a simple IOC scanner. It allows scanning any Linux/Unix/OSX system for IOCs in plain bash. Created by the creators of THOR and LOKI
  • Stenographer - Stenographer is a packet capture solution which aims to quickly spool all packets to disk, then provide simple, fast access to subsets of those packets. It stores as much history as it possible, managing disk usage, and deleting when disk limits are hit. It's ideal for capturing the traffic just before and during an incident, without the need explicit need to store all of the network traffic
  • Crits - a web-based tool which combines an analytic engine with a cyber threat database
Videos
Books
Intro to IR
Communities