SlideShare a Scribd company logo
1 of 77
Download to read offline
Higher Level Malware
@ChrisTruncer
@Evan_Pena2003
Whoami?
● Christopher Truncer (@ChrisTruncer)
○ Sys Admin turned Mandiant’s West Coast Red Team
○ Florida State Seminole
○ Open Source Software Developer
■ The Veil Framework
■ Egress-Assess
■ EyeWitness
■ Just-Metadata
■ etc.
Whoami?
● Evan Pena (@Evan_Pena2003)
○ Mandiant’s West Coast Red Team Lead
○ Open Source Software Developer
■ ADEnumerator
■ NessusCombiner
■ NMapParser
■ Etc.
What’s this talk about?
● Concepts of how malware generally works
● Injection Basics
○ Shellcode Injection
○ Process Injection
● Client Development Basics
● Server Development Basics
● AV Detection
● Sample Custom Malware
Malware Basics
How does malware generally work?
● Most basic/traditional example is your standard client -
server model
○ Malware is downloaded and executed on a victim’s
machine
○ Malware connects back to server registering the
agent and sees if there’s any instructions
○ Malware periodically checks back in looking for
more instructions
Other Variants
● Worms
○ Automated propagation
● Ransomware
○ Can fall under worms
○ Infects and encrypts personal data
● Logic Bombs
○ Don’t see this much
○ Typically lay dormant until a trigger (date) and then
wreak havoc
What do we normally use?
● We typically use normal RATs which follow the
client/server standard
○ Meterpreter
○ Beacon
○ Custom code
● We don’t enable code to self-propagate
● We don’t enable code to perform destructive actions
● Usually, our use of malware is to help facilitate access
and execute “tasks” on the victim machine
RATs
● When breaking into a system, it’s highly probable you
will need to account for Anti-Virus
● Using widely published tools/callback generators can
potentially increase the likelihood detection
○ Metasploit, UPX Packers, even Veil-Evasion at times
● Custom code is your way around AV
RAT Functionality
● C2 Comms that check-in
● Ability to execute command line commands
● Ability to inject shellcode
● Ability to inject shellcode into remote processes
Server Functionality
● Server isn’t obvious upon first analysis
○ Any true IR pro will discover its intent
● Anti-replay detection/prevention
○ Same URI twice, or not a whitelisted URI? Ban/Block
the offending IP
● Track and manage multiple agents
● Handle data gathered by agent and submitted to server
Shellcode Injection
Shellcode Injection
● This is performed by stagers (usually)
○ Their goal typically is to download and inject a
reflective dll
● Any language that has access to the Windows API can
have their own shellcode injection functionality
● While this sounds complicated, it’s an easy step
○ You only need to call four functions
Shellcode Injection
● The main concept is:
○ Allocate memory for shellcode
○ Copy the shellcode you want to run into the
memory that was just allocated
○ Create a thread that executes the shellcode
○ Wait for the thread to exit (let it run)
VirtualAlloc
● This function allocates memory
● It takes the following input for our use:
○ (Optional) Location to start allocating memory - Null
○ The amount (size) of memory to allocate
○ A value specifying to both reserve and commit the
memory
○ A value specifying this section of memory with RWX
permissions
RtlMoveMemory
● This will copy the shellcode into the memory we
previously allocated
● It takes the following input for our use:
○ A pointer to the location in memory where space
has been allocated
○ The location of the data that needs to be moved
○ The length of the data being moved (length of
shellcode)
CreateThread
● This creates a thread to execute shellcode
● It takes the following input for our use:
○ Null value (security attributes)
○ Null value (stack size specification)
○ Pointer to the start of the shellcode
○ Null value (no variables)
○ “0” - Thread runs immediately
○ “0” - Don’t need a thread identifier
WaitForSingleObject
● This specifies the program to allow the thread to
execute
● It takes the following input for our use:
○ A handle to the thread that was just created
○ The value “-1” to tell the program to wait to exit until
the thread exits
Added Shellcode Injection with C#
Wouldn’t it be cool to have that in a C# RAT Stager?
More to come people!
I didn’t take the “write shellcode class”
Shellcode 101 Class – use tools!
ColbaltStrike Beacon and Meterpreter Shellcode
● Beacon listeners are compatible with MSFVenom
generated shellcode
○ As long as you use shellcode for the same “type” of
payload
■ meterpreter/reverse_https == beacon reverse
https
■ meterpreter/reverse_http == beacon reverse
http
Process Injection
Process Injection
● This is relatively similar to shellcode injection.
● You’re not allocating space in your own process, you
are doing it in another (remote) process.
● This is also done in four steps:
○ Obtain a handle to the remote process
○ Allocate memory for your shellcode in the remote
process
○ Write the shellcode to the remote memory space
○ Create a thread in the remote process
OpenProcess
● This provides a handle to the process we want to inject
shellcode into
● This takes three inputs
○ The level of access requested (all access)
○ Specifying that new processes don’t inherit the
handle
○ The process ID of the process that will have
shellcode injected into it
VirtualAllocEx
● This allocates memory in a remote process
● It takes five inputs
○ A handle to the remote process
○ Allow the function to determine where to allocate
mem
○ The length of the shellcode
○ Specify to the function to allocate the required
memory
○ The permissions on the memory that’s being
allocated
WriteProcessMemory
● This writes the shellcode to inject in the remote
process
● This takes five inputs
○ A handle to the remote process
○ A pointer to the address in memory to write to
○ A variable containing the shellcode to inject
○ The length of the shellcode being injected
○ A NULL value since we don’t care about the number
of bytes being written
CreateRemoteThread
● This starts a remote thread to execute the shellcode
● This takes seven inputs
○ Handle to the remote process
○ Null, and 0, specifying security attributes and stack
size
○ Pointer to location in memory containing code to
run
○ 0, 0, 0 - Not passing a variable in, thread runs
immediately, and we don’t care about thread id
Added Process Injection with C#
Keylogging
Keylogging
● We’ll make a python based keylogger for this example
● It’s pretty simple, and can be package into an
executable
● Best part, there’s already public code for it!
○ Needed small mods
● Can be run from user-level (don’t need admin rights)
Client/Agent Development Basics
Malware Agents
● Need to egress network boundaries
○ HTTP(S) is likely easiest to use
● Want to have secure comms with server
● Need to be able to receive commands OR have the
commands already built into them
○ Also need to be able to send back results
● Need to evade antivirus
Server Development Basics
C2 Servers
● Not immediately stand out as a C2 server
○ Some sort of security through obfuscation
● Protect against replay attacks
● Ensure secure communications with agents
● Track multiple agents and have the ability to issue
individual commands
AV Detection
AV Detection
● So I’m going to show a story here about how I failed for
this presentation
Sample Custom Malware
Case Study - Enumerator
● Client didn’t want actual shellcode injection and
infection of their environment
● They wanted intel collection from the systems where
the payloads were executed
● The data gathered by the script/malware needed to
egress the network to our listening server
“Agent” Code
“Server” Code
Agent Side
Server Side
Same Same, but C#
Case Study: Reverse Shell
Agent Code
Server Code
Agent Side
Server Side
You literally just run the exe….
Injecting Meterpreter as Shellcode
Building Out C# RAT
● Wanted custom quick RAT that I could use upon initial compromise
● Benefits:
○ Can be quickly modified to evade AV signatures
○ Provides you initial cmd access to compromised system for quick tasks:
■ Recon/enumeration
■ Adding user accounts
■ Persistence
○ Can be easily modified to add more functionality:
■ persistence, shellcode injection, process injection, encrypted coms, encrypted
payloads
○ Used as a stager: Added shellcode and process injection to inject a more complete RAT
into memory and avoid detection. (Yes, that comes with my version!)
Introducing DarkLink
DarkLink Overview
● Really simple $h!7, but quick and easy
● What is it?
● C# dropper that will download and execute your arbitrary payload
● Will persist the payload automatically
● Bottom line: quick persistence/dropper for your actual payload
Fun Persistence Techniques
● Checks for Internet using Google.com
● Downloads payload to a folder it can
write to
● Checks to see what software is
installed
● Will schedule a task OR modify
registry
Little Bit More Detail
● What folders does it check?
○ C:Program Files (x86)AdobeReader 10.0Reader
○ C:Program Files (x86)AdobeFlash Player
○ C:Program Files (x86)Javajre7bin
○ C:Program Files (x86)GoogleChromeApplication
○ C:Program Files (x86)Mozilla Firefox
● Checks all versions of Adobe and Java
● Will check for Program Files if x86 doesn’t exist
● Depending on results, will create update. E.g. AdobeUpdater.exe
● Supports registry persistence and scheduled task
● Much more to add! Fork it and add it
○ WMI persistence, permissions checks, service creation, see Bsides talk
Wrapup
● This stuff is quick and easy to develop
○ You don’t need to be a “developer” to write your
own malware/stagers
● Everything we talked about is mostly used for initial
access.
○ You don’t want to burn your full blown RAT (pawn)
○ You might just need initial persistence quickly
○ Can be modified to expand functionality and bypass
AV
Links to Code/Projects
● Shellcode Injection - https://gist.github.
com/ChrisTruncer/183ed7e4388388771654fd8cf7e91
e2a
● Process Injection - https://gist.github.
com/ChrisTruncer/ee11640831eca846d18d12e8ee193
f77
● Keylogger - https://github.
com/ChrisTruncer/PenTestScripts/blob/master/keylog
ger.py
Links to Code/Projects
● Keylogger - https://github.
com/ChrisTruncer/PenTestScripts/blob/master/keylogg
er.py
● DarkLink -
https://github.com/chango77747/DarkLink
● ReverseShell C# -
https://github.com/chango77747/ReverseShell
Questions?
● Chris Truncer (@ChrisTruncer)
○ https://github.com/ChrisTruncer
● Evan Pena (@evan_pena2003)
○ https://github.com/chango77747

More Related Content

What's hot

AV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkAV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkVeilFramework
 
Pentester++
Pentester++Pentester++
Pentester++CTruncer
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000CTruncer
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil FrameworkVeilFramework
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your NetworkCTruncer
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013midnite_runr
 
Hacking - Breaking Into It
Hacking - Breaking Into ItHacking - Breaking Into It
Hacking - Breaking Into ItCTruncer
 
CheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant SecurityCheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant SecurityBrandon Arvanaghi
 
CheckPlease: Payload-Agnostic Targeted Malware
CheckPlease: Payload-Agnostic Targeted MalwareCheckPlease: Payload-Agnostic Targeted Malware
CheckPlease: Payload-Agnostic Targeted MalwareBrandon Arvanaghi
 
Egress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data ExfiltrationEgress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data ExfiltrationCTruncer
 
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationWhat Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationCTruncer
 
Veil-PowerView - NovaHackers
Veil-PowerView - NovaHackersVeil-PowerView - NovaHackers
Veil-PowerView - NovaHackersVeilFramework
 
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Passive Intelligence Gathering and Analytics - It's All Just Metadata!Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Passive Intelligence Gathering and Analytics - It's All Just Metadata!CTruncer
 
Finding Needles in Haystacks
Finding Needles in HaystacksFinding Needles in Haystacks
Finding Needles in Haystackssnyff
 
Harness: PowerShell Weaponization Made Easy (or at least easier)
Harness: PowerShell Weaponization Made Easy (or at least easier)Harness: PowerShell Weaponization Made Easy (or at least easier)
Harness: PowerShell Weaponization Made Easy (or at least easier)RGKelley5
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositoriessnyff
 
Building world-class security response and secure development processes
Building world-class security response and secure development processesBuilding world-class security response and secure development processes
Building world-class security response and secure development processesDavid Jorm
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661snyff
 
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylodsDEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylodsFelipe Prado
 
Debugging tricks you wish you knew - Tamir Dresher
Debugging tricks you wish you knew  - Tamir DresherDebugging tricks you wish you knew  - Tamir Dresher
Debugging tricks you wish you knew - Tamir DresherTamir Dresher
 

What's hot (20)

AV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkAV Evasion with the Veil Framework
AV Evasion with the Veil Framework
 
Pentester++
Pentester++Pentester++
Pentester++
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil Framework
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your Network
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
 
Hacking - Breaking Into It
Hacking - Breaking Into ItHacking - Breaking Into It
Hacking - Breaking Into It
 
CheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant SecurityCheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant Security
 
CheckPlease: Payload-Agnostic Targeted Malware
CheckPlease: Payload-Agnostic Targeted MalwareCheckPlease: Payload-Agnostic Targeted Malware
CheckPlease: Payload-Agnostic Targeted Malware
 
Egress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data ExfiltrationEgress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data Exfiltration
 
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationWhat Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
 
Veil-PowerView - NovaHackers
Veil-PowerView - NovaHackersVeil-PowerView - NovaHackers
Veil-PowerView - NovaHackers
 
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Passive Intelligence Gathering and Analytics - It's All Just Metadata!Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
 
Finding Needles in Haystacks
Finding Needles in HaystacksFinding Needles in Haystacks
Finding Needles in Haystacks
 
Harness: PowerShell Weaponization Made Easy (or at least easier)
Harness: PowerShell Weaponization Made Easy (or at least easier)Harness: PowerShell Weaponization Made Easy (or at least easier)
Harness: PowerShell Weaponization Made Easy (or at least easier)
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositories
 
Building world-class security response and secure development processes
Building world-class security response and secure development processesBuilding world-class security response and secure development processes
Building world-class security response and secure development processes
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
 
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylodsDEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylods
 
Debugging tricks you wish you knew - Tamir Dresher
Debugging tricks you wish you knew  - Tamir DresherDebugging tricks you wish you knew  - Tamir Dresher
Debugging tricks you wish you knew - Tamir Dresher
 

Viewers also liked

Pen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and MorePen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and MoreCTruncer
 
EyeWitness - A Web Application Triage Tool
EyeWitness - A Web Application Triage ToolEyeWitness - A Web Application Triage Tool
EyeWitness - A Web Application Triage ToolCTruncer
 
Fuzzing | Null OWASP Mumbai | 2016 June
Fuzzing | Null OWASP Mumbai | 2016 JuneFuzzing | Null OWASP Mumbai | 2016 June
Fuzzing | Null OWASP Mumbai | 2016 Junenullowaspmumbai
 
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarang
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad SarangNull Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarang
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarangnullowaspmumbai
 
Efficient Bytecode Analysis: Linespeed Shellcode Detection
Efficient Bytecode Analysis: Linespeed Shellcode DetectionEfficient Bytecode Analysis: Linespeed Shellcode Detection
Efficient Bytecode Analysis: Linespeed Shellcode DetectionGeorg Wicherski
 
Linux Shellcode disassembling
Linux Shellcode disassemblingLinux Shellcode disassembling
Linux Shellcode disassemblingHarsh Daftary
 
Anatomy of A Shell Code, Reverse engineering
Anatomy of A Shell Code, Reverse engineeringAnatomy of A Shell Code, Reverse engineering
Anatomy of A Shell Code, Reverse engineeringAbhineet Ayan
 
Design and implementation_of_shellcodes
Design and implementation_of_shellcodesDesign and implementation_of_shellcodes
Design and implementation_of_shellcodesAmr Ali
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W mattersAlexandre Moneger
 
Shellcode and heapspray detection in phoneyc
Shellcode and heapspray detection in phoneycShellcode and heapspray detection in phoneyc
Shellcode and heapspray detection in phoneycZ Chen
 
Java Shellcode Execution
Java Shellcode ExecutionJava Shellcode Execution
Java Shellcode ExecutionRyan Wincey
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR mattersAlexandre Moneger
 

Viewers also liked (13)

Pen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and MorePen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and More
 
EyeWitness - A Web Application Triage Tool
EyeWitness - A Web Application Triage ToolEyeWitness - A Web Application Triage Tool
EyeWitness - A Web Application Triage Tool
 
Fuzzing | Null OWASP Mumbai | 2016 June
Fuzzing | Null OWASP Mumbai | 2016 JuneFuzzing | Null OWASP Mumbai | 2016 June
Fuzzing | Null OWASP Mumbai | 2016 June
 
L2
L2L2
L2
 
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarang
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad SarangNull Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarang
Null Mumbai 14th May Lesser Known Webapp attacks by Ninad Sarang
 
Efficient Bytecode Analysis: Linespeed Shellcode Detection
Efficient Bytecode Analysis: Linespeed Shellcode DetectionEfficient Bytecode Analysis: Linespeed Shellcode Detection
Efficient Bytecode Analysis: Linespeed Shellcode Detection
 
Linux Shellcode disassembling
Linux Shellcode disassemblingLinux Shellcode disassembling
Linux Shellcode disassembling
 
Anatomy of A Shell Code, Reverse engineering
Anatomy of A Shell Code, Reverse engineeringAnatomy of A Shell Code, Reverse engineering
Anatomy of A Shell Code, Reverse engineering
 
Design and implementation_of_shellcodes
Design and implementation_of_shellcodesDesign and implementation_of_shellcodes
Design and implementation_of_shellcodes
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters
 
Shellcode and heapspray detection in phoneyc
Shellcode and heapspray detection in phoneycShellcode and heapspray detection in phoneyc
Shellcode and heapspray detection in phoneyc
 
Java Shellcode Execution
Java Shellcode ExecutionJava Shellcode Execution
Java Shellcode Execution
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters
 

Similar to Higher Level Malware

Secure Developer Access at Decisiv
Secure Developer Access at DecisivSecure Developer Access at Decisiv
Secure Developer Access at DecisivTeleport
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsNetsparker
 
Pen Testing Development
Pen Testing DevelopmentPen Testing Development
Pen Testing DevelopmentCTruncer
 
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...egypt
 
Remote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profitRemote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profitDharmalingam Ganesan
 
Black hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBakry3
 
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...Vietnam Open Infrastructure User Group
 
MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows Ron Munitz
 
Offensive Python for Pentesting
Offensive Python for PentestingOffensive Python for Pentesting
Offensive Python for PentestingMike Felch
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsShakacon
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitDimitry Snezhkov
 
Hacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote AccessHacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote AccessEC-Council
 
Building an Empire with PowerShell
Building an Empire with PowerShellBuilding an Empire with PowerShell
Building an Empire with PowerShellWill Schroeder
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric WarfareWill Schroeder
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldDevOps.com
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Frameworkegypt
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPLnitinscribd
 

Similar to Higher Level Malware (20)

Secure Developer Access at Decisiv
Secure Developer Access at DecisivSecure Developer Access at Decisiv
Secure Developer Access at Decisiv
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass Firewalls
 
Windows Offender_ Reverse Engineering Windows Defender's Antivirus Emulator
Windows Offender_ Reverse Engineering Windows Defender's Antivirus EmulatorWindows Offender_ Reverse Engineering Windows Defender's Antivirus Emulator
Windows Offender_ Reverse Engineering Windows Defender's Antivirus Emulator
 
Pen Testing Development
Pen Testing DevelopmentPen Testing Development
Pen Testing Development
 
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
 
Remote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profitRemote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profit
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
 
Black hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slides
 
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...
Room 3 - 2 - Trần Tuấn Anh - Defending Software Supply Chain Security in Bank...
 
I hunt sys admins 2.0
I hunt sys admins 2.0I hunt sys admins 2.0
I hunt sys admins 2.0
 
MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows
 
Offensive Python for Pentesting
Offensive Python for PentestingOffensive Python for Pentesting
Offensive Python for Pentesting
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution Toolkit
 
Hacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote AccessHacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote Access
 
Building an Empire with PowerShell
Building an Empire with PowerShellBuilding an Empire with PowerShell
Building an Empire with PowerShell
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric Warfare
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
 

Recently uploaded

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 

Higher Level Malware

  • 2. Whoami? ● Christopher Truncer (@ChrisTruncer) ○ Sys Admin turned Mandiant’s West Coast Red Team ○ Florida State Seminole ○ Open Source Software Developer ■ The Veil Framework ■ Egress-Assess ■ EyeWitness ■ Just-Metadata ■ etc.
  • 3. Whoami? ● Evan Pena (@Evan_Pena2003) ○ Mandiant’s West Coast Red Team Lead ○ Open Source Software Developer ■ ADEnumerator ■ NessusCombiner ■ NMapParser ■ Etc.
  • 4. What’s this talk about? ● Concepts of how malware generally works ● Injection Basics ○ Shellcode Injection ○ Process Injection ● Client Development Basics ● Server Development Basics ● AV Detection ● Sample Custom Malware
  • 6. How does malware generally work? ● Most basic/traditional example is your standard client - server model ○ Malware is downloaded and executed on a victim’s machine ○ Malware connects back to server registering the agent and sees if there’s any instructions ○ Malware periodically checks back in looking for more instructions
  • 7. Other Variants ● Worms ○ Automated propagation ● Ransomware ○ Can fall under worms ○ Infects and encrypts personal data ● Logic Bombs ○ Don’t see this much ○ Typically lay dormant until a trigger (date) and then wreak havoc
  • 8. What do we normally use? ● We typically use normal RATs which follow the client/server standard ○ Meterpreter ○ Beacon ○ Custom code ● We don’t enable code to self-propagate ● We don’t enable code to perform destructive actions ● Usually, our use of malware is to help facilitate access and execute “tasks” on the victim machine
  • 9. RATs ● When breaking into a system, it’s highly probable you will need to account for Anti-Virus ● Using widely published tools/callback generators can potentially increase the likelihood detection ○ Metasploit, UPX Packers, even Veil-Evasion at times ● Custom code is your way around AV
  • 10. RAT Functionality ● C2 Comms that check-in ● Ability to execute command line commands ● Ability to inject shellcode ● Ability to inject shellcode into remote processes
  • 11. Server Functionality ● Server isn’t obvious upon first analysis ○ Any true IR pro will discover its intent ● Anti-replay detection/prevention ○ Same URI twice, or not a whitelisted URI? Ban/Block the offending IP ● Track and manage multiple agents ● Handle data gathered by agent and submitted to server
  • 13. Shellcode Injection ● This is performed by stagers (usually) ○ Their goal typically is to download and inject a reflective dll ● Any language that has access to the Windows API can have their own shellcode injection functionality ● While this sounds complicated, it’s an easy step ○ You only need to call four functions
  • 14. Shellcode Injection ● The main concept is: ○ Allocate memory for shellcode ○ Copy the shellcode you want to run into the memory that was just allocated ○ Create a thread that executes the shellcode ○ Wait for the thread to exit (let it run)
  • 15. VirtualAlloc ● This function allocates memory ● It takes the following input for our use: ○ (Optional) Location to start allocating memory - Null ○ The amount (size) of memory to allocate ○ A value specifying to both reserve and commit the memory ○ A value specifying this section of memory with RWX permissions
  • 16. RtlMoveMemory ● This will copy the shellcode into the memory we previously allocated ● It takes the following input for our use: ○ A pointer to the location in memory where space has been allocated ○ The location of the data that needs to be moved ○ The length of the data being moved (length of shellcode)
  • 17. CreateThread ● This creates a thread to execute shellcode ● It takes the following input for our use: ○ Null value (security attributes) ○ Null value (stack size specification) ○ Pointer to the start of the shellcode ○ Null value (no variables) ○ “0” - Thread runs immediately ○ “0” - Don’t need a thread identifier
  • 18. WaitForSingleObject ● This specifies the program to allow the thread to execute ● It takes the following input for our use: ○ A handle to the thread that was just created ○ The value “-1” to tell the program to wait to exit until the thread exits
  • 19.
  • 20. Added Shellcode Injection with C# Wouldn’t it be cool to have that in a C# RAT Stager? More to come people!
  • 21. I didn’t take the “write shellcode class”
  • 22. Shellcode 101 Class – use tools!
  • 23. ColbaltStrike Beacon and Meterpreter Shellcode ● Beacon listeners are compatible with MSFVenom generated shellcode ○ As long as you use shellcode for the same “type” of payload ■ meterpreter/reverse_https == beacon reverse https ■ meterpreter/reverse_http == beacon reverse http
  • 25. Process Injection ● This is relatively similar to shellcode injection. ● You’re not allocating space in your own process, you are doing it in another (remote) process. ● This is also done in four steps: ○ Obtain a handle to the remote process ○ Allocate memory for your shellcode in the remote process ○ Write the shellcode to the remote memory space ○ Create a thread in the remote process
  • 26. OpenProcess ● This provides a handle to the process we want to inject shellcode into ● This takes three inputs ○ The level of access requested (all access) ○ Specifying that new processes don’t inherit the handle ○ The process ID of the process that will have shellcode injected into it
  • 27. VirtualAllocEx ● This allocates memory in a remote process ● It takes five inputs ○ A handle to the remote process ○ Allow the function to determine where to allocate mem ○ The length of the shellcode ○ Specify to the function to allocate the required memory ○ The permissions on the memory that’s being allocated
  • 28. WriteProcessMemory ● This writes the shellcode to inject in the remote process ● This takes five inputs ○ A handle to the remote process ○ A pointer to the address in memory to write to ○ A variable containing the shellcode to inject ○ The length of the shellcode being injected ○ A NULL value since we don’t care about the number of bytes being written
  • 29. CreateRemoteThread ● This starts a remote thread to execute the shellcode ● This takes seven inputs ○ Handle to the remote process ○ Null, and 0, specifying security attributes and stack size ○ Pointer to location in memory containing code to run ○ 0, 0, 0 - Not passing a variable in, thread runs immediately, and we don’t care about thread id
  • 30.
  • 32.
  • 34. Keylogging ● We’ll make a python based keylogger for this example ● It’s pretty simple, and can be package into an executable ● Best part, there’s already public code for it! ○ Needed small mods ● Can be run from user-level (don’t need admin rights)
  • 35.
  • 37. Malware Agents ● Need to egress network boundaries ○ HTTP(S) is likely easiest to use ● Want to have secure comms with server ● Need to be able to receive commands OR have the commands already built into them ○ Also need to be able to send back results ● Need to evade antivirus
  • 39. C2 Servers ● Not immediately stand out as a C2 server ○ Some sort of security through obfuscation ● Protect against replay attacks ● Ensure secure communications with agents ● Track multiple agents and have the ability to issue individual commands
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. AV Detection ● So I’m going to show a story here about how I failed for this presentation
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 53. Case Study - Enumerator ● Client didn’t want actual shellcode injection and infection of their environment ● They wanted intel collection from the systems where the payloads were executed ● The data gathered by the script/malware needed to egress the network to our listening server
  • 55.
  • 56.
  • 58.
  • 59.
  • 60.
  • 61.
  • 63.
  • 64. Same Same, but C# Case Study: Reverse Shell
  • 67. Agent Side Server Side You literally just run the exe….
  • 69. Building Out C# RAT ● Wanted custom quick RAT that I could use upon initial compromise ● Benefits: ○ Can be quickly modified to evade AV signatures ○ Provides you initial cmd access to compromised system for quick tasks: ■ Recon/enumeration ■ Adding user accounts ■ Persistence ○ Can be easily modified to add more functionality: ■ persistence, shellcode injection, process injection, encrypted coms, encrypted payloads ○ Used as a stager: Added shellcode and process injection to inject a more complete RAT into memory and avoid detection. (Yes, that comes with my version!)
  • 71. DarkLink Overview ● Really simple $h!7, but quick and easy ● What is it? ● C# dropper that will download and execute your arbitrary payload ● Will persist the payload automatically ● Bottom line: quick persistence/dropper for your actual payload
  • 72. Fun Persistence Techniques ● Checks for Internet using Google.com ● Downloads payload to a folder it can write to ● Checks to see what software is installed ● Will schedule a task OR modify registry
  • 73. Little Bit More Detail ● What folders does it check? ○ C:Program Files (x86)AdobeReader 10.0Reader ○ C:Program Files (x86)AdobeFlash Player ○ C:Program Files (x86)Javajre7bin ○ C:Program Files (x86)GoogleChromeApplication ○ C:Program Files (x86)Mozilla Firefox ● Checks all versions of Adobe and Java ● Will check for Program Files if x86 doesn’t exist ● Depending on results, will create update. E.g. AdobeUpdater.exe ● Supports registry persistence and scheduled task ● Much more to add! Fork it and add it ○ WMI persistence, permissions checks, service creation, see Bsides talk
  • 74. Wrapup ● This stuff is quick and easy to develop ○ You don’t need to be a “developer” to write your own malware/stagers ● Everything we talked about is mostly used for initial access. ○ You don’t want to burn your full blown RAT (pawn) ○ You might just need initial persistence quickly ○ Can be modified to expand functionality and bypass AV
  • 75. Links to Code/Projects ● Shellcode Injection - https://gist.github. com/ChrisTruncer/183ed7e4388388771654fd8cf7e91 e2a ● Process Injection - https://gist.github. com/ChrisTruncer/ee11640831eca846d18d12e8ee193 f77 ● Keylogger - https://github. com/ChrisTruncer/PenTestScripts/blob/master/keylog ger.py
  • 76. Links to Code/Projects ● Keylogger - https://github. com/ChrisTruncer/PenTestScripts/blob/master/keylogg er.py ● DarkLink - https://github.com/chango77747/DarkLink ● ReverseShell C# - https://github.com/chango77747/ReverseShell
  • 77. Questions? ● Chris Truncer (@ChrisTruncer) ○ https://github.com/ChrisTruncer ● Evan Pena (@evan_pena2003) ○ https://github.com/chango77747