1 of 54

Malware 2

5 Lecture 27.nov.2015

2 of 54

Course information and communication

3 of 54

3 Things last week ?

4 of 54

My 5 cents

5 of 54

My 5 cents

6 of 54

My 5 cents

7 of 54

My 5 cents

8 of 54

My 5 cents

9 of 54

My 5 cents

10 of 54

My 5 cents

11 of 54

My 5 cents

12 of 54

Today's Plan

Dark Seoul analysis overview

We Will go over toolset:

13 of 54

Dark Seoul

Modus operandi:

Break in to the website and trojanise legitime video codec

By doing this, they were able to target organizations that relied on the distributor’s security camera solution and infect their systems

Current attack is against european transport company .

14 of 54

Dark Seoul Stage 1

  • [redacted]Player_full.exe
  • [redacted]Player_light.exe

15 of 54

Dark Seoul Stage 1

16 of 54

Dark Seoul Stage 1

  • %TEMP%\[redacted]Player_full.exe
  • %TEMP%\[redacted]Player_light.exe
  • Malware > %TEMP%\ random executable name from sys 32 dir

17 of 54

Dark Seoul Stage 2

18 of 54

Dark Seoul Stage 2

  • CreateFileA
  • GetFileSize
  • CloseHandle
  • VirtualAlloc
  • GetModuleFileNameA
  • CreateProcessA
  • NtUnmapViewOfSection

  • VirtualAllocEx
  • WriteProcessMemory
  • GetThreadContext
  • SetThreadContext
  • ResumeThread
  • TerminateProcess
  • TerminateThread

In total, the following 14 functions are loaded during runtime:

19 of 54

Dark Seoul Stage 3 ( act as a downloader. )

hxxp://www.combra[.]eu/includes/images/logo.jpg

20 of 54

Dark Seoul Stage 3 ( act as a downloader. )

21 of 54

Dark Seoul Stage 3 ( act as a downloader. )

Downloaded file is dropped to folder System32 and named after random dll

example > you have apcups.dll then apcups.exe is created.

22 of 54

Dark Seoul Stage 3 ( act as a downloader. )

Downloaded file is dropped to folder System32 and named after random dll

example > you have apcups.dll then apcups.exe is created.

23 of 54

Dark Seoul Stage 4 New executable

file begins by checking the parent process for the

presence of ‘cmd.exe’ or ‘explorer.exe’.

It proceeds to randomly select an executable file

in the system32 folder,

and performs process hollowing against it.

24 of 54

Dark Seoul Final payload Stage 5

Deobfuscates strings (string obfuscation method in picture implemented in Python)

Loads additional libraries determines if process V3lite.exe is running

25 of 54

Dark Seoul Final payload Stage 5

Global\SPPLMUTEX < To control that only one version is running

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

26 of 54

Dark Seoul Final payload Stage 5

Information Collected:

  • Computer Name
  • IP Address
  • Registered Owner
  • Registered Organization
  • Installation Date

Victim ID generation :

HKCU\SOFTWARE\Microsoft\HY08A\Build < ID is stored here

27 of 54

Dark Seoul Final payload Stage 5

C&C URL -s

  • hxxp://mcm-yachtmanagement[.]com/installx/install_ok.php
  • hxxp://www.junfac[.]com/tires/skin/tires.php

28 of 54

Dark Seoul C&C response

29 of 54

Dark Seoul C&C response

Key generation algorithm

Decryption algorithm

known implementations in python available

The malware will store these command identifiers in the following files:

  • %TEMP%\MSI2001.LOG
  • %TEMP%\MSI2002.LOG

tick 7880

systeminfo & net view & netstat -naop tcp & tasklist & dir /a "%userprofile%\AppData\Local\Microsoft\Outlook" & dir /a "%temp%\*.exe" & dir "%ProgramFiles%" & dir "%ProgramFiles%\Microsoft Office"

1018; 60

  • current decypted message

30 of 54

Dark Seoul C&C response

1001 Modify C2 URLs

1003 Download

1013 Download/execute malware in other process

1018 Modify wait interval time

1025 Download/execute and return response

Default Execute command and return results

31 of 54

Dark Seoul response to C&C

32 of 54

Dark Seoul modification in system

HKCU\Software\Microsoft\HY08A\Policy

Additionally, in the event the C2 response instructs the malware to update C2 URLs, it will be in the following format:

1001; [unique_identifier] [url]

The malware will encrypt the URL string with a 4-byte XOR key of “\x01\x02\x03\x04” and store this data in the following registry key:

HKCU\Software\Microsoft\HY08A\[unique_identifier]

33 of 54

34 of 54

Tools

35 of 54

Can be divided

  • Detection and Classification
  • Browser Malware handling
  • Documents and Shellcode
  • File Carving
  • Debugging and Reverse Engineering
  • Network
  • Memory Forensics
  • Windows Artifacts
  • Storage and Workflow
  • ...

36 of 54

Detection and Classification

  • AnalyzePE - Wrapper for a variety of tools for reporting on Windows PE files.
  • chkrootkit - Local Linux rootkit detection.
  • ClamAV - Open source antivirus engine.
  • ExifTool - Read, write and edit file metadata.
  • hashdeep - Compute digest hashes with a variety of algorithms.
  • Loki - Host based scanner for IOCs.
  • Malfunction - Catalog and compare malware at a function level.

37 of 54

Detection and Classification

  • MASTIFF - Static analysis framework.
  • MultiScanner - Modular file scanning/analysis framework
  • nsrllookup - A tool for looking up hashes in NIST's National Software Reference Library database.
  • packerid - A cross-platform Python alternative to PEiD.
  • PEiD - Packer identifier for Windows binaries.
  • PEV - A multiplatform toolkit to work with PE files, providing feature-rich tools for proper analysis of suspicious binaries.

38 of 54

Detection and Classification

  • Rootkit Hunter - Detect Linux rootkits.
  • ssdeep - Compute fuzzy hashes.
  • totalhash.py - Python script for easy searching of the TotalHash.com database.
  • TrID - File identifier.
  • YARA - Pattern matching tool for analysts.
  • Yara rules generator - Generate yara rules based on a set of malware samples. Also contains a good strings DB to avoid false positives.

39 of 54

Browser Malware handling

  • Firebug - Firefox extension for web development.
  • Java Decompiler - Decompile and inspect Java apps.
  • Java IDX Parser - Parses Java IDX cache files.
  • JSDetox - JavaScript malware analysis tool.
  • jsunpack-n - A javascript unpacker that emulates browser functionality.
  • Malzilla - Analyze malicious web pages.
  • RABCDAsm - A "Robust ActionScript Bytecode Disassembler."
  • swftools - Tools for working with Adobe Flash files.
  • xxxswf - A Python script for analyzing Flash files.

40 of 54

Documents and Shellcode

  • AnalyzePDF - A tool for analyzing PDFs and attempting to determine whether they are malicious.
  • diStorm - Disassembler for analyzing malicious shellcode.
  • JS Beautifier - JavaScript unpacking and deobfuscation.
  • libemu - Library and tools for x86 shellcode emulation.
  • malpdfobj - Deconstruct malicious PDFs into a JSON representation.
  • OfficeMalScanner - Scan for malicious traces in MS Office documents.
  • olevba - A script for parsing OLE and OpenXML documents and extracting useful information.

41 of 54

Documents and Shellcode

  • Origami PDF - A tool for analyzing malicious PDFs, and more.
  • PDF Tools - pdfid, pdf-parser, and more from Didier Stevens.
  • PDF X-Ray Lite - A PDF analysis tool, the backend-free version of PDF X-RAY.
  • peepdf - Python tool for exploring possibly malicious PDFs.
  • Spidermonkey - Mozilla's JavaScript engine, for debugging malicious JS.

42 of 54

File Carving

  • bulk_extractor - Fast file carving tool.
  • EVTXtract - Carve Windows Event Log files from raw binary data.
  • Foremost - File carving tool designed by the US Air Force.
  • Hachoir - A collection of Python libraries for dealing with binary files.
  • Scalpel - Another data carving tool.

43 of 54

Debugging and Reverse Engineering

  • Bokken - GUI for Pyew and Radare.
  • dnSpy - .NET assembly editor, decompiler and debugger.
  • Evan's Debugger (EDB) - A modular debugger with a Qt GUI.
  • GDB - The GNU debugger.
  • hackers-grep - A utility to search for strings in PE executables including imports, exports, and debug symbols.
  • IDA Pro - Windows disassembler and debugger, with a free evaluation version.
  • Immunity Debugger - Debugger for malware analysis and more, with a Python API.
  • ltrace - Dynamic analysis for Linux executables.

44 of 54

Debugging and Reverse Engineering

  • objdump - Part of GNU binutils, for static analysis of Linux binaries.
  • OllyDbg - An assembly-level debugger for Windows executables.
  • pestudio - Perform static analysis of Windows executables.
  • Process Monitor - Advanced monitoring tool for Windows programs.
  • Pyew - Python tool for malware analysis.
  • Radare2 - Reverse engineering framework, with debugger support.

45 of 54

Debugging and Reverse Engineering

  • strace - Dynamic analysis for Linux executables.
  • Udis86 - Disassembler library and tool for x86 and x86_64.
  • Vivisect - Python tool for malware analysis.
  • X64dbg - An open-source x64/x32 debugger for windows.

46 of 54

Network

  • Bro - Protocol analyzer that operates at incredible scale; both file and network protocols.
  • CapTipper - Malicious HTTP traffic explorer.
  • chopshop - Protocol analysis and decoding framework.
  • Fiddler - Intercepting web proxy designed for "web debugging."
  • Hale - Botnet C&C monitor.
  • INetSim - Network service emulation, useful when building a malware lab.
  • Malcom - Malware Communications Analyzer.

47 of 54

Network

  • mitmproxy - Intercept network traffic on the fly.
  • Moloch - IPv4 traffic capturing, indexing and database system.
  • NetworkMiner - Network forensic analysis tool, with a free version.
  • ngrep - Search through network traffic like grep.
  • Tcpdump - Collect network traffic.
  • tcpick - Trach and reassemble TCP streams from network traffic.
  • tcpxtract - Extract files from network traffic.
  • Wireshark - The network traffic analysis tool.

48 of 54

Memory Forensics

  • DAMM - Differential Analysis of Malware in Memory, built on Volatility
  • FindAES - Find AES encryption keys in memory.
  • Muninn - A script to automate portions of analysis using Volatility, and create a readable report.
  • Rekall - Memory analysis framework, forked from Volatility in 2013.
  • TotalRecall - Script based on Volatility for automating various malware analysis tasks.

49 of 54

Memory Forensics

  • VolDiff - Run Volatility on memory images before and after malware execution, and report changes.
  • Volatility - Advanced memory forensics framework.
  • WinDbg - Live memory inspection and kernel debugging for Windows systems.

50 of 54

Windows Artifacts

  • AChoir - A live incident response script for gathering Windows artifacts.
  • python-evt - Python library for parsing Windows Event Logs.
  • python-registry - Python library for parsing registry files.
  • RegRipper (GitHub) - Plugin-based registry analysis tool.
  • GRR

51 of 54

Storage and Workflow

  • Aleph - OpenSource Malware Analysis Pipeline System.
  • CRITs - Collaborative Research Into Threats, a malware and threat repository.
  • Malwarehouse - Store, tag, and search malware.
  • MISP - Malware Information Sharing Platform curated by The MISP Project.
  • Viper - A binary management and analysis framework for analysts and researchers.

52 of 54

….

53 of 54

.…

54 of 54

.…