SlideShare a Scribd company logo
1 of 12
Download to read offline
DLLInjection
Static Linking
• Code libraries (.lib) include lots of functions to be copied to
your program when required.
• So, there is no need to reinvent the wheel and rewrite these
functions again.
• This is done by a program called a linker, which basically
copies the needed functions into a program and generates
the executable file with all the needed functions inside.
• This process is called the static linking.
Dynamic Linking
• Statically linked libraries lead to having the same code
copied repeatedly inside each program.
• That might lead to the loss of hard disk space and
increases the size of the executable files.
• Dynamic linking allows programs to expand more and
become more functionality-rich.
• Instead of storing the code inside each executable, any
needed library is loaded beside each application in the
same virtual memory.
• These libraries are named Dynamic Link Libraries (DLLs).
Dynamic link libraries
• Not all library functions are exported as some of them are for internal use.
• But the functions that are exported can be accessed through its name or its ordinal
number (index number).
• They are called Application Programming Interfaces (APIs).
• APIs are those exported functions in any library that any application can call or
interact with
• Some of known Windows DLLs:
• kernel32.dll
• ntdll.dll
• user32.dll
• advapi32.dll
Dynamic API Loading
• It's very common in malware code to obscure the name of the libraries
and the APIs that they are using to hide their functionality from static
analysis using what's called dynamic API loading.
• Dynamic API loading is supported by Windows using two very well-known
APIs :
• LoadLibraryA: This API loads a dynamic link library into the virtual
memory of the calling program and returns its address (variations
include LoadLibraryW, LoadLibraryExA, and LoadLibraryExW).
• GetProcAddress: This API gets the address of an API given its name
and the address of the library that contains this API.
• By calling these two APIs, the malware is able to access APIs that are not
written in the import table and are totally hidden from the eyes of the
reverse engineer.
DLL Injection
• The Windows operating system allows processes to load dynamic link libraries
into other processes for security reasons, sandboxing, or even graphics.
• DLL injection is used to manipulate the execution of a running process.
• DLL injection primarily tricks an application to call a malicious DLL file which
then gets executed as part of the target process.
• DLL injection can be divided into 4 steps:
• 1. Attach to the process
• 2. Allocate Memory within the process
• 3. Copy the DLL or the DLL Path into the processes memory and determine
appropriate memory addresses
• 4. Instruct the process to Execute your DLL
Windows Supported DLL Injection
• Windows has created registry entries for DLLs so that they can be loaded in every process that meets
certain criteria.
• Many of them allow the malware DLL to be injected into multiple processes, including browsers and
other legitimate processes.
• Most common ones:
HKEY_LOCAL_MACHINESOFTWARE
MicrosoftWindowsNTCurrentVers
ionWindowsAppInit_DLLs
• The libraries included in
this path are loaded
together with every
process that loads
user32.dll.
Windows Supported DLL Injection (Cont.)
• Other commonly misused registry key:
• HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSessionManagerAppCertDlls
• The libraries in this registry entry are loaded in each process that calls at least one of the following
Win32 API functions:
• CreateProcess
• CreateProcessAsUser
• CreateProcessWithLogonW
• CreateProcessWithTokenW
• WinExec
• This allows the malware to be injected into most browsers as many of them create child processes to
manage different tabs and other applications as well.
Windows Supported DLL Injection (Cont.)
Autoruns from Sysinternals, allows you to see whether any of these registry entries have
been exploited for malicious use on the current system.
https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns
Another DLL Injection Technique
• This technique uses the LoadLibrary API to load a
malicious library using Windows PE loader and execute its
EntryPoint.
• The main goal is to inject the path of the malicious DLL
into the process using the VirtualAllocEx API and
WriteProcessMemory.
• Then, it creates a thread into that process using
CreateRemoteThread, with the address of the LoadLibrary
API as the thread start address.
• When passing the DLL path as an argument to that thread
(which is passed to the LoadLibrary API), the Windows PE
loader will load that DLL into the process and execute its
code flawlessly.
Another DLL Injection Technique (Cont.)
• The exact steps the malware generally follows are like so:
1. Get the targeted process handle via its PID using the OpenProcess API. This
handle will be used to access, read, and write to this process.
2. Allocate a space in that process virtual memory using the VirtualAllocEx API.
This space will be used to write the full path of the malicious DLL file.
3. Write to the process using the WriteProcessMemory API. Write the path of
the malware DLL.
4. Load and execute this DLL using CreateRemoteThread and give
the LoadLibraryA address as the start address and the address of the DLL path
as an argument.
References
• http://blog.opensecurityresearch.com/2013/01/windows-dllinjection-basics.html
• https://www.packtpub.com/product/mastering-malware-analysis/9781789610789

More Related Content

What's hot

Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static AnalysisHossein Yavari
 
Penetration testing reporting and methodology
Penetration testing reporting and methodologyPenetration testing reporting and methodology
Penetration testing reporting and methodologyRashad Aliyev
 
Web Application Penetration Tests - Information Gathering Stage
Web Application Penetration Tests - Information Gathering StageWeb Application Penetration Tests - Information Gathering Stage
Web Application Penetration Tests - Information Gathering StageNetsparker
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVAVINOTH R
 
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...CODE BLUE
 
Ch 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsCh 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsSam Bowne
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections frameworkRiccardo Cardin
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewMichael Furman
 
Security Code Review 101
Security Code Review 101Security Code Review 101
Security Code Review 101Paul Ionescu
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
 
Scalable threat modelling with risk patterns
Scalable threat modelling with risk patternsScalable threat modelling with risk patterns
Scalable threat modelling with risk patternsStephen de Vries
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in javapooja kumari
 

What's hot (20)

Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static Analysis
 
Penetration testing reporting and methodology
Penetration testing reporting and methodologyPenetration testing reporting and methodology
Penetration testing reporting and methodology
 
Security testing in mobile applications
Security testing in mobile applicationsSecurity testing in mobile applications
Security testing in mobile applications
 
Web Application Penetration Tests - Information Gathering Stage
Web Application Penetration Tests - Information Gathering StageWeb Application Penetration Tests - Information Gathering Stage
Web Application Penetration Tests - Information Gathering Stage
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
DLL Hijacking
DLL HijackingDLL Hijacking
DLL Hijacking
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...
[cb22] Keynote: Underwhelmed: Making Sense of the Overwhelming Challenge of C...
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
Introduction to threat_modeling
Introduction to threat_modelingIntroduction to threat_modeling
Introduction to threat_modeling
 
Ch 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsCh 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side Controls
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
 
Deep Web
Deep WebDeep Web
Deep Web
 
Metasploit framwork
Metasploit framworkMetasploit framwork
Metasploit framwork
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's New
 
Security Code Review 101
Security Code Review 101Security Code Review 101
Security Code Review 101
 
Threat Modeling Using STRIDE
Threat Modeling Using STRIDEThreat Modeling Using STRIDE
Threat Modeling Using STRIDE
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
 
Scalable threat modelling with risk patterns
Scalable threat modelling with risk patternsScalable threat modelling with risk patterns
Scalable threat modelling with risk patterns
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 

Similar to DLL Injection

Ch 6: The Wild World of Windows
Ch 6: The Wild World of WindowsCh 6: The Wild World of Windows
Ch 6: The Wild World of WindowsSam Bowne
 
Windows internals
Windows internalsWindows internals
Windows internalsPiyush Jain
 
CNIT 127 Ch 6: The Wild World of Windows
CNIT 127 Ch 6: The Wild World of WindowsCNIT 127 Ch 6: The Wild World of Windows
CNIT 127 Ch 6: The Wild World of WindowsSam Bowne
 
Sp group7 27_53_65_66_68_ppt_dynamic linking library
Sp group7 27_53_65_66_68_ppt_dynamic linking librarySp group7 27_53_65_66_68_ppt_dynamic linking library
Sp group7 27_53_65_66_68_ppt_dynamic linking librarySagarSikchi1
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxfatahozil
 
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsCNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsSam Bowne
 
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs Sam Bowne
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
CNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsCNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsSam Bowne
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1Hitesh Mohapatra
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfShaimaaMohamedGalal
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet frameworkNitu Pandey
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesVagif Abilov
 
Loaders complete
Loaders completeLoaders complete
Loaders completeFaisal Shah
 
Microservices: How loose is loosely coupled?
Microservices: How loose is loosely coupled?Microservices: How loose is loosely coupled?
Microservices: How loose is loosely coupled?John Rofrano
 
Tech presentation (part 1)
Tech presentation (part 1)Tech presentation (part 1)
Tech presentation (part 1)Abhijit Roy
 
CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorSam Bowne
 

Similar to DLL Injection (20)

Ch 6: The Wild World of Windows
Ch 6: The Wild World of WindowsCh 6: The Wild World of Windows
Ch 6: The Wild World of Windows
 
Windows internals
Windows internalsWindows internals
Windows internals
 
CNIT 127 Ch 6: The Wild World of Windows
CNIT 127 Ch 6: The Wild World of WindowsCNIT 127 Ch 6: The Wild World of Windows
CNIT 127 Ch 6: The Wild World of Windows
 
Sp group7 27_53_65_66_68_ppt_dynamic linking library
Sp group7 27_53_65_66_68_ppt_dynamic linking librarySp group7 27_53_65_66_68_ppt_dynamic linking library
Sp group7 27_53_65_66_68_ppt_dynamic linking library
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptx
 
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsCNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
 
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
CNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsCNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows Programs
 
E.s unit 6
E.s unit 6E.s unit 6
E.s unit 6
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
 
Loaders complete
Loaders completeLoaders complete
Loaders complete
 
Microservices: How loose is loosely coupled?
Microservices: How loose is loosely coupled?Microservices: How loose is loosely coupled?
Microservices: How loose is loosely coupled?
 
Tech presentation (part 1)
Tech presentation (part 1)Tech presentation (part 1)
Tech presentation (part 1)
 
CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware Behavior
 

More from Hossein Yavari

SIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingSIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingHossein Yavari
 
Desjardins Data Breach
Desjardins Data BreachDesjardins Data Breach
Desjardins Data BreachHossein Yavari
 
Introduction to Metasploit
Introduction to MetasploitIntroduction to Metasploit
Introduction to MetasploitHossein Yavari
 
Which IT Certification is Better for You?
Which IT Certification is Better for You?Which IT Certification is Better for You?
Which IT Certification is Better for You?Hossein Yavari
 
Creativity and Role of the Leaders
Creativity and Role of the LeadersCreativity and Role of the Leaders
Creativity and Role of the LeadersHossein Yavari
 
Yeastar Technical Training Course
Yeastar Technical Training CourseYeastar Technical Training Course
Yeastar Technical Training CourseHossein Yavari
 
FreePBX Disaster Recovery
FreePBX Disaster RecoveryFreePBX Disaster Recovery
FreePBX Disaster RecoveryHossein Yavari
 
LTE Architecture Overview
LTE Architecture OverviewLTE Architecture Overview
LTE Architecture OverviewHossein Yavari
 
Introduction to DIAMETER
Introduction to DIAMETERIntroduction to DIAMETER
Introduction to DIAMETERHossein Yavari
 
Introduction to SS7- Part 2
Introduction to SS7- Part 2Introduction to SS7- Part 2
Introduction to SS7- Part 2Hossein Yavari
 

More from Hossein Yavari (20)

What is Matroska?
What is Matroska?What is Matroska?
What is Matroska?
 
SIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingSIPREC RTPEngine Media Forking
SIPREC RTPEngine Media Forking
 
Windows Forensics
Windows ForensicsWindows Forensics
Windows Forensics
 
SIP over TLS
SIP over TLSSIP over TLS
SIP over TLS
 
Desjardins Data Breach
Desjardins Data BreachDesjardins Data Breach
Desjardins Data Breach
 
Introduction to Metasploit
Introduction to MetasploitIntroduction to Metasploit
Introduction to Metasploit
 
Which IT Certification is Better for You?
Which IT Certification is Better for You?Which IT Certification is Better for You?
Which IT Certification is Better for You?
 
Disassembly Using IDA
Disassembly Using IDADisassembly Using IDA
Disassembly Using IDA
 
Introduction to Snort
Introduction to SnortIntroduction to Snort
Introduction to Snort
 
SQL Injection in JAVA
SQL Injection in JAVASQL Injection in JAVA
SQL Injection in JAVA
 
Creativity and Role of the Leaders
Creativity and Role of the LeadersCreativity and Role of the Leaders
Creativity and Role of the Leaders
 
IPsec for IMS
IPsec for IMSIPsec for IMS
IPsec for IMS
 
eSIM Deep Dive
eSIM Deep DiveeSIM Deep Dive
eSIM Deep Dive
 
Yeastar Technical Training Course
Yeastar Technical Training CourseYeastar Technical Training Course
Yeastar Technical Training Course
 
SENA Cloud UC
SENA Cloud UCSENA Cloud UC
SENA Cloud UC
 
FreePBX Disaster Recovery
FreePBX Disaster RecoveryFreePBX Disaster Recovery
FreePBX Disaster Recovery
 
eSIM Overview
eSIM OvervieweSIM Overview
eSIM Overview
 
LTE Architecture Overview
LTE Architecture OverviewLTE Architecture Overview
LTE Architecture Overview
 
Introduction to DIAMETER
Introduction to DIAMETERIntroduction to DIAMETER
Introduction to DIAMETER
 
Introduction to SS7- Part 2
Introduction to SS7- Part 2Introduction to SS7- Part 2
Introduction to SS7- Part 2
 

Recently uploaded

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
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
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
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
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
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
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
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
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

DLL Injection

  • 2. Static Linking • Code libraries (.lib) include lots of functions to be copied to your program when required. • So, there is no need to reinvent the wheel and rewrite these functions again. • This is done by a program called a linker, which basically copies the needed functions into a program and generates the executable file with all the needed functions inside. • This process is called the static linking.
  • 3. Dynamic Linking • Statically linked libraries lead to having the same code copied repeatedly inside each program. • That might lead to the loss of hard disk space and increases the size of the executable files. • Dynamic linking allows programs to expand more and become more functionality-rich. • Instead of storing the code inside each executable, any needed library is loaded beside each application in the same virtual memory. • These libraries are named Dynamic Link Libraries (DLLs).
  • 4. Dynamic link libraries • Not all library functions are exported as some of them are for internal use. • But the functions that are exported can be accessed through its name or its ordinal number (index number). • They are called Application Programming Interfaces (APIs). • APIs are those exported functions in any library that any application can call or interact with • Some of known Windows DLLs: • kernel32.dll • ntdll.dll • user32.dll • advapi32.dll
  • 5. Dynamic API Loading • It's very common in malware code to obscure the name of the libraries and the APIs that they are using to hide their functionality from static analysis using what's called dynamic API loading. • Dynamic API loading is supported by Windows using two very well-known APIs : • LoadLibraryA: This API loads a dynamic link library into the virtual memory of the calling program and returns its address (variations include LoadLibraryW, LoadLibraryExA, and LoadLibraryExW). • GetProcAddress: This API gets the address of an API given its name and the address of the library that contains this API. • By calling these two APIs, the malware is able to access APIs that are not written in the import table and are totally hidden from the eyes of the reverse engineer.
  • 6. DLL Injection • The Windows operating system allows processes to load dynamic link libraries into other processes for security reasons, sandboxing, or even graphics. • DLL injection is used to manipulate the execution of a running process. • DLL injection primarily tricks an application to call a malicious DLL file which then gets executed as part of the target process. • DLL injection can be divided into 4 steps: • 1. Attach to the process • 2. Allocate Memory within the process • 3. Copy the DLL or the DLL Path into the processes memory and determine appropriate memory addresses • 4. Instruct the process to Execute your DLL
  • 7. Windows Supported DLL Injection • Windows has created registry entries for DLLs so that they can be loaded in every process that meets certain criteria. • Many of them allow the malware DLL to be injected into multiple processes, including browsers and other legitimate processes. • Most common ones: HKEY_LOCAL_MACHINESOFTWARE MicrosoftWindowsNTCurrentVers ionWindowsAppInit_DLLs • The libraries included in this path are loaded together with every process that loads user32.dll.
  • 8. Windows Supported DLL Injection (Cont.) • Other commonly misused registry key: • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSessionManagerAppCertDlls • The libraries in this registry entry are loaded in each process that calls at least one of the following Win32 API functions: • CreateProcess • CreateProcessAsUser • CreateProcessWithLogonW • CreateProcessWithTokenW • WinExec • This allows the malware to be injected into most browsers as many of them create child processes to manage different tabs and other applications as well.
  • 9. Windows Supported DLL Injection (Cont.) Autoruns from Sysinternals, allows you to see whether any of these registry entries have been exploited for malicious use on the current system. https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns
  • 10. Another DLL Injection Technique • This technique uses the LoadLibrary API to load a malicious library using Windows PE loader and execute its EntryPoint. • The main goal is to inject the path of the malicious DLL into the process using the VirtualAllocEx API and WriteProcessMemory. • Then, it creates a thread into that process using CreateRemoteThread, with the address of the LoadLibrary API as the thread start address. • When passing the DLL path as an argument to that thread (which is passed to the LoadLibrary API), the Windows PE loader will load that DLL into the process and execute its code flawlessly.
  • 11. Another DLL Injection Technique (Cont.) • The exact steps the malware generally follows are like so: 1. Get the targeted process handle via its PID using the OpenProcess API. This handle will be used to access, read, and write to this process. 2. Allocate a space in that process virtual memory using the VirtualAllocEx API. This space will be used to write the full path of the malicious DLL file. 3. Write to the process using the WriteProcessMemory API. Write the path of the malware DLL. 4. Load and execute this DLL using CreateRemoteThread and give the LoadLibraryA address as the start address and the address of the DLL path as an argument.