SlideShare a Scribd company logo
DESIGNING
MALWARE FOR
MODERN
RED-TEAMING &
TRADECRAFT
ADVERSARY
Satria Ady Pradana
WHO?
Satria Ady Pradana
• Cyber Security Consultant at Mitra
Integrasi Informatika
• Director of Curriculum at Archonlabs
SSD
• Penetration Tester, Red Team
• Community Leader of Reversing.ID
20XX Pitch Deck 2
@xathrya xathrya xathrya_
BACKGROUND
STORY
RED TEAMING
• Originate from military practices.
• Evaluate security posture by playing as aggressor.
• Full-scope, multi-layered attack simulation designed to measure
how well organization’s security controls can withstand attack
from real-life adversaries.
REQUIREMENT
2021 PyCon ID (Security) 5
• Deep knowledge of systems (computer system, protocols,
libraries, etc).
• Ability to think outside the box.
• Software development skills.
• Penetration testing skills
• Social engineering.
WHEN DOING RED TEAMING
2021 PyCon ID (Security) 6
• Long time engagement (1 – 3 months at minimum).
• Penetrate as deep as possible, maintain persistence, pivoting,
exfiltrate critical information.
• It means you need a way to keep your presence in the network!
THE CYBER KILL CHAIN
2021 PyCon ID (Security) 7
WHY PYTHON?
2021 PyCon ID (Security) 8
• Simple and clean structure
• Designed for rapid prototyping
• Extensive library
WHERE TO
START?
DESIGNING IMPLANT
2021 PyCon ID (Security) 10
• What is the purpose of the implant?
• What success look like?
• Which feature or capabilities we need?
DESIGNING IMPLANT
2021 PyCon ID (Security) 11
• Lightweight: can be dropped through macro-enabled office
document.
• Evasive: evade most common products without much
adaptation
• Functional: collect information about target environment to aid
in further operations.
TERMS
20XX Pitch Deck 12
• Command and Control
attacker-controlled infrastructure which maintain control over all agents or
implants by send command and retrieve the result. Alternative name: C&C,
C2 server
• Implant
agent, small program which executed on target. Alternative name: RAT,
backdoor, beacon.
• Loader
specific code or executable which purpose is to load the payload (implant)
or other loader.
TERMS
20XX Pitch Deck 13
• Redirectors
Node or system which proxies all traffic from target network (implant) to C2
server, hiding the true location of the C2 server.
ROBUST INFRASTRUCTURE
2021 PyCon ID (Security) 14
Interactive (Tier 3)
• General command, enumeration,
scanning, data exfiltration, etc.
• Has most interaction and at greatest
risk of exposure.
• Ready to abandon at any time.
Multiple tiers
ROBUST INFRASTRUCTURE
2021 PyCon ID (Security) 15
Short Haul (Tier 2)
• As a backup to reestablish interactive
session.
• Use covert communications that blend
with target.
• Slow callback times, i.e. 1 – 24 hours.
Multiple tiers
ROBUST INFRASTRUCTURE
2021 PyCon ID (Security) 16
Long Haul (Tier 1)
• Maintain long-term access into target’s
network.
• Same as short haul, but slower.
Multiple tiers
2021 PyCon ID (Security) 17
MINIMUM REQUIREMENT
2021 PyCon ID (Security) 18
• Communication Channel
• Modular Design
• Dynamic Reconfigurable
PLANNING FOR
OPERATION
MITRE ATT&CK
2021 PyCon ID (Security) 20
https://attack.mitre.org/
2021 PyCon ID (Security) 21
https://attack.mitre.org/groups/G0016/
2021 PyCon ID (Security) 22
DESIGN &
IMPLEMENTATIO
N
COMMUNICATION CHANNEL
2021 PyCon ID (Security) 24
• HTTP/HTTPS: masquerade as legitimate HTTP connections
• DNS:
• Hybrid: DNS for telemetry or callback, HTTP for data channel.
• Pure DNS
• SMB: chaining beacons
• TCP: with proprietary protocols
CASE: HTTP
2021 PyCon ID (Security) 25
import requests
url = GenerateURL()
headers = GenerateHeaders()
body = GenerateBody()
res = requests.post(url, data=body, headers=headers)
ProcessResponse(res)
Message Type:
• Callback
• Command
• Result
• Dynamic URL and endpoint?
• Unique ID
• Payload, where?
• Interval and jitter
• Telemetry, health check
MODULAR DESIGN
2021 PyCon ID (Security) 26
• Adding new features/capabilities should not changes the core
program.
• Framework?
• Implement feature as addon or plugins
• Use builtin or Windows API?
• Stages? Stageless?
CASE: COMMANDS
2021 PyCon ID (Security) 27
• GET
• PUT
• LIST
• EXECUTE
• LOAD
• Module: credential harvesting,
• CONFIGURE: key, channel, IP, port, host, endpoint
CASE: WMI COMMAND
2021 PyCon ID (Security) 28
• Windows Management Interface
• Query system state (process, services, installed apps, bios, etc)
• WQL (WMI Query Language)
• Module: wmi
• pip install wmi
• Extending implant with WMI command
COMMAND: EXECUTE SHELLCODE
2021 PyCon ID (Security) 29
• Raw shellcode as payload
• Why shellcode?
• Run as separate thread
• Allocate space on host process
• Decrypt/decompress/decode shellcode to allocated space
• Create new thread and start execution from allocated space
• Clean up
COMMAND: DROP & EXECUTE BINARY
2021 PyCon ID (Security) 30
• Fetch executable from C2 server
• Mostly tools: Rubeus, mimikatz, message relay
• Store the executable temporary
• What about DLL?
COMMAND: SHELL COMMAND
2021 PyCon ID (Security) 31
• Execute shell command
• Atomic or session?
Variations
• os.command()
• subprocess.run()
• subprocess.Popen()
DYNAMIC RECONFIGURABLE
2021 PyCon ID (Security) 32
• Change settings/configurations at runtime.
• IP address + endpoint
• Message type
• Profile
• Should match with C2 server
PROTECTION
2021 PyCon ID (Security) 33
• Any tool deployed in target environment needs to adhere to the
highest standard of operational security (opsec)
2021 PyCon ID (Security) 34
THANK YOU
Satria Ady Pradana
satria.pradana [at] mii.co.id
@xathrya (telegram)
2021 PyCon ID (Security) 35

More Related Content

PPTX
Bypass Security Checking with Frida
PDF
Silabus Training Reverse Engineering
PPTX
Reverse Engineering: Protecting and Breaking the Software (Workshop)
PPTX
Reverse Engineering: Protecting and Breaking the Software
PPTX
(Training) Malware - To the Realm of Malicious Code
PPTX
External to DA, the OS X Way
PPTX
Path of Cyber Security
PDF
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
Bypass Security Checking with Frida
Silabus Training Reverse Engineering
Reverse Engineering: Protecting and Breaking the Software (Workshop)
Reverse Engineering: Protecting and Breaking the Software
(Training) Malware - To the Realm of Malicious Code
External to DA, the OS X Way
Path of Cyber Security
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao

What's hot (19)

PDF
CSW2017 Geshev+Miller logic bug hunting in chrome on android
PPTX
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
PPTX
Hunting on the Cheap
PDF
The Dark Side of PowerShell by George Dobrea
PDF
Pki 201 Key Management
PDF
CSW2017 chuanda ding_state of windows application security
PPTX
Sticky Keys to the Kingdom
PDF
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PDF
Common crypto attacks and secure implementations
PDF
Buffer Overflow Attacks
PDF
Defcon 22-tim-mcguffin-one-man-shop
PPTX
Reversing malware analysis training part10 exploit development basics
PPTX
EmPOW: Integrating Attack Behavior Intelligence into Logstash Plugins
PDF
2012 S&P Paper Reading Session1
PDF
Zerotrusting serverless applications protecting microservices using secure d...
PDF
Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016)
PDF
Malware collection and analysis
PDF
Talk28oct14
PDF
CSF18 - Implementing Gartners #1 - Whitelisting- Karim El-Melhaoui
CSW2017 Geshev+Miller logic bug hunting in chrome on android
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
Hunting on the Cheap
The Dark Side of PowerShell by George Dobrea
Pki 201 Key Management
CSW2017 chuanda ding_state of windows application security
Sticky Keys to the Kingdom
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
Common crypto attacks and secure implementations
Buffer Overflow Attacks
Defcon 22-tim-mcguffin-one-man-shop
Reversing malware analysis training part10 exploit development basics
EmPOW: Integrating Attack Behavior Intelligence into Logstash Plugins
2012 S&P Paper Reading Session1
Zerotrusting serverless applications protecting microservices using secure d...
Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016)
Malware collection and analysis
Talk28oct14
CSF18 - Implementing Gartners #1 - Whitelisting- Karim El-Melhaoui
Ad

Similar to Malware for Red Team (20)

PDF
Pursuing evasive custom command & control - GuideM
PPTX
Using hypervisor and container technology to increase datacenter security pos...
PPTX
Using hypervisor and container technology to increase datacenter security pos...
DOCX
Ankit Vakil (1)
PPTX
Cloud Platform Symantec Meetup Nov 2014
PPTX
Stage 1 Tradecraft
PPTX
HAVOC-Workshop-Slides.pptx
PDF
How-To Find Malicious Backdoors and Business Logic Vulnerabilities in Your Code
PPTX
Fortinet sandboxing
PDF
I got 99 trends and a # is all of them
PDF
【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】
PDF
Vulnerability Alert Fatigue and Malicious Code Attacks Meetup 11012024.pdf
PPTX
Inria Tech Talk IoT - 28 Mars 2018
PPTX
Interop 2017 - Managing Containers in Production
PDF
Modern Post-Exploitation Strategies - 44CON 2012
PDF
[ITAS.VN]CxSuite Enterprise Edition
PDF
Andy Kennedy - Scottish VMUG April 2016
PPTX
OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar
PPTX
SUGCON EU 2023 - Secure Composable SaaS.pptx
PDF
GETTING STARTED WITH DATABASE SECURITY ASSESSMENT TOOL
Pursuing evasive custom command & control - GuideM
Using hypervisor and container technology to increase datacenter security pos...
Using hypervisor and container technology to increase datacenter security pos...
Ankit Vakil (1)
Cloud Platform Symantec Meetup Nov 2014
Stage 1 Tradecraft
HAVOC-Workshop-Slides.pptx
How-To Find Malicious Backdoors and Business Logic Vulnerabilities in Your Code
Fortinet sandboxing
I got 99 trends and a # is all of them
【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】
Vulnerability Alert Fatigue and Malicious Code Attacks Meetup 11012024.pdf
Inria Tech Talk IoT - 28 Mars 2018
Interop 2017 - Managing Containers in Production
Modern Post-Exploitation Strategies - 44CON 2012
[ITAS.VN]CxSuite Enterprise Edition
Andy Kennedy - Scottish VMUG April 2016
OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar
SUGCON EU 2023 - Secure Composable SaaS.pptx
GETTING STARTED WITH DATABASE SECURITY ASSESSMENT TOOL
Ad

More from Satria Ady Pradana (20)

PPTX
Down The Rabbit Hole, From Networker to Security Professional
PPTX
MITM: Tales of Trust and Betrayal
PPTX
Berkarir di Cyber Security
PPTX
IOT Security FUN-damental
PPTX
Python-Assisted Red-Teaming Operation
PPTX
IoT Security - Preparing for the Worst
PPTX
Practical Security - Modern Day Software
PPTX
Firmware Reverse Engineering
PPTX
Reverse Engineering: The Crash Course
PPTX
The Offensive Python: Practical Python for Penetration Testing
PPTX
From Reversing to Exploitation: Android Application Security in Essence
PPTX
Android Security: Art of Exploitation
PPTX
Malware: To The Realm of Malicious Code (Training)
PPTX
Memory Forensic: Investigating Memory Artefact (Workshop)
PPTX
Memory Forensic: Investigating Memory Artefact
PPTX
Another Side of Hacking
PPTX
Automatic Malware Analysis & Repository
PPTX
Web Security Jumpstart
PPTX
DracOs Forensic Flavor - Workshop
PPTX
DracOs Forensic Flavor
Down The Rabbit Hole, From Networker to Security Professional
MITM: Tales of Trust and Betrayal
Berkarir di Cyber Security
IOT Security FUN-damental
Python-Assisted Red-Teaming Operation
IoT Security - Preparing for the Worst
Practical Security - Modern Day Software
Firmware Reverse Engineering
Reverse Engineering: The Crash Course
The Offensive Python: Practical Python for Penetration Testing
From Reversing to Exploitation: Android Application Security in Essence
Android Security: Art of Exploitation
Malware: To The Realm of Malicious Code (Training)
Memory Forensic: Investigating Memory Artefact (Workshop)
Memory Forensic: Investigating Memory Artefact
Another Side of Hacking
Automatic Malware Analysis & Repository
Web Security Jumpstart
DracOs Forensic Flavor - Workshop
DracOs Forensic Flavor

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
KodekX | Application Modernization Development
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
Spectral efficient network and resource selection model in 5G networks
KodekX | Application Modernization Development
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Understanding_Digital_Forensics_Presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology

Malware for Red Team

  • 2. WHO? Satria Ady Pradana • Cyber Security Consultant at Mitra Integrasi Informatika • Director of Curriculum at Archonlabs SSD • Penetration Tester, Red Team • Community Leader of Reversing.ID 20XX Pitch Deck 2 @xathrya xathrya xathrya_
  • 4. RED TEAMING • Originate from military practices. • Evaluate security posture by playing as aggressor. • Full-scope, multi-layered attack simulation designed to measure how well organization’s security controls can withstand attack from real-life adversaries.
  • 5. REQUIREMENT 2021 PyCon ID (Security) 5 • Deep knowledge of systems (computer system, protocols, libraries, etc). • Ability to think outside the box. • Software development skills. • Penetration testing skills • Social engineering.
  • 6. WHEN DOING RED TEAMING 2021 PyCon ID (Security) 6 • Long time engagement (1 – 3 months at minimum). • Penetrate as deep as possible, maintain persistence, pivoting, exfiltrate critical information. • It means you need a way to keep your presence in the network!
  • 7. THE CYBER KILL CHAIN 2021 PyCon ID (Security) 7
  • 8. WHY PYTHON? 2021 PyCon ID (Security) 8 • Simple and clean structure • Designed for rapid prototyping • Extensive library
  • 10. DESIGNING IMPLANT 2021 PyCon ID (Security) 10 • What is the purpose of the implant? • What success look like? • Which feature or capabilities we need?
  • 11. DESIGNING IMPLANT 2021 PyCon ID (Security) 11 • Lightweight: can be dropped through macro-enabled office document. • Evasive: evade most common products without much adaptation • Functional: collect information about target environment to aid in further operations.
  • 12. TERMS 20XX Pitch Deck 12 • Command and Control attacker-controlled infrastructure which maintain control over all agents or implants by send command and retrieve the result. Alternative name: C&C, C2 server • Implant agent, small program which executed on target. Alternative name: RAT, backdoor, beacon. • Loader specific code or executable which purpose is to load the payload (implant) or other loader.
  • 13. TERMS 20XX Pitch Deck 13 • Redirectors Node or system which proxies all traffic from target network (implant) to C2 server, hiding the true location of the C2 server.
  • 14. ROBUST INFRASTRUCTURE 2021 PyCon ID (Security) 14 Interactive (Tier 3) • General command, enumeration, scanning, data exfiltration, etc. • Has most interaction and at greatest risk of exposure. • Ready to abandon at any time. Multiple tiers
  • 15. ROBUST INFRASTRUCTURE 2021 PyCon ID (Security) 15 Short Haul (Tier 2) • As a backup to reestablish interactive session. • Use covert communications that blend with target. • Slow callback times, i.e. 1 – 24 hours. Multiple tiers
  • 16. ROBUST INFRASTRUCTURE 2021 PyCon ID (Security) 16 Long Haul (Tier 1) • Maintain long-term access into target’s network. • Same as short haul, but slower. Multiple tiers
  • 17. 2021 PyCon ID (Security) 17
  • 18. MINIMUM REQUIREMENT 2021 PyCon ID (Security) 18 • Communication Channel • Modular Design • Dynamic Reconfigurable
  • 20. MITRE ATT&CK 2021 PyCon ID (Security) 20 https://attack.mitre.org/
  • 21. 2021 PyCon ID (Security) 21 https://attack.mitre.org/groups/G0016/
  • 22. 2021 PyCon ID (Security) 22
  • 24. COMMUNICATION CHANNEL 2021 PyCon ID (Security) 24 • HTTP/HTTPS: masquerade as legitimate HTTP connections • DNS: • Hybrid: DNS for telemetry or callback, HTTP for data channel. • Pure DNS • SMB: chaining beacons • TCP: with proprietary protocols
  • 25. CASE: HTTP 2021 PyCon ID (Security) 25 import requests url = GenerateURL() headers = GenerateHeaders() body = GenerateBody() res = requests.post(url, data=body, headers=headers) ProcessResponse(res) Message Type: • Callback • Command • Result • Dynamic URL and endpoint? • Unique ID • Payload, where? • Interval and jitter • Telemetry, health check
  • 26. MODULAR DESIGN 2021 PyCon ID (Security) 26 • Adding new features/capabilities should not changes the core program. • Framework? • Implement feature as addon or plugins • Use builtin or Windows API? • Stages? Stageless?
  • 27. CASE: COMMANDS 2021 PyCon ID (Security) 27 • GET • PUT • LIST • EXECUTE • LOAD • Module: credential harvesting, • CONFIGURE: key, channel, IP, port, host, endpoint
  • 28. CASE: WMI COMMAND 2021 PyCon ID (Security) 28 • Windows Management Interface • Query system state (process, services, installed apps, bios, etc) • WQL (WMI Query Language) • Module: wmi • pip install wmi • Extending implant with WMI command
  • 29. COMMAND: EXECUTE SHELLCODE 2021 PyCon ID (Security) 29 • Raw shellcode as payload • Why shellcode? • Run as separate thread • Allocate space on host process • Decrypt/decompress/decode shellcode to allocated space • Create new thread and start execution from allocated space • Clean up
  • 30. COMMAND: DROP & EXECUTE BINARY 2021 PyCon ID (Security) 30 • Fetch executable from C2 server • Mostly tools: Rubeus, mimikatz, message relay • Store the executable temporary • What about DLL?
  • 31. COMMAND: SHELL COMMAND 2021 PyCon ID (Security) 31 • Execute shell command • Atomic or session? Variations • os.command() • subprocess.run() • subprocess.Popen()
  • 32. DYNAMIC RECONFIGURABLE 2021 PyCon ID (Security) 32 • Change settings/configurations at runtime. • IP address + endpoint • Message type • Profile • Should match with C2 server
  • 33. PROTECTION 2021 PyCon ID (Security) 33 • Any tool deployed in target environment needs to adhere to the highest standard of operational security (opsec)
  • 34. 2021 PyCon ID (Security) 34
  • 35. THANK YOU Satria Ady Pradana satria.pradana [at] mii.co.id @xathrya (telegram) 2021 PyCon ID (Security) 35