SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
FileLess Malware
Infections
Malware tricks for Pentesters
Ramon Pinuaga
Bsides Lisbon 2017
2
1) Presentation
2) Real world examples
3) Process
• Infection
• Persistence
4) Conclusions
Index
PRESENTATION
4
• Pentester for many, many years.
• Current position: Cybersecurity
Audit Manager at PROSEGUR
Spain.
• I prefer the offensive side of
security.
Who are you?
5
• Malicious code that doesn't need to create or drop
regular files on the system.
• Move away from the traditional monolithic malware
or pentesting framework.
• For persistence we usually need to leave at least
something on the system but we can hide it and make
it very small.
What is FileLess Malware?
7
• We have 2 main ways to achieve an infection without
files:
• Not using malware (or code) at all. E.G. planting a
configuration only backdoor on a system. That way we
don’t control the system all the time but we can access it
later.
• Using code that never touches disk. In his clear form. For
persistence we always need a way to keep at least the first
stage of the code on the system.
FileLess or MalwareLess?
8
• Evading Antivirus detection: No file, No scan, No
VirusTotal upload. 
• Leaving a smaller forensic trail: Less artifacts.
• Difficult environments (hard to upload things).
• Helps in bypassing Application Whitelisting (SRP,
Applocker, etc.)
Why FileLess in pentesting?
10
• Long-term persistence.
• Kernel-level access.
• High level hiding.
• Quickness and simplicity: Only userland, No rootkits,
No NSA like implants.
Pentest vs APT
DEMO: RDP + Sethc
• Enable remote desktop
• Hijack sethc.exe
• Change RDP port
• Open windows firewall
13
• Keeping all in memory. (Problem: no persistence)
• Storing the code in non-file or non-regular storage
(classics):
• Outside the filesystem: UEFI, HDD Firmware, Hidden disk
areas, $EA, etc. (We are not going that far, remember; only
userland)
• Network / External systems.
• Alternate Data Streams (ADS).
• Registry.
How to keep code without files?
14
• WMI (subscriptions).
• Windows events (.evt).
• Inside Documents (.doc, .xls, .pdf).
• File/Directory names (0-day).
• Environment variables (more 0-day).
Novel non-regular storage
DEMO: Code in filenames
• Stage 1: Run key
• Stage 2: Environment
• Stage 3: Dir names
17
• Remote injection in memory -> Remote call or exploit.
• Load of remote binaries (EXEs, DLLs) -> Via SMB,
WebDAV, etc.
• Scripting languages -> Loaded remotely or from the
command line.
• PowerShell (Powershell.exe)
• Javascript/Vbscript (Cscript.exe, Wscript.exe, Mshta.exe,
Rundll32.exe, Regsvr32.exe).
• .Net assemblies (InstallUtil.exe, IEExec.exe, RegAsm.exe).
How to execute code without files?
18
• Tools already installed on the system (no new files).
• Tools that allow receiving external input (via
command line or via the network).
• Bonus: Tools signed by Microsoft.
Our FileLess pentest framework
REAL WORLD EXAMPLES
20
• Worms (memory only):
• Slammer.
• Poweliks.
• WMIGhost.
• Empire.
• Duqu 2.0 (Kaspersky).
Real world examples
21
• Worm that infected thousands of computers and
impacted general Internet traffic in some areas.
• The worm exploited a buffer overflow vulnerability in
Microsoft SQL Server resolution service (1434/UDP).
• Only 376 bytes and fitted into a single UDP packet.
Slammer (2003)
22
• Infection via Word macro (No FileLess).
• Persistence via Autostart registry key
(HKLMSoftwareMicrosoftWindowsCurrentVersion
Run).
• Minimal first stage: Uses clever rundll32 trick to run
Javascript code.
• Next stages also stored in the registry (encoded). Runs
PowerShell code.
• PowerShell injects a DLL in another process memory,
without touching disk.
Poweliks (2014)
23
Poweliks – Rundll32 trick
24
• Infection via Word macro.
• Dropper and UAC bypass binaries touch disk (not fully
FileLess).
• Then it register the permanent and necessary WMI
classes: event definition, event filter and event
consumer.
• It uses Javascript for payload code in the event
consumer active script.
WMIghost (2014)
25
• PowerShell based RAT.
• It tries to be as FileLess as possible.
• Mostly working from memory only.
• Various options for persistent storage: Registry, ADS,
Eventlog and of course WMI subscriptions.
Empire (2015)
26
• Unknown infection vector.
• Only a few selected hosts were used for on-disk
persistence.
• These hosts injected the malware remotely into other
systems memory.
• For this task the malware gained domain
administrator privileges and then it deployed MSI
packages (via a new service or a scheduled task).
Duqu 2.0 (2015)
28
• First stage: Minimal. Usually a small vbs or js (not
directly PowerShell).
• Second Stage: Main script based on PowerShell. More
complex and powerful logic that injects a binary into
another process.
• Third stage: Binary. Usually a PE DLL payload. More
similar to traditional malware, but never touches disk.
Common FileLess behavior
PROCESS
30
• An ideal FileLess pentest operation should cover the following
phases:
1. FileLess Infection.
2. Installation of FileLess Backdoors.
3. Gain FileLess Persistence.
Operation Process
31
• Infection without sending any files.
• Not common. Even known FileLess APT operations
use some kind of files in this stage.
• Preferably, we need to deliver the exploit before the
application layer.
• Inside a stream.
• At the lower network layers (e.g. SMB or SSL exploits).
• Open network services (e.g. Eternalblue).
FileLess Infection
32
• Configuration only backdoors (no code).
• Some popular:
• Create user + Remote exec (Psexec/Sc, WMI, SchTasks,
WinRM, PSRemoting).
• Binary Image Hijack + Remote Desktop.
• Silver/Golden tickets.
• Proxy + Decrease security.
FileLess Backdoors
34
• First stage: Registry Autostart entries.
• Run entries.
• Scheduled tasks.
• Image hijacks.
• WMI.
• Services (not very elegant).
• Usually too noisy! For a human analyst but harder to
detect with automated tools because we are not
using any files.
FileLess persistence
CONCLUSIONS
36
• Full pentest operations are possible without using any
files (or almost).
• We need some “resident” artifacts on the system, but
these can be very small and can be easily hidden.
Conclusions
37
• Questions? Comments?
• https://twitter.com/rpinuaga
Thanks
38
• A lot of ideas taken from:
• Casey Smith: https://twitter.com/subtee
• Didier Stevens: https://twitter.com/DidierStevens
• Alex Abramov: https://twitter.com/codereversing
• Rob Fuller: https://twitter.com/mubix
• Cneelis: https://twitter.com/Cneelis
• Matt Nelson: https://twitter.com/enigma0x3
• Matt Graeber: https://twitter.com/mattifestation
• James Foreshaw - https://twitter.com/tiraniddo
Previous research
www.prosegur.com
DEMO: Proxy + Authenticode
• Convince the user to execute a .REG file
• Configure Proxy
• Disable Authenticode validation
• Wait for EXE download

Mais conteúdo relacionado

Mais procurados

CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisCNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisSam Bowne
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & TestingDeepu S Nath
 
Metasploit seminar
Metasploit seminarMetasploit seminar
Metasploit seminarhenelpj
 
Vulnerability Management
Vulnerability ManagementVulnerability Management
Vulnerability Managementasherad
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOWASP Delhi
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware AnalysisAndrew McNicol
 
Brute force attack
Brute force attackBrute force attack
Brute force attackjoycruiser
 
Living off the land and fileless attack techniques
Living off the land and fileless attack techniquesLiving off the land and fileless attack techniques
Living off the land and fileless attack techniquesSymantec Security Response
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySandip Chaudhari
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practicesScott Hurrey
 
Hunting Lateral Movement in Windows Infrastructure
Hunting Lateral Movement in Windows InfrastructureHunting Lateral Movement in Windows Infrastructure
Hunting Lateral Movement in Windows InfrastructureSergey Soldatov
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applicationsNiyas Nazar
 
Sql injection in cybersecurity
Sql injection in cybersecuritySql injection in cybersecurity
Sql injection in cybersecuritySanad Bhowmik
 
Understanding Application Threat Modelling & Architecture
 Understanding Application Threat Modelling & Architecture Understanding Application Threat Modelling & Architecture
Understanding Application Threat Modelling & ArchitecturePriyanka Aash
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionSina Manavi
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing Priyanka Aash
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentTeymur Kheirkhabarov
 
Information security & ethical hacking
Information security & ethical hackingInformation security & ethical hacking
Information security & ethical hackingSahil Rai
 

Mais procurados (20)

CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisCNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & Testing
 
Metasploit seminar
Metasploit seminarMetasploit seminar
Metasploit seminar
 
Vulnerability Management
Vulnerability ManagementVulnerability Management
Vulnerability Management
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilities
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware Analysis
 
Brute force attack
Brute force attackBrute force attack
Brute force attack
 
Living off the land and fileless attack techniques
Living off the land and fileless attack techniquesLiving off the land and fileless attack techniques
Living off the land and fileless attack techniques
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
Hunting Lateral Movement in Windows Infrastructure
Hunting Lateral Movement in Windows InfrastructureHunting Lateral Movement in Windows Infrastructure
Hunting Lateral Movement in Windows Infrastructure
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
Sql injection in cybersecurity
Sql injection in cybersecuritySql injection in cybersecurity
Sql injection in cybersecurity
 
Understanding Application Threat Modelling & Architecture
 Understanding Application Threat Modelling & Architecture Understanding Application Threat Modelling & Architecture
Understanding Application Threat Modelling & Architecture
 
Pgp
PgpPgp
Pgp
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL Injection
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
 
Information security & ethical hacking
Information security & ethical hackingInformation security & ethical hacking
Information security & ethical hacking
 

Semelhante a Fileless Malware Infections

unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfRohitGautam261127
 
On non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits andOn non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits andAlisa Esage Шевченко
 
Esage on non-existent 0-days, stable binary exploits and user interaction
Esage   on non-existent 0-days, stable binary exploits and user interactionEsage   on non-existent 0-days, stable binary exploits and user interaction
Esage on non-existent 0-days, stable binary exploits and user interactionDefconRussia
 
Lecture 12 malicious software
Lecture 12 malicious software Lecture 12 malicious software
Lecture 12 malicious software rajakhurram
 
CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorSam Bowne
 
Dealing with legacy code
Dealing with legacy codeDealing with legacy code
Dealing with legacy codeG Prachi
 
CISSP Week 14
CISSP Week 14CISSP Week 14
CISSP Week 14jemtallon
 
Project Malware AnalysisCS 6262 Project 3Agenda.docx
Project Malware AnalysisCS 6262 Project 3Agenda.docxProject Malware AnalysisCS 6262 Project 3Agenda.docx
Project Malware AnalysisCS 6262 Project 3Agenda.docxbriancrawford30935
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorSam Bowne
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsenSilo
 
Piratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPiratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPriyanka Aash
 
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
 
Threats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxThreats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxAmitesh Bharti
 
Practical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorPractical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorSam Bowne
 
Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment isc2-hellenic
 
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
 

Semelhante a Fileless Malware Infections (20)

unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdf
 
Botnets Attacks.pptx
Botnets Attacks.pptxBotnets Attacks.pptx
Botnets Attacks.pptx
 
Dll injection
Dll injectionDll injection
Dll injection
 
On non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits andOn non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits and
 
Esage on non-existent 0-days, stable binary exploits and user interaction
Esage   on non-existent 0-days, stable binary exploits and user interactionEsage   on non-existent 0-days, stable binary exploits and user interaction
Esage on non-existent 0-days, stable binary exploits and user interaction
 
Spo2 t19 spo2-t19
Spo2 t19 spo2-t19Spo2 t19 spo2-t19
Spo2 t19 spo2-t19
 
Lecture 12 malicious software
Lecture 12 malicious software Lecture 12 malicious software
Lecture 12 malicious software
 
CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware Behavior
 
Dealing with legacy code
Dealing with legacy codeDealing with legacy code
Dealing with legacy code
 
CISSP Week 14
CISSP Week 14CISSP Week 14
CISSP Week 14
 
Project Malware AnalysisCS 6262 Project 3Agenda.docx
Project Malware AnalysisCS 6262 Project 3Agenda.docxProject Malware AnalysisCS 6262 Project 3Agenda.docx
Project Malware AnalysisCS 6262 Project 3Agenda.docx
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware Behavior
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
 
Piratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPiratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigation
 
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
 
Threats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxThreats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in Linux
 
Practical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorPractical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware Behavior
 
Isys20261 lecture 05
Isys20261 lecture 05Isys20261 lecture 05
Isys20261 lecture 05
 
Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment
 
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
 

Último

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 

Último (20)

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 

Fileless Malware Infections

  • 1. FileLess Malware Infections Malware tricks for Pentesters Ramon Pinuaga Bsides Lisbon 2017
  • 2. 2 1) Presentation 2) Real world examples 3) Process • Infection • Persistence 4) Conclusions Index
  • 4. 4 • Pentester for many, many years. • Current position: Cybersecurity Audit Manager at PROSEGUR Spain. • I prefer the offensive side of security. Who are you?
  • 5. 5 • Malicious code that doesn't need to create or drop regular files on the system. • Move away from the traditional monolithic malware or pentesting framework. • For persistence we usually need to leave at least something on the system but we can hide it and make it very small. What is FileLess Malware?
  • 6.
  • 7. 7 • We have 2 main ways to achieve an infection without files: • Not using malware (or code) at all. E.G. planting a configuration only backdoor on a system. That way we don’t control the system all the time but we can access it later. • Using code that never touches disk. In his clear form. For persistence we always need a way to keep at least the first stage of the code on the system. FileLess or MalwareLess?
  • 8. 8 • Evading Antivirus detection: No file, No scan, No VirusTotal upload.  • Leaving a smaller forensic trail: Less artifacts. • Difficult environments (hard to upload things). • Helps in bypassing Application Whitelisting (SRP, Applocker, etc.) Why FileLess in pentesting?
  • 9.
  • 10. 10 • Long-term persistence. • Kernel-level access. • High level hiding. • Quickness and simplicity: Only userland, No rootkits, No NSA like implants. Pentest vs APT
  • 11. DEMO: RDP + Sethc • Enable remote desktop • Hijack sethc.exe • Change RDP port • Open windows firewall
  • 12.
  • 13. 13 • Keeping all in memory. (Problem: no persistence) • Storing the code in non-file or non-regular storage (classics): • Outside the filesystem: UEFI, HDD Firmware, Hidden disk areas, $EA, etc. (We are not going that far, remember; only userland) • Network / External systems. • Alternate Data Streams (ADS). • Registry. How to keep code without files?
  • 14. 14 • WMI (subscriptions). • Windows events (.evt). • Inside Documents (.doc, .xls, .pdf). • File/Directory names (0-day). • Environment variables (more 0-day). Novel non-regular storage
  • 15. DEMO: Code in filenames • Stage 1: Run key • Stage 2: Environment • Stage 3: Dir names
  • 16.
  • 17. 17 • Remote injection in memory -> Remote call or exploit. • Load of remote binaries (EXEs, DLLs) -> Via SMB, WebDAV, etc. • Scripting languages -> Loaded remotely or from the command line. • PowerShell (Powershell.exe) • Javascript/Vbscript (Cscript.exe, Wscript.exe, Mshta.exe, Rundll32.exe, Regsvr32.exe). • .Net assemblies (InstallUtil.exe, IEExec.exe, RegAsm.exe). How to execute code without files?
  • 18. 18 • Tools already installed on the system (no new files). • Tools that allow receiving external input (via command line or via the network). • Bonus: Tools signed by Microsoft. Our FileLess pentest framework
  • 20. 20 • Worms (memory only): • Slammer. • Poweliks. • WMIGhost. • Empire. • Duqu 2.0 (Kaspersky). Real world examples
  • 21. 21 • Worm that infected thousands of computers and impacted general Internet traffic in some areas. • The worm exploited a buffer overflow vulnerability in Microsoft SQL Server resolution service (1434/UDP). • Only 376 bytes and fitted into a single UDP packet. Slammer (2003)
  • 22. 22 • Infection via Word macro (No FileLess). • Persistence via Autostart registry key (HKLMSoftwareMicrosoftWindowsCurrentVersion Run). • Minimal first stage: Uses clever rundll32 trick to run Javascript code. • Next stages also stored in the registry (encoded). Runs PowerShell code. • PowerShell injects a DLL in another process memory, without touching disk. Poweliks (2014)
  • 24. 24 • Infection via Word macro. • Dropper and UAC bypass binaries touch disk (not fully FileLess). • Then it register the permanent and necessary WMI classes: event definition, event filter and event consumer. • It uses Javascript for payload code in the event consumer active script. WMIghost (2014)
  • 25. 25 • PowerShell based RAT. • It tries to be as FileLess as possible. • Mostly working from memory only. • Various options for persistent storage: Registry, ADS, Eventlog and of course WMI subscriptions. Empire (2015)
  • 26. 26 • Unknown infection vector. • Only a few selected hosts were used for on-disk persistence. • These hosts injected the malware remotely into other systems memory. • For this task the malware gained domain administrator privileges and then it deployed MSI packages (via a new service or a scheduled task). Duqu 2.0 (2015)
  • 27.
  • 28. 28 • First stage: Minimal. Usually a small vbs or js (not directly PowerShell). • Second Stage: Main script based on PowerShell. More complex and powerful logic that injects a binary into another process. • Third stage: Binary. Usually a PE DLL payload. More similar to traditional malware, but never touches disk. Common FileLess behavior
  • 30. 30 • An ideal FileLess pentest operation should cover the following phases: 1. FileLess Infection. 2. Installation of FileLess Backdoors. 3. Gain FileLess Persistence. Operation Process
  • 31. 31 • Infection without sending any files. • Not common. Even known FileLess APT operations use some kind of files in this stage. • Preferably, we need to deliver the exploit before the application layer. • Inside a stream. • At the lower network layers (e.g. SMB or SSL exploits). • Open network services (e.g. Eternalblue). FileLess Infection
  • 32. 32 • Configuration only backdoors (no code). • Some popular: • Create user + Remote exec (Psexec/Sc, WMI, SchTasks, WinRM, PSRemoting). • Binary Image Hijack + Remote Desktop. • Silver/Golden tickets. • Proxy + Decrease security. FileLess Backdoors
  • 33.
  • 34. 34 • First stage: Registry Autostart entries. • Run entries. • Scheduled tasks. • Image hijacks. • WMI. • Services (not very elegant). • Usually too noisy! For a human analyst but harder to detect with automated tools because we are not using any files. FileLess persistence
  • 36. 36 • Full pentest operations are possible without using any files (or almost). • We need some “resident” artifacts on the system, but these can be very small and can be easily hidden. Conclusions
  • 37. 37 • Questions? Comments? • https://twitter.com/rpinuaga Thanks
  • 38. 38 • A lot of ideas taken from: • Casey Smith: https://twitter.com/subtee • Didier Stevens: https://twitter.com/DidierStevens • Alex Abramov: https://twitter.com/codereversing • Rob Fuller: https://twitter.com/mubix • Cneelis: https://twitter.com/Cneelis • Matt Nelson: https://twitter.com/enigma0x3 • Matt Graeber: https://twitter.com/mattifestation • James Foreshaw - https://twitter.com/tiraniddo Previous research
  • 40. DEMO: Proxy + Authenticode • Convince the user to execute a .REG file • Configure Proxy • Disable Authenticode validation • Wait for EXE download